Skip to content

Add methods to average quaternions #76

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Conversation

janbridley
Copy link

@janbridley janbridley commented May 8, 2025

Methods for averaging quaternions were added, based on Markley 2007, who provides a maximum likelihood method for the average quaternion. This is different from the standard iterative (Weiszfeld) method for averaging rotations, and is faster and simpler (but not necessarily more correct?)

Quick and dirty benchmarks:

# let q_N = rowan.random.rand(N)
>>> %timeit -r 100 -n 1000 mean(q_1)
5.73 μs ± 1.41 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

>>> %timeit -r 100 -n 1000 mean(q_10)
6.01 μs ± 1.38 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

>>> %timeit -r 100 -n 1000 mean(q_100)
6.17 μs ± 1.45 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

>>> %timeit -r 100 -n 1000 mean(q_1000)
8.38 μs ± 1.81 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

>>> %timeit -r 100 -n 1000 mean(q_10_000)
29.8 μs ± 2.71 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

>>> %timeit -r 100 -n 1000 mean(q_100_000)
244 μs ± 4.31 μs per loop (mean ± std. dev. of 100 runs, 1,000 loops each)

TODO:

  • Properly cite paper
  • Add iterative refinement? Verify how much this changes answers

@janbridley janbridley changed the title Feat/mean quat Add methods to average quaternions May 8, 2025
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.

1 participant