Standardizing interfaces

release/4.3a0
Richard Roberts 2013-07-08 01:33:43 +00:00
parent f6ad82eee6
commit 21f8079924
5 changed files with 42 additions and 15 deletions

View File

@ -137,12 +137,13 @@ namespace gtsam {
/// print only keys
void printKeys(const std::string& s = "Factor", const KeyFormatter& formatter = DefaultKeyFormatter) const;
protected:
/// check equality
bool equals(const This& other, double tol = 1e-9) const;
/// @}
public:
/// @name Advanced Interface
/// @{

View File

@ -128,7 +128,7 @@ namespace gtsam {
/** Scale the values in \c gy according to the sigmas for the frontal variables in this
* conditional. */
void scaleFrontalsBySigma(VectorValuesUnordered& gy) const;
__declspec(deprecated) void scaleFrontalsBySigma(VectorValuesUnordered& gy) const;
private:
@ -136,10 +136,8 @@ namespace gtsam {
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(IndexConditional);
ar & BOOST_SERIALIZATION_NVP(matrix_);
ar & BOOST_SERIALIZATION_NVP(rsd_);
ar & BOOST_SERIALIZATION_NVP(sigmas_);
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseFactor);
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseConditional);
}
}; // GaussianConditionalUnordered

View File

@ -60,6 +60,24 @@ namespace gtsam {
/** Return the dimension of the variable pointed to by the given key iterator */
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.
* The augmented information matrix contains the information matrix with an
* additional column holding the information vector, and an additional row

View File

@ -59,4 +59,11 @@ namespace gtsam {
SymbolicFactorUnordered::FromIterator(orderedKeys.begin() + nFrontals, orderedKeys.end())));
}
/* ************************************************************************* */
std::pair<boost::shared_ptr<SymbolicConditionalUnordered>, boost::shared_ptr<SymbolicFactorUnordered> >
SymbolicFactorUnordered::eliminate(const OrderingUnordered& keys) const
{
}
} // gtsam

View File

@ -29,14 +29,9 @@ namespace gtsam {
// Forward declarations
class SymbolicConditionalUnordered;
/**
* SymbolicFactorUnordered serves two purposes. It is the base class for all linear
* factors (GaussianFactor, JacobianFactor, HessianFactor), and also functions
* 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
*/
/** SymbolicFactorUnordered represents a symbolic factor that specifies graph topology but is not
* associated with any numerical function.
* \nosubgrouping */
class GTSAM_EXPORT SymbolicFactorUnordered: public FactorUnordered {
public:
@ -92,7 +87,8 @@ namespace gtsam {
static SymbolicFactorUnordered FromIterator(KEYITERATOR beginKey, KEYITERATOR 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>
static SymbolicFactorUnordered FromKeys(const CONTAINER& keys) {
return SymbolicFactorUnordered(Base::FromKeys(keys)); }
@ -105,6 +101,13 @@ namespace gtsam {
/** 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<SymbolicConditionalUnordered>, boost::shared_ptr<SymbolicFactorUnordered> >
eliminate(const OrderingUnordered& keys) const;
/// @}
private:
/** Serialization function */
friend class boost::serialization::access;