Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Optimise quaternion computations #114

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jni
Copy link

@jni jni commented Dec 6, 2023

Thanks @mikesmic for your guidance re quaternion product — that helped me understand the code in calc_sym_eqvs which is currently the slowest part of reading in a file. I've vectorised most of the operations and... See identical performance! 😅 So more work is needed. The other thing is that extract_quat_comps takes up ~50% of the runtime and that should be ~0 if the internal data structure was a NumPy array to begin with. The other target of optimisation is that operations like np.cross are more efficient when the coefficients are in certain axes... So I'll play with that too.

@rhysgt
Copy link
Contributor

rhysgt commented Jan 24, 2024

There might be some more inspiration for improvements from these packages
https://github.com/moble/quaternion

I particularly like this, which adds a quaternion dtype to numpy
https://github.com/moble/quaternionic

@rhysgt
Copy link
Contributor

rhysgt commented Apr 26, 2024

We're hoping to make a new release in the not too distant future! Would be nice to include any optimisation to runtime for quaternion operations.

I think the slow speeds we see are a consequence of using a list of quat objects for some operations, which is then slow to convert back to a numpy array for efficient vectorised calculations, as you mention.

@jni
Copy link
Author

jni commented Apr 26, 2024

Ah cool to hear @rhysgt! I will try to pick this up again (or happy to set up a time where we can pair up on it, as I am still a bit lost about the roles of all the data structures in DefDAP).

btw would you and/or @mikesmic mind checking the Zulip chat re reading Jie's data with overlapping bins? (The data is linked in the zip and I can't read it correctly with DefDAP — I get nan's for the strain maps.) (Maybe I should just open an issue 😅 but right now it's bedtime and I wanted to make sure it's on your radar before release. 😊)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants