From a2e36d66df01e502decc7ab5de9739ba0f41cfe7 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Wed, 21 Nov 2012 19:02:11 +0000 Subject: [PATCH] Renamed VectorValues::subvalues() to VectorValues::values(indices) to better fit conventions --- gtsam/linear/HessianFactor.cpp | 2 +- gtsam/linear/VectorValues.cpp | 2 +- gtsam/linear/VectorValues.h | 2 +- gtsam/linear/tests/testVectorValues.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/linear/HessianFactor.cpp b/gtsam/linear/HessianFactor.cpp index dc7beaa2c..528a16b4a 100644 --- a/gtsam/linear/HessianFactor.cpp +++ b/gtsam/linear/HessianFactor.cpp @@ -332,7 +332,7 @@ double HessianFactor::error(const VectorValues& c) const { } else { // extract the relevant subset of the VectorValues // NOTE may not be as efficient - const Vector x = c.subvector(this->keys()); + const Vector x = c.vector(this->keys()); xtg = x.dot(linearTerm()); xGx = x.transpose() * info_.range(0, this->size(), 0, this->size()).selfadjointView() * x; } diff --git a/gtsam/linear/VectorValues.cpp b/gtsam/linear/VectorValues.cpp index bdec5a572..219f2e5f5 100644 --- a/gtsam/linear/VectorValues.cpp +++ b/gtsam/linear/VectorValues.cpp @@ -203,7 +203,7 @@ void VectorValues::swap(VectorValues& other) { } /* ************************************************************************* */ -Vector VectorValues::subvector(const std::vector& indices) const { +Vector VectorValues::vector(const std::vector& indices) const { if (indices.empty()) return Vector(); diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index 0d9473c69..ef112ba2b 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -257,7 +257,7 @@ namespace gtsam { Vector& vector() { chk(); return values_; } /** Access a vector that is a subset of relevant indices */ - Vector subvector(const std::vector& indices) const; + Vector vector(const std::vector& indices) const; /** Check whether this VectorValues has the same structure, meaning has the * same number of variables and that all variables are of the same dimension, diff --git a/gtsam/linear/tests/testVectorValues.cpp b/gtsam/linear/tests/testVectorValues.cpp index c660d4a0d..9507b55b9 100644 --- a/gtsam/linear/tests/testVectorValues.cpp +++ b/gtsam/linear/tests/testVectorValues.cpp @@ -459,7 +459,7 @@ TEST(VectorValues, subvector) { std::vector indices; indices += 0, 2, 3; 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))); } /* ************************************************************************* */