Reputation: 1365
I know nothing about cython, only python.
The function emd_c
below (from the pot
optimal transport package) has a header whose argument formats I've never seen before, or which I don't think would work under stand-alone python/numpy, but perhaps only if cython is loaded as well.
def emd_c(np.ndarray[double, ndim=1, mode="c"] a, np.ndarray[double, ndim=1, mode="c"] b, np.ndarray[double, ndim=2, mode="c"] M, int max_iter):
As you can see, there are spaces in the arguments themselves ([] a
, [] b
, [] M
) which would normally be illegal.
I wanted to use this function stand-alone rather than installing the entire package it comes from:
Copying the function out of the package it came from, and pasting the function by itself in my own script, Spyder instantly gave me an invalid syntax
error when I tried to run my script, even though I was only expecting errors having to do with missing dependencies. My questions here only have to do with trying to understand this strange-looking function.
Upvotes: 0
Views: 69