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

Quaternions has no support for autodiff or symbolic expressions #8

Closed
baggepinnen opened this issue Jan 13, 2016 · 4 comments
Closed

Comments

@baggepinnen
Copy link

Definitions like Quaternion(s::Real, v1::Real, v2::Real, v3::Real, n::Bool = false) prevents the use of packages like DualNumbers to perform automatic differentiation.
http://www.juliadiff.org/

The type specification ::Real further makes it impossible to use any kind of symbolic math software.

This could be worth considering to make the package useful in more situations.

@SimonDanisch
Copy link
Member

Pull requests to change this are very welcome and easy to write :)

@bzinberg
Copy link
Contributor

bzinberg commented Apr 7, 2020

Definitions like Quaternion(s::Real, v1::Real, v2::Real, v3::Real, n::Bool = false) prevents the use of packages like DualNumbers to perform automatic differentiation.

Is this actually true? I tried to use ForwardDiff with Quaternions and only found one obstacle (granted, I didn't do thorough testing, it was a means to an end). In particular, ForwardDiff.Dual is a subtype of Real.

The issue I ran into is this line in Quaternions.qrotation:

thetaT = convert(eltype(u), theta)

I was trying to differentiate with respect to theta, and u was a Vector{Float64}, so I got the (correct) error that theta could not be converted to a Float64.

I don't see any reason this conversion needs to happen. Indeed, autodiff worked for me after overriding the method to not have that line.

I'll try to send in a PR.

bzinberg added a commit to bzinberg/Quaternions.jl that referenced this issue Apr 7, 2020
bzinberg added a commit to bzinberg/Quaternions.jl that referenced this issue Apr 7, 2020
@baggepinnen
Copy link
Author

You're right, the Real annotation could not have been the problem..

ferrolho added a commit to ferrolho/RigidBodyDynamics.jl that referenced this issue Jan 13, 2022
Temporarily excludes notebook "6. Symbolics using SymPy" because of Quaternions.jl issue on handling symbols from SymPy.jl. (See JuliaGeometry/Quaternions.jl#8.)
sethaxen added a commit that referenced this issue Feb 19, 2022
* Add failing regression test for #8 (comment)

* Remove unnecessary type conversion.

Addresses #8.

* minor: simplify the "test this doesn't crash" logic

Co-authored-by: Seth Axen <[email protected]>

Co-authored-by: Seth Axen <[email protected]>
@hyrodium
Copy link
Collaborator

I'll close this issue because this seems stale. Please comment here if you have further thoughts.

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