Skip to content

Commit 74fe3e4

Browse files
committed
call generic_norm2 to workaround StaticArray inaccurate norm
1 parent 4be7c42 commit 74fe3e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ end
9191
# expω(w,q=1) = I + sin(norm(w)*q)/norm(w)*skew(w) + (1-cos(norm(w)*q))/norm(w)^2*skew(w)^2 # verified to work
9292

9393
function expω(w,q=1)
94-
nw = norm(w)
95-
if nw < 1e-12 # TODO: Use TaylorSeries.jl to approximate this for small nw, I verified TaylorSeries.jl to work well for this
94+
# nw = norm(w) # norm of staticarray is too inaccurate, causing ForwardDiff to NaN https://github.com/JuliaArrays/StaticArrays.jl/issues/913
95+
nw = LinearAlgebra.generic_norm2(w)
96+
if nw < 1e-12
9697
tmp = (nw*q)^2
9798
I + (1-tmp/6)*q*skew(w) + (0.5 - tmp/24)*(q*skew(w))^2
9899
else

0 commit comments

Comments
 (0)