You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see numpy-quaternion has become a NumPy-2.0-transition-bottleneck downstream for pyxem (pyxem/pyxem#1099). There's discussion of our use of this package in #506 and #507.
I suggest to make numpy-quaternion an optional dependency.
# check broadcast shape is correct before calculation, as
# quaternion.rotat_vectors will perform outer product
# this keeps current __mul__ broadcast behaviour
Q1=quaternion.from_float_array(self.data)
v=quaternion.as_vector_part(
(Q1*quaternion.from_vector_part(other.data)) *~Q1
)
All places for speed, not for functionality. We had implementations of these things without numpy-quaternion before. We can re-introduce these computations as a fall-back if numpy-quaternion is unavailable.
As an added bonus to this work, I want to make it easier to make dependencies in orix optional. numpy-quaternion is a good place to start.
We can do this fairly quickly. If interest, we can make a v0.13.1 patch release.
The text was updated successfully, but these errors were encountered:
hakonanes
changed the title
Make numpy-quaternion and optional dependency (for speed)
Make numpy-quaternion an optional dependency (for speed)
Sep 5, 2024
hakonanes
changed the title
Make numpy-quaternion an optional dependency (for speed)
Make numpy-quaternion an optional dependency
Sep 5, 2024
I certainly will be very happy. I assume the speed trade-off is significant, but the documentation can be marked up to reflect that.
I think it's a factor of 2 is what @hakonanes said. I feel that is pretty minimal, there are other places in orix where it would be easier to speed things up if we really needed it.
I see numpy-quaternion has become a NumPy-2.0-transition-bottleneck downstream for pyxem (pyxem/pyxem#1099). There's discussion of our use of this package in #506 and #507.
I suggest to make numpy-quaternion an optional dependency.
We use numpy-quaternion for three operations:
orix/orix/quaternion/quaternion.py
Lines 208 to 214 in 688ee4a
orix/orix/quaternion/quaternion.py
Lines 222 to 225 in 688ee4a
orix/orix/quaternion/quaternion.py
Lines 226 to 233 in 688ee4a
All places for speed, not for functionality. We had implementations of these things without numpy-quaternion before. We can re-introduce these computations as a fall-back if numpy-quaternion is unavailable.
As an added bonus to this work, I want to make it easier to make dependencies in orix optional. numpy-quaternion is a good place to start.
We can do this fairly quickly. If interest, we can make a v0.13.1 patch release.
The text was updated successfully, but these errors were encountered: