From fab3b01756a53553a3efaca7e8447ff92e07f018 Mon Sep 17 00:00:00 2001 From: Michael Bosse Date: Sat, 9 Nov 2019 19:49:59 -0800 Subject: [PATCH] updates from code review --- .../examples/FixedLagSmootherExample.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gtsam_unstable/examples/FixedLagSmootherExample.cpp b/gtsam_unstable/examples/FixedLagSmootherExample.cpp index a6d5b699d..dc9b00580 100644 --- a/gtsam_unstable/examples/FixedLagSmootherExample.cpp +++ b/gtsam_unstable/examples/FixedLagSmootherExample.cpp @@ -145,18 +145,19 @@ int main(int argc, char** argv) { cout << setprecision(5) << " Key: " << key_timestamp.first << " Time: " << key_timestamp.second << endl; } - // get the linearization point + // Here is an example of how to get the full Jacobian of the problem. + // First, get the linearization point. Values result = smootherISAM2.calculateEstimate(); - // create the factor graph - auto &factor_graph = smootherISAM2.getFactors(); + // Get the factor graph + auto &factorGraph = smootherISAM2.getFactors(); - // linearize to a Gaussian factor graph - boost::shared_ptr linear_graph = factor_graph.linearize(result); + // Linearize to a Gaussian factor graph + boost::shared_ptr linearGraph = factorGraph.linearize(result); - // this is where the segmentation fault occurs - Matrix A = linear_graph->jacobian().first; - cout << " A = " << A << endl; + // Converts the linear graph into a Jacobian factor and extracts the Jacobian matrix + Matrix jacobian = linearGraph->jacobian().first; + cout << " Jacobian: " << jacobian << endl; return 0; }