Fix compilation error

release/4.3a0
Fan Jiang 2022-03-12 10:49:11 -05:00
parent efa37ff315
commit 3aac52c3d3
2 changed files with 27 additions and 25 deletions

View File

@ -27,47 +27,45 @@ namespace gtsam {
/** /**
* Base class for hybrid probabilistic factors * Base class for hybrid probabilistic factors
*/ */
class GTSAM_EXPORT HybridFactor: public Factor { class GTSAM_EXPORT HybridFactor : public Factor {
public: public:
// typedefs needed to play nice with gtsam // typedefs needed to play nice with gtsam
typedef HybridFactor This; ///< This class typedef HybridFactor This; ///< This class
typedef boost::shared_ptr<HybridFactor> shared_ptr; ///< shared_ptr to this class typedef boost::shared_ptr<HybridFactor> shared_ptr; ///< shared_ptr to this class
typedef Factor Base; ///< Our base class typedef Factor Base; ///< Our base class
using Values = Values; ///< backwards compatibility
public: public:
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{
/** Default constructor creates empty factor */ /** Default constructor creates empty factor */
HybridFactor() {} HybridFactor() {}
/** Construct from container of keys. This constructor is used internally from derived factor /** Construct from container of keys. This constructor is used internally from derived factor
* constructors, either from a container of keys or from a boost::assign::list_of. */ * constructors, either from a container of keys or from a boost::assign::list_of. */
template<typename CONTAINER> template<typename CONTAINER>
HybridFactor(const CONTAINER& keys) : Base(keys) {} HybridFactor(const CONTAINER &keys) : Base(keys) {}
/// Virtual destructor /// Virtual destructor
virtual ~HybridFactor() { virtual ~HybridFactor() {
} }
/// @} /// @}
/// @name Testable /// @name Testable
/// @{ /// @{
/// equals /// equals
virtual bool equals(const HybridFactor& lf, double tol = 1e-9) const = 0; virtual bool equals(const HybridFactor &lf, double tol = 1e-9) const = 0;
/// print /// print
void print( void print(
const std::string& s = "HybridFactor\n", const std::string &s = "HybridFactor\n",
const KeyFormatter& formatter = DefaultKeyFormatter) const override { const KeyFormatter &formatter = DefaultKeyFormatter) const override {
Base::print(s, formatter); Base::print(s, formatter);
} }
/// @} /// @}
/// @name Standard Interface /// @name Standard Interface
@ -78,6 +76,7 @@ Base::print(s, formatter);
// HybridFactor // HybridFactor
// traits // traits
template<> struct traits<HybridFactor> : public Testable<HybridFactor> {}; template<>
struct traits<HybridFactor> : public Testable<HybridFactor> {};
}// namespace gtsam }// namespace gtsam

View File

@ -29,6 +29,9 @@ EliminateHybrid(const HybridFactorGraph &factors,
// The issue here is that, how can we know which variable is discrete if we // The issue here is that, how can we know which variable is discrete if we
// unify Values? Obviously we can tell using the factors, but is that fast? // unify Values? Obviously we can tell using the factors, but is that fast?
// In the case of multifrontal, we will need to use a constrained ordering
// so that the discrete parts will be guaranteed to be eliminated last!
// PRODUCT: multiply all factors // PRODUCT: multiply all factors
gttic(product); gttic(product);
KeySet allKeys; KeySet allKeys;