1cimport numpy as cnp 2 3 4def sum_of_squares(cnp.ndarray[double, ndim=1] arr): 5 cdef long N = arr.shape[0] 6 cdef double ss = 0 7 for i in range(N): 8 ss += arr[i]**2 9 return ss 10