Created
November 6, 2018 23:44
-
-
Save chelseatroy/f199280835495d90bc74b0de18dbe17a to your computer and use it in GitHub Desktop.
Naive Python to C with Cython
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
import numpy as np | |
def cython_multiplication(a,b): | |
product = np.ones(a.shape) | |
for row_index in np.arange(a.shape[0]): | |
for col_index in np.arange(a.shape[1]): | |
product[row_index][col_index] = a[row_index][col_index] * b[row_index][col_index] | |
return product |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment