Standardizing interfaces
parent
f6ad82eee6
commit
21f8079924
|
@ -137,12 +137,13 @@ namespace gtsam {
|
||||||
/// print only keys
|
/// print only keys
|
||||||
void printKeys(const std::string& s = "Factor", const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
void printKeys(const std::string& s = "Factor", const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
/// check equality
|
/// check equality
|
||||||
bool equals(const This& other, double tol = 1e-9) const;
|
bool equals(const This& other, double tol = 1e-9) const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
/// @name Advanced Interface
|
/// @name Advanced Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace gtsam {
|
||||||
|
|
||||||
/** Scale the values in \c gy according to the sigmas for the frontal variables in this
|
/** Scale the values in \c gy according to the sigmas for the frontal variables in this
|
||||||
* conditional. */
|
* conditional. */
|
||||||
void scaleFrontalsBySigma(VectorValuesUnordered& gy) const;
|
__declspec(deprecated) void scaleFrontalsBySigma(VectorValuesUnordered& gy) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -136,10 +136,8 @@ namespace gtsam {
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void serialize(Archive & ar, const unsigned int version) {
|
void serialize(Archive & ar, const unsigned int version) {
|
||||||
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(IndexConditional);
|
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseFactor);
|
||||||
ar & BOOST_SERIALIZATION_NVP(matrix_);
|
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseConditional);
|
||||||
ar & BOOST_SERIALIZATION_NVP(rsd_);
|
|
||||||
ar & BOOST_SERIALIZATION_NVP(sigmas_);
|
|
||||||
}
|
}
|
||||||
}; // GaussianConditionalUnordered
|
}; // GaussianConditionalUnordered
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,24 @@ namespace gtsam {
|
||||||
/** Return the dimension of the variable pointed to by the given key iterator */
|
/** Return the dimension of the variable pointed to by the given key iterator */
|
||||||
virtual size_t getDim(const_iterator variable) const = 0;
|
virtual size_t getDim(const_iterator variable) const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a dense \f$ [ \;A\;b\; ] \in \mathbb{R}^{m \times n+1} \f$
|
||||||
|
* Jacobian matrix, augmented with b with the noise models baked
|
||||||
|
* into A and b. The negative log-likelihood is
|
||||||
|
* \f$ \frac{1}{2} \Vert Ax-b \Vert^2 \f$. See also
|
||||||
|
* GaussianFactorGraph::jacobian and GaussianFactorGraph::sparseJacobian.
|
||||||
|
*/
|
||||||
|
virtual Matrix augmentedJacobian() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the dense Jacobian \f$ A \f$ and right-hand-side \f$ b \f$,
|
||||||
|
* with the noise models baked into A and b. The negative log-likelihood
|
||||||
|
* is \f$ \frac{1}{2} \Vert Ax-b \Vert^2 \f$. See also
|
||||||
|
* GaussianFactorGraph::augmentedJacobian and
|
||||||
|
* GaussianFactorGraph::sparseJacobian.
|
||||||
|
*/
|
||||||
|
virtual std::pair<Matrix,Vector> jacobian() const = 0;
|
||||||
|
|
||||||
/** Return the augmented information matrix represented by this GaussianFactorUnordered.
|
/** Return the augmented information matrix represented by this GaussianFactorUnordered.
|
||||||
* The augmented information matrix contains the information matrix with an
|
* The augmented information matrix contains the information matrix with an
|
||||||
* additional column holding the information vector, and an additional row
|
* additional column holding the information vector, and an additional row
|
||||||
|
|
|
@ -59,4 +59,11 @@ namespace gtsam {
|
||||||
SymbolicFactorUnordered::FromIterator(orderedKeys.begin() + nFrontals, orderedKeys.end())));
|
SymbolicFactorUnordered::FromIterator(orderedKeys.begin() + nFrontals, orderedKeys.end())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
std::pair<boost::shared_ptr<SymbolicConditionalUnordered>, boost::shared_ptr<SymbolicFactorUnordered> >
|
||||||
|
SymbolicFactorUnordered::eliminate(const OrderingUnordered& keys) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // gtsam
|
} // gtsam
|
||||||
|
|
|
@ -29,14 +29,9 @@ namespace gtsam {
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
class SymbolicConditionalUnordered;
|
class SymbolicConditionalUnordered;
|
||||||
|
|
||||||
/**
|
/** SymbolicFactorUnordered represents a symbolic factor that specifies graph topology but is not
|
||||||
* SymbolicFactorUnordered serves two purposes. It is the base class for all linear
|
* associated with any numerical function.
|
||||||
* factors (GaussianFactor, JacobianFactor, HessianFactor), and also functions
|
* \nosubgrouping */
|
||||||
* as a symbolic factor, used to do symbolic elimination by JunctionTree.
|
|
||||||
*
|
|
||||||
* It derives from Factor with a key type of Key, an unsigned integer.
|
|
||||||
* \nosubgrouping
|
|
||||||
*/
|
|
||||||
class GTSAM_EXPORT SymbolicFactorUnordered: public FactorUnordered {
|
class GTSAM_EXPORT SymbolicFactorUnordered: public FactorUnordered {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -92,7 +87,8 @@ namespace gtsam {
|
||||||
static SymbolicFactorUnordered FromIterator(KEYITERATOR beginKey, KEYITERATOR endKey) {
|
static SymbolicFactorUnordered FromIterator(KEYITERATOR beginKey, KEYITERATOR endKey) {
|
||||||
return SymbolicFactorUnordered(Base::FromIterators(beginKey, endKey)); }
|
return SymbolicFactorUnordered(Base::FromIterators(beginKey, endKey)); }
|
||||||
|
|
||||||
/** Constructor from a collection of keys */
|
/** Constructor from a collection of keys - compatible with boost::assign::list_of and
|
||||||
|
* boost::assign::cref_list_of */
|
||||||
template<class CONTAINER>
|
template<class CONTAINER>
|
||||||
static SymbolicFactorUnordered FromKeys(const CONTAINER& keys) {
|
static SymbolicFactorUnordered FromKeys(const CONTAINER& keys) {
|
||||||
return SymbolicFactorUnordered(Base::FromKeys(keys)); }
|
return SymbolicFactorUnordered(Base::FromKeys(keys)); }
|
||||||
|
@ -105,6 +101,13 @@ namespace gtsam {
|
||||||
/** Whether the factor is empty (involves zero variables). */
|
/** Whether the factor is empty (involves zero variables). */
|
||||||
bool empty() const { return keys_.empty(); }
|
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<SymbolicConditionalUnordered>, boost::shared_ptr<SymbolicFactorUnordered> >
|
||||||
|
eliminate(const OrderingUnordered& keys) const;
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
|
|
Loading…
Reference in New Issue