From c6e9bfc8241c715f08afb8db9542acee79a9a7c0 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Tue, 31 Dec 2024 14:08:25 -0500 Subject: [PATCH] remove unused methods --- gtsam/discrete/DiscreteTableConditional.cpp | 34 --------------- gtsam/discrete/DiscreteTableConditional.h | 47 +-------------------- 2 files changed, 2 insertions(+), 79 deletions(-) diff --git a/gtsam/discrete/DiscreteTableConditional.cpp b/gtsam/discrete/DiscreteTableConditional.cpp index f50d7fbebc..bcb65628a5 100644 --- a/gtsam/discrete/DiscreteTableConditional.cpp +++ b/gtsam/discrete/DiscreteTableConditional.cpp @@ -141,18 +141,6 @@ bool DiscreteTableConditional::equals(const DiscreteFactor& other, } } -/* ************************************************************************** */ -TableFactor::shared_ptr DiscreteTableConditional::likelihood( - const DiscreteValues& frontalValues) const { - throw std::runtime_error("Likelihood not implemented"); -} - -/* ****************************************************************************/ -TableFactor::shared_ptr DiscreteTableConditional::likelihood( - size_t frontal) const { - throw std::runtime_error("Likelihood not implemented"); -} - /* ****************************************************************************/ DiscreteConditional::shared_ptr DiscreteTableConditional::max( const Ordering& keys) const { @@ -180,26 +168,4 @@ DiscreteConditional::shared_ptr DiscreteTableConditional::prune( this->nrFrontals(), this->discreteKeys(), pruned.sparseTable()); } -/* ************************************************************************** */ -size_t DiscreteTableConditional::argmax( - const DiscreteValues& parentsValues) const { - // Initialize - size_t maxValue = 0; - double maxP = 0; - DiscreteValues values = parentsValues; - - assert(nrFrontals() == 1); - Key j = firstFrontalKey(); - for (size_t value = 0; value < cardinality(j); value++) { - values[j] = value; - double pValueS = (*this)(values); - // Update MPE solution if better - if (pValueS > maxP) { - maxP = pValueS; - maxValue = value; - } - } - return maxValue; -} - } // namespace gtsam diff --git a/gtsam/discrete/DiscreteTableConditional.h b/gtsam/discrete/DiscreteTableConditional.h index f34cad2a30..7bd419f7b7 100644 --- a/gtsam/discrete/DiscreteTableConditional.h +++ b/gtsam/discrete/DiscreteTableConditional.h @@ -158,28 +158,8 @@ class GTSAM_EXPORT DiscreteTableConditional : public DiscreteConditional { /// @name Standard Interface /// @{ - /// Log-probability is just -error(x). - double logProbability(const DiscreteValues& x) const { return -error(x); } - - /// print index signature only - void printSignature( - const std::string& s = "Discrete Conditional: ", - const KeyFormatter& formatter = DefaultKeyFormatter) const { - static_cast(this)->print(s, formatter); - } - - /** Convert to a likelihood factor by providing value before bar. */ - TableFactor::shared_ptr likelihood(const DiscreteValues& frontalValues) const; - - /** Single variable version of likelihood. */ - TableFactor::shared_ptr likelihood(size_t frontal) const; - - /** - * @brief Return assignment for single frontal variable that maximizes value. - * @param parentsValues Known assignments for the parents. - * @return maximizing assignment for the frontal variable. - */ - size_t argmax(const DiscreteValues& parentsValues = DiscreteValues()) const; + /// Return the underlying TableFactor + TableFactor table() const { return table_; } /** * @brief Create new conditional by maximizing over all @@ -195,29 +175,6 @@ class GTSAM_EXPORT DiscreteTableConditional : public DiscreteConditional { /// @name Advanced Interface /// @{ - /// Return all assignments for frontal variables. - std::vector frontalAssignments() const; - - /// Return all assignments for frontal *and* parent variables. - std::vector allAssignments() const; - - /// @} - /// @name HybridValues methods. - /// @{ - - using BaseConditional::operator(); ///< HybridValues version - - /** - * Calculate log-probability log(evaluate(x)) for HybridValues `x`. - * This is actually just -error(x). - */ - double logProbability(const HybridValues& x) const override { - return -error(x); - } - - /// Return the underlying TableFactor - TableFactor table() const { return table_; } - /// Evaluate the conditional given the values. virtual double evaluate(const Assignment& values) const override { return table_.evaluate(values);