Renamed VectorValues::subvalues() to VectorValues::values(indices) to better fit conventions
parent
b4460850c6
commit
a2e36d66df
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue