Skip to content

Commit

Permalink
Moved empty to Factor base class.
Browse files Browse the repository at this point in the history
  • Loading branch information
dellaert committed Dec 31, 2021
1 parent 0ba1d3b commit 09573a3
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 19 deletions.
3 changes: 0 additions & 3 deletions gtsam/discrete/DiscreteFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class GTSAM_EXPORT DiscreteFactor: public Factor {
Base::print(s, formatter);
}

/** Test whether the factor is empty */
virtual bool empty() const { return size() == 0; }

/// @}
/// @name Standard Interface
/// @{
Expand Down
3 changes: 3 additions & 0 deletions gtsam/inference/Factor.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ typedef FastSet<FactorIndex> FactorIndexSet;
/// @name Standard Interface
/// @{

/// Whether the factor is empty (involves zero variables).
bool empty() const { return keys_.empty(); }

/// First key
Key front() const { return keys_.front(); }

Expand Down
3 changes: 0 additions & 3 deletions gtsam/linear/GaussianFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ namespace gtsam {
/** Clone a factor (make a deep copy) */
virtual GaussianFactor::shared_ptr clone() const = 0;

/** Test whether the factor is empty */
virtual bool empty() const = 0;

/**
* Construct the corresponding anti-factor to negate information
* stored stored in this factor.
Expand Down
3 changes: 0 additions & 3 deletions gtsam/linear/HessianFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ namespace gtsam {
*/
GaussianFactor::shared_ptr negate() const override;

/** Check if the factor is empty. TODO: How should this be defined? */
bool empty() const override { return size() == 0 /*|| rows() == 0*/; }

/** Return the constant term \f$ f \f$ as described above
* @return The constant term \f$ f \f$
*/
Expand Down
3 changes: 0 additions & 3 deletions gtsam/linear/JacobianFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ namespace gtsam {
*/
GaussianFactor::shared_ptr negate() const override;

/** Check if the factor is empty. TODO: How should this be defined? */
bool empty() const override { return size() == 0 /*|| rows() == 0*/; }

/** is noise model constrained ? */
bool isConstrained() const {
return model_ && model_->isConstrained();
Expand Down
4 changes: 0 additions & 4 deletions gtsam/slam/RegularImplicitSchurFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ class RegularImplicitSchurFactor: public GaussianFactor {
"RegularImplicitSchurFactor::clone non implemented");
}

bool empty() const override {
return false;
}

GaussianFactor::shared_ptr negate() const override {
return boost::make_shared<RegularImplicitSchurFactor<CAMERA> >(keys_,
FBlocks_, PointCovariance_, E_, b_);
Expand Down
3 changes: 0 additions & 3 deletions gtsam/symbolic/SymbolicFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ namespace gtsam {
/// @name Standard Interface
/// @{

/** Whether the factor is empty (involves zero variables). */
bool empty() const { return keys_.empty(); }

/** 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> >
Expand Down

0 comments on commit 09573a3

Please sign in to comment.