concept documentation cleanup

release/4.3a0
Chris Beall 2010-10-21 20:52:34 +00:00
parent 48be990ef1
commit 0245ab06d2
2 changed files with 155 additions and 146 deletions

View File

@ -14,8 +14,45 @@
* @brief Base class and basic functions for Lie types
* @author Richard Roberts
* @author Alex Cunningham
*
* The necessary functions to implement for Lie are defined
* below with additional details as to the interface. The
* concept checking function in class Lie will check whether or not
* the function exists and throw compile-time errors.
*
* Returns dimensionality of the tangent space
* inline size_t dim() const;
*
* Returns Exponential map update of T
* A default implementation of expmap(*this, lp) is available:
* expmap_default()
* T expmap(const Vector& v) const;
*
* expmap around identity
* static T Expmap(const Vector& v);
*
* Returns Log map
* A default implementation of logmap(*this, lp) is available:
* logmap_default()
* Vector logmap(const T& lp) const;
*
* Logmap around identity
* static Vector Logmap(const T& p);
*
* Compute l0 s.t. l2=l1*l0, where (*this) is l1
* A default implementation of between(*this, lp) is available:
* between_default()
* T between(const T& l2) const;
*
* compose with another object
* T compose(const T& p) const;
*
* invert the object and yield a new one
* T inverse() const;
*
*/
#pragma once
#include <string>
@ -31,15 +68,15 @@ namespace gtsam {
/** Compute l0 s.t. l2=l1*l0 */
template<class T>
inline T between_default(const T& l1, const T& l2) { return l1.inverse().compose(l2); }
inline T between_default(const T& l1, const T& l2) {return l1.inverse().compose(l2);}
/** Log map centered at l0, s.t. exp(l0,log(l0,lp)) = lp */
template<class T>
inline Vector logmap_default(const T& l0, const T& lp) { return T::Logmap(l0.between(lp)); }
inline Vector logmap_default(const T& l0, const T& lp) {return T::Logmap(l0.between(lp));}
/** Exponential map centered at l0, s.t. exp(t,d) = t*exp(d) */
template<class T>
inline T expmap_default(const T& t, const Vector& d) { return t.compose(T::Expmap(d)); }
inline T expmap_default(const T& t, const Vector& d) {return t.compose(T::Expmap(d));}
/**
* Base class for Lie group type
@ -93,52 +130,6 @@ namespace gtsam {
T inverse_ret = t.inverse();
}
/**
* The necessary functions to implement for Lie are defined
* below with additional details as to the interface. The
* concept checking function above will check whether or not
* the function exists and throw compile-time errors.
*/
/**
* Returns dimensionality of the tangent space
*/
// inline size_t dim() const;
/**
* Returns Exponential map update of T
* A default implementation of expmap(*this, lp) is available:
* expmap_default()
*/
// T expmap(const Vector& v) const;
/** expmap around identity */
// static T Expmap(const Vector& v);
/**
* Returns Log map
* A default implementation of logmap(*this, lp) is available:
* logmap_default()
*/
// Vector logmap(const T& lp) const;
/** Logmap around identity */
// static Vector Logmap(const T& p);
/**
* Compute l0 s.t. l2=l1*l0, where (*this) is l1
* A default implementation of between(*this, lp) is available:
* between_default()
*/
// T between(const T& l2) const;
/** compose with another object */
// inline T compose(const T& p) const;
/** invert the object and yield a new one */
// inline T inverse() const;
};
/** Call print on the object */

View File

@ -13,6 +13,20 @@
* @file Testable
* @brief Abstract base class for values that can be used in unit tests
* @author Frank Dellaert
*
* The necessary functions to implement for Testable are defined
* below with additional details as to the interface.
* The concept checking function will check whether or not
* the function exists in derived class and throw compile-time errors.
*
* print with optional string naming the object
* void print(const std::string& name) const = 0;
*
* equality up to tolerance
* tricky to implement, see NonlinearFactor1 for an example
* equals is not supposed to print out *anything*, just return true|false
* bool equals(const Derived& expected, double tol) const = 0;
*
*/
// \callgraph
@ -35,6 +49,10 @@ namespace gtsam {
class Testable {
private:
/**
* This concept check is to make sure these methods exist in derived classes
* This is as an alternative to declaring those methods virtual, which is slower
*/
static void concept(const Derived& d) {
const Derived *const_derived = static_cast<Derived*>(&d);
const_derived->print(std::string());