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

Jacobian of exp(RotationVecGenerator(...)) at 0 results in NaN #280

Open
cafaxo opened this issue Dec 3, 2023 · 0 comments
Open

Jacobian of exp(RotationVecGenerator(...)) at 0 results in NaN #280

cafaxo opened this issue Dec 3, 2023 · 0 comments

Comments

@cafaxo
Copy link

cafaxo commented Dec 3, 2023

This should not result in NaN:

julia> f(p) = exp(RotationVecGenerator(p[1], p[2], p[3]));

julia> ForwardDiff.jacobian(f, [0.0, 0.0, 0.0])
9×3 Matrix{Float64}:
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN

The correct output is

julia> f2(p) = exp(SMatrix(RotationVecGenerator(p[1], p[2], p[3])));

julia> ForwardDiff.jacobian(f2, [0.0, 0.0, 0.0])
9×3 Matrix{Float64}:
 0.0   0.0   0.0
 0.0   0.0   1.0
 0.0  -1.0   0.0
 0.0   0.0  -1.0
 0.0   0.0   0.0
 1.0   0.0   0.0
 0.0   1.0   0.0
-1.0   0.0   0.0
 0.0   0.0   0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants