File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -292,13 +292,19 @@ HybridValues HybridSmoother::optimize() const {
292292}
293293
294294/* ************************************************************************* */
295- void HybridSmoother::relinearize () {
295+ void HybridSmoother::relinearize (const std::optional<Ordering> givenOrdering ) {
296296 allFactors_ = allFactors_.restrict (fixedValues_);
297297 HybridGaussianFactorGraph::shared_ptr linearized =
298298 allFactors_.linearize (linearizationPoint_);
299- HybridBayesNet::shared_ptr bayesNet = linearized->eliminateSequential ();
299+
300+ // Compute ordering if not given
301+ Ordering ordering = this ->maybeComputeOrdering (*linearized, givenOrdering);
302+
303+ HybridBayesNet::shared_ptr bayesNet =
304+ linearized->eliminateSequential (ordering);
300305 HybridValues delta = bayesNet->optimize ();
301306 linearizationPoint_ = linearizationPoint_.retract (delta.continuous ());
307+
302308 reInitialize (*bayesNet);
303309}
304310
Original file line number Diff line number Diff line change @@ -126,9 +126,13 @@ class GTSAM_EXPORT HybridSmoother {
126126 // / Optimize the hybrid Bayes Net, taking into accound fixed values.
127127 HybridValues optimize () const ;
128128
129- // / Relinearize the nonlinear factor graph
130- // / with the latest linearization point.
131- void relinearize ();
129+ /* *
130+ * @brief Relinearize the nonlinear factor graph with
131+ * the latest stored linearization point.
132+ *
133+ * @param givenOrdering An optional elimination ordering.
134+ */
135+ void relinearize (const std::optional<Ordering> givenOrdering = {});
132136
133137 // / Return the current linearization point.
134138 Values linearizationPoint () const ;
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ class HybridSmoother {
288288 std::optional<size_t > maxNrLeaves = std::nullopt ,
289289 const std::optional<gtsam::Ordering> given_ordering = std::nullopt );
290290
291- void relinearize ();
291+ void relinearize (const std::optional<gtsam::Ordering> givenOrdering );
292292
293293 gtsam::Values linearizationPoint () const ;
294294 gtsam::HybridNonlinearFactorGraph allFactors () const ;
You can’t perform that action at this time.
0 commit comments