Your IP : 216.73.216.213


Current Path : /opt/alt/python37/share/doc/alt-python37-Cython/Demos/
Upload File :
Current File : //opt/alt/python37/share/doc/alt-python37-Cython/Demos/numpy_demo.pyx

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