Fix to const &

release/4.3a0
Frank Dellaert 2022-12-28 16:51:24 -05:00
parent d537867981
commit 356b89a165
2 changed files with 3 additions and 2 deletions

View File

@ -46,7 +46,8 @@ namespace gtsam {
return optimize(solution); return optimize(solution);
} }
VectorValues GaussianBayesNet::optimize(VectorValues solution) const { VectorValues GaussianBayesNet::optimize(const VectorValues& given) const {
VectorValues solution = given;
// (R*x)./sigmas = y by solving x=inv(R)*(y.*sigmas) // (R*x)./sigmas = y by solving x=inv(R)*(y.*sigmas)
// solve each node in reverse topological sort order (parents first) // solve each node in reverse topological sort order (parents first)
for (auto cg : boost::adaptors::reverse(*this)) { for (auto cg : boost::adaptors::reverse(*this)) {

View File

@ -113,7 +113,7 @@ namespace gtsam {
VectorValues optimize() const; VectorValues optimize() const;
/// Version of optimize for incomplete BayesNet, given missing variables /// Version of optimize for incomplete BayesNet, given missing variables
VectorValues optimize(const VectorValues given) const; VectorValues optimize(const VectorValues& given) const;
/** /**
* Sample using ancestral sampling * Sample using ancestral sampling