Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created November 6, 2018 23:44
Show Gist options
  • Save chelseatroy/f199280835495d90bc74b0de18dbe17a to your computer and use it in GitHub Desktop.
Save chelseatroy/f199280835495d90bc74b0de18dbe17a to your computer and use it in GitHub Desktop.
Naive Python to C with Cython
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