Renamed VectorValues::subvalues() to VectorValues::values(indices) to better fit conventions

release/4.3a0
Alex Cunningham 2012-11-21 19:02:11 +00:00
parent b4460850c6
commit a2e36d66df
4 changed files with 4 additions and 4 deletions

View File

@ -332,7 +332,7 @@ double HessianFactor::error(const VectorValues& c) const {
} else { } else {
// extract the relevant subset of the VectorValues // extract the relevant subset of the VectorValues
// NOTE may not be as efficient // NOTE may not be as efficient
const Vector x = c.subvector(this->keys()); const Vector x = c.vector(this->keys());
xtg = x.dot(linearTerm()); xtg = x.dot(linearTerm());
xGx = x.transpose() * info_.range(0, this->size(), 0, this->size()).selfadjointView<Eigen::Upper>() * x; xGx = x.transpose() * info_.range(0, this->size(), 0, this->size()).selfadjointView<Eigen::Upper>() * x;
} }

View File

@ -203,7 +203,7 @@ void VectorValues::swap(VectorValues& other) {
} }
/* ************************************************************************* */ /* ************************************************************************* */
Vector VectorValues::subvector(const std::vector<Index>& indices) const { Vector VectorValues::vector(const std::vector<Index>& indices) const {
if (indices.empty()) if (indices.empty())
return Vector(); return Vector();

View File

@ -257,7 +257,7 @@ namespace gtsam {
Vector& vector() { chk(); return values_; } Vector& vector() { chk(); return values_; }
/** Access a vector that is a subset of relevant indices */ /** Access a vector that is a subset of relevant indices */
Vector subvector(const std::vector<Index>& indices) const; Vector vector(const std::vector<Index>& indices) const;
/** Check whether this VectorValues has the same structure, meaning has the /** Check whether this VectorValues has the same structure, meaning has the
* same number of variables and that all variables are of the same dimension, * same number of variables and that all variables are of the same dimension,

View File

@ -459,7 +459,7 @@ TEST(VectorValues, subvector) {
std::vector<gtsam::Index> indices; std::vector<gtsam::Index> indices;
indices += 0, 2, 3; indices += 0, 2, 3;
Vector expSubVector = Vector_(5, 1.0, 4.0, 5.0, 6.0, 7.0); Vector expSubVector = Vector_(5, 1.0, 4.0, 5.0, 6.0, 7.0);
EXPECT(assert_equal(expSubVector, init.subvector(indices))); EXPECT(assert_equal(expSubVector, init.vector(indices)));
} }
/* ************************************************************************* */ /* ************************************************************************* */