Added const verifiers for member functions of the class which are compatible

release/4.3a0
Manohar Paluri 2009-08-26 15:25:47 +00:00
parent 725f5624c3
commit 0b1b5eca67
12 changed files with 17 additions and 17 deletions

View File

@ -91,10 +91,10 @@ namespace gtsam {
const Matrix& get_R() const {return R_;}
/** STL like, return the iterator pointing to the first node */
const_iterator const parentsBegin(){ return parents_.begin(); }
const_iterator const parentsBegin() const { return parents_.begin(); }
/** STL like, return the iterator pointing to the last node */
const_iterator const parentsEnd(){ return parents_.end(); }
const_iterator const parentsEnd() const { return parents_.end(); }
/** find the number of parents */
size_t size() const {return parents_.size();}

View File

@ -33,7 +33,7 @@ namespace gtsam {
virtual ~FGConfig() {};
/** return all the nodes in the graph **/
std::vector<std::string> get_names(){
std::vector<std::string> get_names() {
std::vector<std::string> names;
for(iterator it=values.begin(); it!=values.end(); it++)
names.push_back(it->first);

View File

@ -37,7 +37,7 @@ namespace gtsam {
public:
/** get the factors to a specific node */
const std::list<int>& get_factors_to_node(const std::string& key) {
const std::list<int>& get_factors_to_node(const std::string& key) const {
return node_to_factors_[key];
}

View File

@ -105,10 +105,10 @@ public:
std::size_t size() const { return As.size();}
/** STL like, return the iterator pointing to the first node */
const_iterator const begin() { return As.begin();}
const_iterator const begin() const { return As.begin();}
/** STL like, return the iterator pointing to the last node */
const_iterator const end() { return As.end(); }
const_iterator const end() const { return As.end(); }
/** check if empty */
bool empty() const { return b.size() == 0;}
@ -142,7 +142,7 @@ public:
* return the number of rows from the b vector
* @return a integer with the number of rows from the b vector
*/
int numberOfRows() { return b.size();}
int numberOfRows() const { return b.size();}
/**
* Find all variables and their dimensions

View File

@ -86,7 +86,7 @@ Matrix diag(const Vector& v) {
/* ************************************************************************* */
/** Check if two matrizes are the same */
/* ************************************************************************* */
bool equal_with_abs_tol(const Matrix& A, const Matrix& B, double tol){
bool equal_with_abs_tol(const Matrix& A, const Matrix& B, double tol) {
size_t n1 = A.size2(), m1 = A.size1();
size_t n2 = B.size2(), m2 = B.size1();

View File

@ -76,7 +76,7 @@ bool assert_equal(const Matrix& A, const Matrix& B, double tol = 1e-9);
/**
* overload * for matrix-vector multiplication (as BOOST does not)
*/
inline Vector operator*(const Matrix& A, const Vector & v) {
inline Vector operator*(const Matrix& A, const Vector & v) {
if (A.size2()!=v.size()) throw(std::invalid_argument("Matrix operator* : A.n!=v.size"));
return Vector(prod(A,v));
}

View File

@ -111,7 +111,7 @@ namespace gtsam {
/** Check if two factors are equal */
bool equals(const Factor& f, double tol=1e-9) const;
std::string dump() {return "";}
std::string dump() const {return "";}
};
/* ************************************************************************* */

View File

@ -118,7 +118,7 @@ bool NonlinearFactorGraph::check_convergence(const FGConfig& config1,
const FGConfig& config2,
double relativeErrorTreshold,
double absoluteErrorTreshold,
int verbosity)
int verbosity) const
{
double currentError = calculate_error(*this, config1, verbosity);
double newError = calculate_error(*this, config2, verbosity);
@ -211,7 +211,7 @@ pair<LinearFactorGraph, FGConfig> NonlinearFactorGraph::OneIterationLM( FGConfig
double absoluteErrorTreshold,
int verbosity,
double lambda0,
double lambdaFactor) {
double lambdaFactor) const {
double lambda = lambda0;
bool converged = false;

View File

@ -71,7 +71,7 @@ public: // these you will probably want to use
bool check_convergence(const FGConfig& config1,
const FGConfig& config2,
double relativeErrorTreshold, double absoluteErrorTreshold,
int verbosity = 0);
int verbosity = 0) const;
/**
* Optimize using Levenberg-Marquardt. Really Levenberg's
@ -105,7 +105,7 @@ public: // these you will probably want to use
double absoluteErrorTreshold,
int verbosity,
double lambda0,
double lambdaFactor) ;
double lambdaFactor) const ;
};
}

View File

@ -45,7 +45,7 @@ namespace gtsam {
}
/** operators */
inline bool operator ==(const Point2& q) {return x_==q.x_ && q.y_==q.y_;}
inline bool operator ==(const Point2& q) const {return x_==q.x_ && q.y_==q.y_;}
inline Point2 operator + (const Point2& q) const {return Point2(x_+q.x_,y_+q.y_);}
inline Point2 operator - (const Point2& q) const {return Point2(x_-q.x_,y_-q.y_);}