Skip to content

Commit 12f8947

Browse files
committed
api improvement to FGC
1 parent c8bdce8 commit 12f8947

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/services/FactorGradients.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ function (fgc::FactorGradientsCached!)(meas_pts...)
161161
return fgc.cached_gradients
162162
end
163163

164+
# convenience function to update the gradients based on current measurement and point information stored in the fgc object
165+
(fgc::FactorGradientsCached!)() = fgc(fgc.measurement..., fgc.currentPoints...)
166+
164167
"""
165168
$SIGNATURES
166169

test/testFactorGradients.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ J__
3838
@test norm( J__ - [0 0 1 0; 0 0 0 1; 1 0 0 0; 0 1 0 0] ) < 1e-4
3939

4040

41-
##
41+
## build new functor container
4242

4343
gradFct = FactorGradientsCached!(pp, varTypes, measurement, pts);
4444

45+
## test grad calc for current values
46+
47+
J_c = gradFct()
48+
49+
@test norm( J_c - [0 0 1 0; 0 0 0 1; 1 0 0 0; 0 1 0 0] ) < 1e-4
50+
4551
##
4652

4753
J = gradFct(measurement..., pts...)

0 commit comments

Comments
 (0)