From 3db7920f6559035b9c04cd8ef0aa998f4c6aa1e1 Mon Sep 17 00:00:00 2001 From: p-zach Date: Tue, 15 Apr 2025 23:53:43 -0400 Subject: [PATCH] Fix syntax errors --- gtsam/inference/VariableIndex.cpp | 10 +++++----- gtsam/inference/inference.i | 4 ++-- gtsam/linear/linear.i | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gtsam/inference/VariableIndex.cpp b/gtsam/inference/VariableIndex.cpp index 3d22501b3..ba291c1f2 100644 --- a/gtsam/inference/VariableIndex.cpp +++ b/gtsam/inference/VariableIndex.cpp @@ -23,12 +23,12 @@ namespace gtsam { using namespace std; -const FactorIndices& operator[](Key variable) const { - KeyMap::const_iterator item = index_.find(variable); +const FactorIndices& VariableIndex::operator[](Key variable) const { + return index_.find(variable)->second; } -const FactorIndices& at(Key variable) const { - KeyMap::const_iterator item = (*this)[variable]; +const FactorIndices& VariableIndex::at(Key variable) const { + KeyMap::const_iterator item = index_.find(variable); if(item == index_.end()) throw std::invalid_argument("Requested non-existent variable '" + DefaultKeyFormatter(variable) + @@ -37,7 +37,7 @@ const FactorIndices& at(Key variable) const { return item->second; } -bool empty(Key variable) const { +bool VariableIndex::empty(Key variable) const { return (*this)[variable].empty(); } diff --git a/gtsam/inference/inference.i b/gtsam/inference/inference.i index 084d97a01..2b05adf89 100644 --- a/gtsam/inference/inference.i +++ b/gtsam/inference/inference.i @@ -199,8 +199,8 @@ class VariableIndex { VariableIndex(const T& factorGraph); VariableIndex(const gtsam::VariableIndex& other); - const FactorIndices& at(Key variable) const; - bool empty(Key variable) const; + gtsam::FactorIndices& at(gtsam::Key variable) const; + bool empty(gtsam::Key variable) const; // Testable bool equals(const gtsam::VariableIndex& other, double tol) const; diff --git a/gtsam/linear/linear.i b/gtsam/linear/linear.i index 39947125a..3ad6be6c4 100644 --- a/gtsam/linear/linear.i +++ b/gtsam/linear/linear.i @@ -689,16 +689,16 @@ virtual class GaussianBayesTree { #include virtual class GaussianEliminationTree { - GaussianEliminationTree(const GaussianFactorGraph& factorGraph, - const VariableIndex& structure, const Ordering& order); - GaussianEliminationTree(const GaussianFactorGraph& factorGraph, - const Ordering& order); + GaussianEliminationTree(const gtsam::GaussianFactorGraph& factorGraph, + const gtsam::VariableIndex& structure, const gtsam::Ordering& order); + GaussianEliminationTree(const gtsam::GaussianFactorGraph& factorGraph, + const gtsam::Ordering& order); - bool GaussianEliminationTree::equals(const This& other, double tol) const; + bool equals(const This& other, double tol) const; - void print(const std::string& name = "GaussianEliminationTree: ", - const KeyFormatter& formatter = DefaultKeyFormatter) const; -} + void print(const string name = "GaussianEliminationTree: ", + const gtsam::KeyFormatter& formatter = gtsam::DefaultKeyFormatter) const; +}; #include class GaussianISAM {