Skip to content

Instantly share code, notes, and snippets.

@b-rodrigues
Created December 2, 2014 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-rodrigues/a5afbedb0deda6ba140b to your computer and use it in GitHub Desktop.
Save b-rodrigues/a5afbedb0deda6ba140b to your computer and use it in GitHub Desktop.
import numpy as np
cimport numpy as np
cimport cython
@cython.boundscheck(False)
@cython.wraparound(False)
def my_cum_sum_memv(double[:, ::1] A,
double[:, ::1] B):
cdef int i, j, lA, lB
cdef float result = 0
lA = len(A)
lB = len(B)
for i in range(0,lA):
for j in range(0,lB):
result = result + A[i,j] * B[i,j]
return(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment