Created
December 2, 2014 09:59
-
-
Save b-rodrigues/1c12c4d2c64ffb7b7d11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cimport cython | |
cdef class MatOpC: | |
#no need to declare the matrices anymore, they're declared inside the pxd file | |
#cdef public double[:, ::1] matA, matB | |
def __init__(self, A, B): | |
self.matA = A | |
self.matB = B | |
@cython.boundscheck(False) | |
@cython.wraparound(False) | |
cpdef cumsumC(self): | |
cdef int i, j, lA, lB | |
cdef float result = 0 | |
lA = len(self.matA) | |
lB = len(self.matB) | |
for i in range(0,lA): | |
for j in range(0,lB): | |
result = result + self.matA[i,j] * self.matB[i,j] | |
return(result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment