vaipatel / morphops

Geometric Morphometrics in Python
https://morphops.readthedocs.io/en/latest/
MIT License
27 stars 4 forks source link

Let procrustes.rotate() accept 3d tensor, i.e. a list of matrices, for source and target #1

Closed vaipatel closed 5 years ago

vaipatel commented 5 years ago

In GPA, the rotation step involves rotating all the landmark sets onto the current mean. It might possibly be faster to do such multiple rotations in one go, without having to trade up too much memory.

vaipatel commented 5 years ago

Here is some code to see how np.swapaxes can be used with np.matmul or @ magic.

X, Y = np.random.randn(3,20,2), np.random.randn(3,20,2)
C = Y.swapaxes(1,2) @ X 
# C will contain 3 2x2 matrices.
vaipatel commented 5 years ago

Implemented in ea39930, tested in 7f78034