Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a few small issues... #1367

Merged
merged 6 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions gtsam/base/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,14 @@ weightedPseudoinverse(const Vector& a, const Vector& weights) {
}

/* ************************************************************************* */
Vector concatVectors(const std::list<Vector>& vs)
{
Vector concatVectors(const std::list<Vector>& vs) {
size_t dim = 0;
for(Vector v: vs)
dim += v.size();
for (const Vector& v : vs) dim += v.size();

Vector A(dim);
size_t index = 0;
for(Vector v: vs) {
for(int d = 0; d < v.size(); d++)
A(d+index) = v(d);
for (const Vector& v : vs) {
for (int d = 0; d < v.size(); d++) A(d + index) = v(d);
index += v.size();
}

Expand Down
7 changes: 4 additions & 3 deletions gtsam/linear/NoiseModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ void updateAb(MATRIX& Ab, int j, const Vector& a, const Vector& rd) {

/* ************************************************************************* */
// check *above the diagonal* for non-zero entries
boost::optional<Vector> checkIfDiagonal(const Matrix M) {
boost::optional<Vector> checkIfDiagonal(const Matrix& M) {
size_t m = M.rows(), n = M.cols();
assert(m > 0);
// check all non-diagonal entries
bool full = false;
size_t i, j;
Expand Down Expand Up @@ -92,7 +93,7 @@ Gaussian::shared_ptr Gaussian::SqrtInformation(const Matrix& R, bool smart) {
return Diagonal::Sigmas(diagonal->array().inverse(), true);
}
// NOTE(frank): only reaches here if !(smart && diagonal)
return shared_ptr(new Gaussian(R.rows(), R));
return boost::make_shared<Gaussian>(R.rows(), R);
}

/* ************************************************************************* */
Expand All @@ -108,7 +109,7 @@ Gaussian::shared_ptr Gaussian::Information(const Matrix& information, bool smart
else {
Eigen::LLT<Matrix> llt(information);
Matrix R = llt.matrixU();
return shared_ptr(new Gaussian(n, R));
return boost::make_shared<Gaussian>(n, R);
}
}

Expand Down
2 changes: 1 addition & 1 deletion gtsam/linear/NoiseModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ namespace gtsam {
};

// Helper function
GTSAM_EXPORT boost::optional<Vector> checkIfDiagonal(const Matrix M);
GTSAM_EXPORT boost::optional<Vector> checkIfDiagonal(const Matrix& M);

} // namespace noiseModel

Expand Down
2 changes: 1 addition & 1 deletion gtsam/nonlinear/ISAM2Clique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ bool ISAM2Clique::optimizeWildfireNode(const KeySet& replaced, double threshold,

// Back-substitute
fastBackSubstitute(delta);
count += conditional_->nrFrontals();
*count += conditional_->nrFrontals();

if (valuesChanged(replaced, originalValues, *delta, threshold)) {
markFrontalsAsChanged(changed);
Expand Down