fix for cityslam
parent
47b11749fe
commit
de90c84d91
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <gtsam/linear/GaussianFactorGraph.h>
|
||||
#include <gtsam/linear/GaussianBayesNet.h>
|
||||
#include <gtsam/inference/Ordering.h>
|
||||
#include <gtsam/nonlinear/Ordering.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
|
@ -56,7 +56,11 @@ namespace gtsam {
|
|||
VectorValues x(const VectorValues& y) const;
|
||||
|
||||
/* A zero VectorValues with the structure of xbar */
|
||||
VectorValues zero() const { return VectorValues::zero(*xbar_);}
|
||||
VectorValues zero() const {
|
||||
VectorValues V(*xbar_) ;
|
||||
V.makeZero();
|
||||
return V ;
|
||||
}
|
||||
|
||||
/* error, given y */
|
||||
double error(const VectorValues& y) const;
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
* slow reallocation of space at runtime.
|
||||
*/
|
||||
VectorValues() : varStarts_(1,0) {}
|
||||
VectorValues(const VectorValues &V) : values_(V.values_), varStarts_(V.varStarts_) {}
|
||||
|
||||
/** Construct from a container of variable dimensions (in variable order). */
|
||||
template<class Container>
|
||||
|
@ -76,6 +77,10 @@ public:
|
|||
*/
|
||||
size_t dim() const { return varStarts_.back(); }
|
||||
|
||||
/* dot product */
|
||||
double dot(const VectorValues& V) const { return gtsam::dot(this->values_, V.values_) ; }
|
||||
|
||||
|
||||
/** Total dimensions capacity allocated */
|
||||
size_t dimCapacity() const { return values_.size(); }
|
||||
|
||||
|
@ -163,6 +168,13 @@ public:
|
|||
|
||||
protected:
|
||||
void checkVariable(Index variable) const { assert(variable < varStarts_.size()-1); }
|
||||
|
||||
|
||||
public:
|
||||
friend double dot(const VectorValues& V1, const VectorValues& V2) { return gtsam::dot(V1.values_, V2.values_) ; }
|
||||
friend void scal(double alpha, VectorValues& x) { gtsam::scal(alpha, x.values_) ; }
|
||||
friend void axpy(double alpha, const VectorValues& x, VectorValues& y) { gtsam::axpy(alpha, x.values_, y.values_) ; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace gtsam {
|
|||
k = 0;
|
||||
verbose = verb;
|
||||
steepest = steep;
|
||||
maxIterations = (maxIt > 0) ? maxIt : dim(x) * (steepest ? 10 : 1);
|
||||
reset = (size_t) (sqrt(dim(x)) + 0.5); // when to reset
|
||||
maxIterations = (maxIt > 0) ? maxIt : x.dim() * (steepest ? 10 : 1);
|
||||
reset = (size_t) (sqrt(x.dim()) + 0.5); // when to reset
|
||||
|
||||
// Start with g0 = A'*(A*x0-b), d0 = - g0
|
||||
// i.e., first step is in direction of negative gradient
|
||||
|
|
Loading…
Reference in New Issue