Skip to content

Commit 1ab1d82

Browse files
authored
Restore ForwardDiff support in parametric and use precision matrices (#1915)
* Update belief topology trait * ForwardDiff support in solve_RLM and use precision matrices * tmp: don't test upstream-dev AMP develop --------- Co-authored-by: Johannes Terblanche <Affie@users.noreply.github.com>
1 parent b07b219 commit 1ab1d82

8 files changed

Lines changed: 279 additions & 103 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
using Pkg;
8686
Pkg.add(PackageSpec(name="DistributedFactorGraphs",rev="develop"))
87-
Pkg.add(PackageSpec(name="ApproxManifoldProducts",rev="develop"));
87+
# Pkg.add(PackageSpec(name="ApproxManifoldProducts",rev="develop"));
8888
Pkg.develop([PackageSpec(path="IncrementalInference"), PackageSpec(path="IncrementalInferenceTypes")]);
8989
- name: Run tests
9090
continue-on-error: ${{ matrix.group == 'tmp_debug_group' }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ Manifest.toml
99
*.cov
1010
lcov.info
1111
benchmark/results.md
12+
benchmark/#*
13+

IncrementalInference/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
2020
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
2121
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
2222
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
23+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
2324
FunctionalStateMachine = "3e9e306e-7e3c-11e9-12d2-8f8f67a2f951"
2425
IncrementalInferenceTypes = "9808408f-4dbc-47e4-913c-6068b950e289"
2526
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
@@ -83,6 +84,7 @@ FileIO = "1"
8384
FiniteDiff = "2"
8485
FiniteDifferences = "0.12"
8586
Flux = "0.14, 0.15, 0.16"
87+
ForwardDiff = "1.3.3"
8688
FunctionalStateMachine = "0.2.9, 0.3"
8789
Gadfly = "1"
8890
IncrementalInferenceTypes = "0.1.0"

IncrementalInference/src/entities/BeliefTypes.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ function TreeBelief(
7878
end
7979

8080
function TreeBelief(vnd::State, solvDim::Real = 0)
81-
TreeBelief(DFG.getDensityKind(vnd), vnd, solvDim)
81+
TreeBelief(DFG.getTopologyKind(vnd), vnd, solvDim)
8282
end
8383

84-
function TreeBelief(::DFG.GaussianDensityKind, vnd::State, solvDim::Real = 0)
84+
function TreeBelief(::DFG.RootsOnlyTopology, vnd::State, solvDim::Real = 0)
8585
return TreeBelief(
8686
DFG.refMeans(vnd),
8787
DFG.refCovariances(vnd)[1],
@@ -92,7 +92,7 @@ function TreeBelief(::DFG.GaussianDensityKind, vnd::State, solvDim::Real = 0)
9292
)
9393
end
9494

95-
function TreeBelief(::DFG.NonparametricDensityKind, vnd::State, solvDim::Real = 0)
95+
function TreeBelief(::DFG.LeavesOnlyTopology, vnd::State, solvDim::Real = 0)
9696
return TreeBelief(
9797
DFG.refPoints(vnd),
9898
DFG.refBandwidth(vnd),

IncrementalInference/src/manifolds/services/ManifoldsExtentions.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ function Manifolds.get_vector!(M::NPowerManifold, Y, p, c, B::AbstractBasis)
5555
return Y
5656
end
5757

58+
# Allocating get_vector that infers element type from coordinates (Dual-compatible)
59+
function ManifoldsBase.get_vector(M::NPowerManifold, p, c, B::AbstractBasis)
60+
dim = manifold_dimension(M.manifold)
61+
rep_size = Manifolds.representation_size(M.manifold)
62+
v_iter = Ref(0)
63+
return [begin
64+
coords_i = SVector{dim}(view(c, v_iter[]+1:v_iter[]+dim))
65+
v_iter[] += dim
66+
get_vector(M.manifold, Manifolds._read(M, rep_size, p, i), coords_i, B)
67+
end for i in Manifolds.get_iterator(M)]
68+
end
69+
5870
function Manifolds.exp!(M::NPowerManifold, q, p, X)
5971
rep_size = Manifolds.representation_size(M.manifold)
6072
for i in Manifolds.get_iterator(M)
@@ -67,6 +79,16 @@ function Manifolds.exp!(M::NPowerManifold, q, p, X)
6779
return q
6880
end
6981

82+
# Allocating exp that infers element type from tangent vector (Dual-compatible)
83+
function ManifoldsBase.exp(M::NPowerManifold, p, X)
84+
rep_size = Manifolds.representation_size(M.manifold)
85+
return [exp(
86+
M.manifold,
87+
Manifolds._read(M, rep_size, p, i),
88+
Manifolds._read(M, rep_size, X, i),
89+
) for i in Manifolds.get_iterator(M)]
90+
end
91+
7092
function LieGroups.compose!(M::NPowerManifold, x, p, q)
7193
rep_size = representation_size(M.manifold)
7294
for i in Manifolds.get_iterator(M)

0 commit comments

Comments
 (0)