Added const verifiers for member functions of the class which are compatible
parent
725f5624c3
commit
0b1b5eca67
|
@ -91,10 +91,10 @@ namespace gtsam {
|
||||||
const Matrix& get_R() const {return R_;}
|
const Matrix& get_R() const {return R_;}
|
||||||
|
|
||||||
/** STL like, return the iterator pointing to the first node */
|
/** 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 */
|
/** 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 */
|
/** find the number of parents */
|
||||||
size_t size() const {return parents_.size();}
|
size_t size() const {return parents_.size();}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace gtsam {
|
||||||
virtual ~FGConfig() {};
|
virtual ~FGConfig() {};
|
||||||
|
|
||||||
/** return all the nodes in the graph **/
|
/** return all the nodes in the graph **/
|
||||||
std::vector<std::string> get_names(){
|
std::vector<std::string> get_names() {
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
for(iterator it=values.begin(); it!=values.end(); it++)
|
for(iterator it=values.begin(); it!=values.end(); it++)
|
||||||
names.push_back(it->first);
|
names.push_back(it->first);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace gtsam {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** get the factors to a specific node */
|
/** 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];
|
return node_to_factors_[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,10 @@ public:
|
||||||
std::size_t size() const { return As.size();}
|
std::size_t size() const { return As.size();}
|
||||||
|
|
||||||
/** STL like, return the iterator pointing to the first node */
|
/** 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 */
|
/** 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 */
|
/** check if empty */
|
||||||
bool empty() const { return b.size() == 0;}
|
bool empty() const { return b.size() == 0;}
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
* return the number of rows from the b vector
|
* return the number of rows from the b vector
|
||||||
* @return a integer with 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
|
* Find all variables and their dimensions
|
||||||
|
|
|
@ -86,7 +86,7 @@ Matrix diag(const Vector& v) {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
/** Check if two matrizes are the same */
|
/** 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 n1 = A.size2(), m1 = A.size1();
|
||||||
size_t n2 = B.size2(), m2 = B.size1();
|
size_t n2 = B.size2(), m2 = B.size1();
|
||||||
|
|
|
@ -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)
|
* 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"));
|
if (A.size2()!=v.size()) throw(std::invalid_argument("Matrix operator* : A.n!=v.size"));
|
||||||
return Vector(prod(A,v));
|
return Vector(prod(A,v));
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace gtsam {
|
||||||
/** Check if two factors are equal */
|
/** Check if two factors are equal */
|
||||||
bool equals(const Factor& f, double tol=1e-9) const;
|
bool equals(const Factor& f, double tol=1e-9) const;
|
||||||
|
|
||||||
std::string dump() {return "";}
|
std::string dump() const {return "";}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -118,7 +118,7 @@ bool NonlinearFactorGraph::check_convergence(const FGConfig& config1,
|
||||||
const FGConfig& config2,
|
const FGConfig& config2,
|
||||||
double relativeErrorTreshold,
|
double relativeErrorTreshold,
|
||||||
double absoluteErrorTreshold,
|
double absoluteErrorTreshold,
|
||||||
int verbosity)
|
int verbosity) const
|
||||||
{
|
{
|
||||||
double currentError = calculate_error(*this, config1, verbosity);
|
double currentError = calculate_error(*this, config1, verbosity);
|
||||||
double newError = calculate_error(*this, config2, verbosity);
|
double newError = calculate_error(*this, config2, verbosity);
|
||||||
|
@ -211,7 +211,7 @@ pair<LinearFactorGraph, FGConfig> NonlinearFactorGraph::OneIterationLM( FGConfig
|
||||||
double absoluteErrorTreshold,
|
double absoluteErrorTreshold,
|
||||||
int verbosity,
|
int verbosity,
|
||||||
double lambda0,
|
double lambda0,
|
||||||
double lambdaFactor) {
|
double lambdaFactor) const {
|
||||||
|
|
||||||
double lambda = lambda0;
|
double lambda = lambda0;
|
||||||
bool converged = false;
|
bool converged = false;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public: // these you will probably want to use
|
||||||
bool check_convergence(const FGConfig& config1,
|
bool check_convergence(const FGConfig& config1,
|
||||||
const FGConfig& config2,
|
const FGConfig& config2,
|
||||||
double relativeErrorTreshold, double absoluteErrorTreshold,
|
double relativeErrorTreshold, double absoluteErrorTreshold,
|
||||||
int verbosity = 0);
|
int verbosity = 0) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optimize using Levenberg-Marquardt. Really Levenberg's
|
* Optimize using Levenberg-Marquardt. Really Levenberg's
|
||||||
|
@ -105,7 +105,7 @@ public: // these you will probably want to use
|
||||||
double absoluteErrorTreshold,
|
double absoluteErrorTreshold,
|
||||||
int verbosity,
|
int verbosity,
|
||||||
double lambda0,
|
double lambda0,
|
||||||
double lambdaFactor) ;
|
double lambdaFactor) const ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ void Ordering::print() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
bool Ordering::equals(Ordering &ord){
|
bool Ordering::equals(Ordering &ord){
|
||||||
if(this->size() != ord.size())
|
if(this->size() != ord.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** operators */
|
/** 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_);}
|
||||||
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_);}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace gtsam {
|
||||||
bool equals(const Point3& p, double tol = 1e-9) const;
|
bool equals(const Point3& p, double tol = 1e-9) const;
|
||||||
|
|
||||||
/** friends */
|
/** friends */
|
||||||
friend Point3 cross(const Point3 &p1, const Point3 &p2);
|
friend Point3 cross(const Point3 &p1, const Point3 &p2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
|
|
Loading…
Reference in New Issue