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

Grassmann.jl vs Quaternions.jl #146

Closed
chakravala opened this issue Apr 18, 2024 · 9 comments
Closed

Grassmann.jl vs Quaternions.jl #146

chakravala opened this issue Apr 18, 2024 · 9 comments

Comments

@chakravala
Copy link

chakravala commented Apr 18, 2024

Grassmann.jl has its own dedicated Quaternion type for a while now, I've been focused on smoothing out various general things related to this package. Now things have stabilized and smoothed out again, I can look into further standardizing the quaternion interface. Grassmann.jl supports quaternions in a much more general way, but it the definitions are such that k = -v13

julia> using Grassmann; basis"3"
(⟨×××⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)

julia> s,i,j,k = v,v12,-v13,v23
(v, v₁₂, -1v₁₃, v₂₃)

julia> i*j == k
true

julia> quatvalues(s+2i+3j+4k)
4-element StaticVectors.Values{4, Int64} with indices SOneTo(4):
 1
 2
 3
 4

julia> v1  exp*i/2)
-1.0v₁ + 1.2246467991473532e-16v₂ + 0.0v₃

julia> v1  exp*i/4)
2.220446049250313e-16v₁ + 1.0v₂ + 0.0v₃

julia> v1  exp*i/8)
0.7071067811865475v₁ + 0.7071067811865476v₂ + 0.0v₃

julia> (v1+v2+v3)  exp*i/8+j*π/3)
-0.1577202379738252v₁ + 1.6085211528719414v₂ - 0.6227230743251773v₃

If anybody has anything to say about this, let me know.

@hyrodium
Copy link
Collaborator

Hi, thank you for maintaining Grassmann.jl!
I think https://juliapackagecomparisons.github.io/comparisons/math/quaternions/ (and its repo) is the right place to discuss the comparisons between these packages.

If you would like to add compatibility with Quaternions.jl to Grassmann.jl, it would be reasonable to define some methods in a package extension. Feel free to contact me if you have any problems! I'm happy to help with that.

@chakravala

This comment was marked as abuse.

@chakravala

This comment was marked as abuse.

@sethaxen
Copy link
Collaborator

I don't see any particular need for integration between Quaternions and Grassmann:

  • the packages seem to have very different scopes
  • there are multiple packages that implement quaternions without integrating with each other; this is fine
  • it sounds like neither you nor we are needing or asking for an integration, nor have any users of our packages. Integration without a use case for it would be premature.

@chakravala

This comment was marked as abuse.

@sethaxen sethaxen closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@ronisbr
Copy link

ronisbr commented May 12, 2024

You can keep building on deprecated software, but the foundation has been laid for deeper and more sophisticated ways of interacting with quaternions.

I just want to add an information here for future readers of this thread.

There is a huge number of applications using quaternions and each one has its own specificities. For example, I work with the attitude control subsystem of satellites. For us, quaternions are a good attitude representation. However, we see them as a 4 x 1 vector with real numbers and we only need to implement quaternion multiplication and its conversion to direct cosine matrices, Rodriguez parameters, Euler angles, etc. With only those algorithms, we can control the satellite attitude (it is almost the same with airplanes).

Now, I am seeking to develop an entire AOCS system using Julia language in a CubeSat. We have huge constraints on memory and processing power. Let's see how much time it takes to import each package:

julia> @time using Grassmann
  0.218593 seconds (354.27 k allocations: 27.317 MiB, 1.45% compilation time)

julia> @time using ReferenceFrameRotations
  0.144537 seconds (278.27 k allocations: 15.431 MiB, 1.52% compilation time)

julia> @time using Quaternions
  0.004729 seconds (9.21 k allocations: 728.609 KiB)

Hence, for my application, I will probably use Quaternions.jl and "copy" the required algorithm from ReferenceFrameRotations.jl to convert them to DCMs. Those timings show that Quaternions.jl probably has a significant smaller footprint compared to the other ones.

My point here is that having a way more complex package as Grassmann.jl that can provide an excellent workspace to deal with quaternion algebra does not turn every other package that defines quaternion deprecated.

@chakravala

This comment was marked as abuse.

@ronisbr
Copy link

ronisbr commented May 12, 2024

This information is very nice indeed! Thanks for sharing!

@chakravala

This comment was marked as abuse.

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

No branches or pull requests

4 participants