Atlas-Download-Tools
Atlas-Download-Tools copied to clipboard
Implement norm with `np.hypot`
Would be nice to check whether it is faster:)
I think np.linalg.norm and np.hypot have slightly different interfaces that correspond to different usecases:
np.linalg.norm(vecs, axis=1)- all coordinates in the same arraynp.hypot(xs, ys)- coordinates in separate arrays, more like a mesh-grid; only 2D.
By in the case of DisplacementField.norm
https://github.com/BlueBrain/Atlas-Download-Tools/blob/8386f2bd0baf4d549dea48b00dae72379f5c6fbf/src/atldld/base.py#L215-L218
we could definitely improve by using np.hypot(self.delta_x, self.delta_y)
Heh, for some reason I thought we had np.norm in the code but it is clearly not the case. I will adjust the name of this issue.