Symbolic logProbability just throws

release/4.3a0
Frank Dellaert 2023-01-10 13:12:57 -08:00
parent ecb0be494e
commit b7fbe3f6a7
4 changed files with 30 additions and 6 deletions

View File

@ -33,4 +33,10 @@ bool SymbolicConditional::equals(const This& c, double tol) const {
return BaseFactor::equals(c) && BaseConditional::equals(c);
}
/* ************************************************************************* */
double SymbolicConditional::logProbability(const HybridValues& c) const {
throw std::runtime_error("SymbolicConditional::logProbability is not implemented");
}
} // namespace gtsam

View File

@ -95,13 +95,10 @@ namespace gtsam {
return FromIteratorsShared(keys.begin(), keys.end(), nrFrontals);
}
~SymbolicConditional() override {}
/// Copy this object as its actual derived type.
SymbolicFactor::shared_ptr clone() const { return boost::make_shared<This>(*this); }
/// @}
/// @name Testable
/// @{
@ -114,6 +111,19 @@ namespace gtsam {
bool equals(const This& c, double tol = 1e-9) const;
/// @}
/// @name HybridValues methods.
/// @{
/**
* logProbability throws exception, symbolic.
*/
double logProbability(const HybridValues& x) const override;
using Conditional::evaluate; // Expose evaluate(const HybridValues&) method..
using Conditional::operator(); // Expose evaluate(const HybridValues&) method..
using SymbolicFactor::error; // Expose error(const HybridValues&) method..
/// @}
private:
/** Serialization function */

View File

@ -26,6 +26,11 @@ using namespace std;
namespace gtsam {
/* ************************************************************************* */
double SymbolicFactor::error(const HybridValues& c) const {
throw std::runtime_error("SymbolicFactor::error is not implemented");
}
/* ************************************************************************* */
std::pair<boost::shared_ptr<SymbolicConditional>, boost::shared_ptr<SymbolicFactor> >
EliminateSymbolic(const SymbolicFactorGraph& factors, const Ordering& keys)

View File

@ -30,6 +30,7 @@ namespace gtsam {
// Forward declarations
class SymbolicConditional;
class HybridValues;
class Ordering;
/** SymbolicFactor represents a symbolic factor that specifies graph topology but is not
@ -46,7 +47,7 @@ namespace gtsam {
/** Overriding the shared_ptr typedef */
typedef boost::shared_ptr<This> shared_ptr;
/// @name Standard Interface
/// @name Standard Constructors
/// @{
/** Default constructor for I/O */
@ -106,10 +107,9 @@ namespace gtsam {
}
/// @}
/// @name Advanced Constructors
/// @{
public:
/** Constructor from a collection of keys */
template<typename KEYITERATOR>
static SymbolicFactor FromIterators(KEYITERATOR beginKey, KEYITERATOR endKey) {
@ -143,6 +143,9 @@ namespace gtsam {
/// @name Standard Interface
/// @{
/// The `error` method throws an exception.
double error(const HybridValues& c) const override;
/** Eliminate the variables in \c keys, in the order specified in \c keys, returning a
* conditional and marginal. */
std::pair<boost::shared_ptr<SymbolicConditional>, boost::shared_ptr<SymbolicFactor> >