diff --git a/gtsam/linear/GaussianFactor.h b/gtsam/linear/GaussianFactor.h index 682b758fd..a94e024f5 100644 --- a/gtsam/linear/GaussianFactor.h +++ b/gtsam/linear/GaussianFactor.h @@ -151,10 +151,6 @@ namespace gtsam { ABlock getA(iterator variable) { return Ab_(variable - keys_.begin()); } - // direct indexing - constABlock getA(size_t idx) const { return Ab_(idx); } - ABlock getA(size_t idx) { return Ab_(idx); } - /** Return the dimension of the variable pointed to by the given key iterator * todo: Remove this in favor of keeping track of dimensions with variables? */ @@ -172,6 +168,13 @@ namespace gtsam { */ static shared_ptr Combine(const FactorGraph& factors, const VariableSlots& variableSlots); + /** + * Combine and eliminate several factors. + */ +// static std::pair CombineAndEliminate( +// const FactorGraph& factors, const VariableSlots& variableSlots, +// size_t nrFrontals=1, SolveMethod solveMethod = SOLVE_QR); + protected: /** Internal debug check to make sure variables are sorted */ diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index c9c38dae9..3b360bcea 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -89,7 +89,6 @@ public: /* 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(); } @@ -99,26 +98,11 @@ public: iterator end() { return _impl_iterator(*this, varStarts_.size()-1); } const_iterator end() const { return _impl_iterator(*this, varStarts_.size()-1); } - double *ptr(Index idx = 0) { return values_.data().begin() + varStarts_[idx] ; } - const double *ptr(Index idx = 0) const { return values_.data().begin() + varStarts_[idx] ; } - const Vector& values() const { return values_ ; } - Vector& values() { return values_ ; } + /** Reference the entire solution vector (const version). */ + const Vector& vector() const { return values_; } - /* return the dimension spec of this vector, i.e. the dimension of each variable */ - template - std::vector getDimSpec() const { - const Index n = this->size() ; - std::vector spec(n) ; - for ( Index i = 0 ; i < n ; ++i ) { - spec[i] = varStarts_[i+1] - varStarts_[i] ; - } - return spec; - } - - /* get varStart */ - std::vector getVarStart() const { - return varStarts_ ; - } + /** Reference the entire solution vector. */ + Vector& vector() { return values_; } /** Reserve space for a total number of variables and dimensionality */ void reserve(Index nVars, size_t totalDims) { values_.resize(std::max(totalDims, values_.size())); varStarts_.reserve(nVars+1); } diff --git a/gtsam/linear/tests/testVectorValues.cpp b/gtsam/linear/tests/testVectorValues.cpp index cdc74af61..d8df3721b 100644 --- a/gtsam/linear/tests/testVectorValues.cpp +++ b/gtsam/linear/tests/testVectorValues.cpp @@ -36,9 +36,9 @@ TEST(VectorValues, constructor) { VectorValues actual(dims, v); LONGS_EQUAL(3, actual.size()); - DOUBLES_EQUAL(1., *actual.ptr(0), 1e-15); - DOUBLES_EQUAL(2., *actual.ptr(1), 1e-15); - DOUBLES_EQUAL(4., *actual.ptr(2), 1e-15); + DOUBLES_EQUAL(1., actual[0][0], 1e-15); + DOUBLES_EQUAL(2., actual[1][0], 1e-15); + DOUBLES_EQUAL(4., actual[2][0], 1e-15); } /* ************************************************************************* */