@@ -120,7 +120,7 @@ def linear_interpolation_spherical(y_initial, y_final, n, pins=None):
120120 # Just use half the length of y_initial
121121 pins = np .zeros (len (y_initial [::2 ]))
122122
123- # Since we have a pin index per every PAIR of coordinates, we copy very
123+ # Since we have a pin index per every PAIR of coordinates, we copy every
124124 # entry. For example: [1 0] --> [1 1 0 0]
125125 # and we change only unpinned spins (0)
126126 _filter = np .repeat (pins , 2 ) == 0
@@ -177,7 +177,7 @@ def interpolation_Rodrigues_rotation(y_initial, y_final, n, pins=None):
177177 # Only use 1/3 of the length of y_initial (1 pin per mesh/lattice site)
178178 pins = np .zeros (len (y_initial [::3 ]))
179179
180- # Since we have a pin index per every TRIAD of coordinates, we copy very
180+ # Since we have a pin index per every TRIAD of coordinates, we copy every
181181 # entry. For example: [1 0] --> [1 1 1 0 0 0]
182182 # and we change only unpinned spins (0)
183183 _filter = np .repeat (pins , 3 ) == 0
@@ -191,8 +191,8 @@ def interpolation_Rodrigues_rotation(y_initial, y_final, n, pins=None):
191191 # The cross products of corresponding spins in the initial and final images
192192 yi_cross_yf = np .cross (y_initial , y_final )
193193 # This should only be an array of ones:
194- yi_cross_yf_norm = np .apply_along_axis ( lambda x : np . sqrt ( np . sum ( x ** 2 )),
195- 1 , yi_cross_yf )
194+ yi_cross_yf_norm = np .linalg . norm ( yi_cross_yf , axis = 1 )
195+
196196 # The rotation axis is just the normalised cross product defined before
197197 rot_axis = yi_cross_yf / yi_cross_yf_norm [:, np .newaxis ]
198198 rot_axis = np .cross (rot_axis , y_initial )
0 commit comments