summaryrefslogtreecommitdiff
path: root/Demos/numpy_demo.pyx
blob: 59b5dc9ff288bf7c0409c4f256d771cfa1a8030b (plain)
1
2
3
4
5
6
7
8
9
cimport numpy as cnp


def sum_of_squares(cnp.ndarray[double, ndim=1] arr):
    cdef long N = arr.shape[0]
    cdef double ss = 0
    for i in range(N):
        ss += arr[i]**2
    return ss