-
Notifications
You must be signed in to change notification settings - Fork 56
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
Improve performance of selected operations on SE(n) #655
Conversation
Codecov Report
@@ Coverage Diff @@
## master #655 +/- ##
=======================================
Coverage 99.22% 99.22%
=======================================
Files 106 106
Lines 10440 10481 +41
=======================================
+ Hits 10359 10400 +41
Misses 81 81
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I tried something similar but missed the SE(N) dispatches. function Manifolds.log(M::Manifolds.GeneralUnitaryMatrices{3,ℝ}, p::SMatrix, q::SMatrix)
U = transpose(p) * q
cosθ = (tr(U) - 1) / 2
if cosθ ≈ -1
eig = Manifolds.eigen_safe(U)
ival = findfirst(λ -> isapprox(λ, 1), eig.values)
inds = SVector{3}(1:3)
#TODO this is to stop convert error of ax as a complex number
ax::Vector{Float64} = eig.vectors[inds, ival]
return get_vector(M, p, π * ax, DefaultOrthogonalBasis())
end
X = U ./ Manifolds.usinc_from_cos(cosθ)
return (X .- X') ./ 2
end
function Manifolds.get_coordinates(
::Manifolds.GeneralUnitaryMatrices{3,ℝ},
p::SMatrix,
X::SMatrix,
::DefaultOrthogonalBasis{ℝ,Manifolds.TangentSpaceType},
)
return SA[X[3, 2], X[1, 3], X[2, 1]]
end |
Sure, I will add those too. |
@dehann, it looks like with these kinds of optimizations we can get down to zero allocations in the factor residual functions. |
Oh, that is great, acknowledged thanks! |
See JuliaRobotics/IncrementalInference.jl#1546 (comment) for explanation.