Open akapet00 opened 1 year ago
FYI I think the motivation was that numpy's cross
did not originally broadcast. Now that it does we could replace it. But we'd want to make sure that it doesn't require a super new NumPy (e.g., 1.23) and works with some older ones (back to 1.19 or 1.20). But from looking at the NumPy doc it seems like it was supported all the way back in 1.13, so yes we could change this!
Relevant code: https://github.com/nipy/PySurfer/blob/a5a019ec5c6d25cdef92aca84a5e1ce1f9ba6fef/surfer/utils.py#L179-L213
Hi,
I was browsing through the code and I accidentally stumbled upon the function
_fast_cross_3d
referenced in the URL above. I don't think that this implementation is faster thannumpy
's implementation of the cross product - for example, please take a look at the following code:When I time it, I get the following results:
A potential, but very small speed up could be achieved by using
np.stack
instead ofnp.c_
because it has some cool compilednumpy
's stuff whichnp.c_
lacks. For example:I didn't want to open a PR because I really don't know if this is even relevant anymore or if the difference in a few ms is that important, but still wanted to let you know :)