Merge pull request #1367 from borglab/fix/analyze_issues

Fixed a few small issues...
release/4.3a0
Frank Dellaert 2023-01-03 19:52:44 -05:00 committed by GitHub
commit f749528fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 12 deletions

View File

@ -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; size_t dim = 0;
for(Vector v: vs) for (const Vector& v : vs) dim += v.size();
dim += v.size();
Vector A(dim); Vector A(dim);
size_t index = 0; size_t index = 0;
for(Vector v: vs) { for (const Vector& v : vs) {
for(int d = 0; d < v.size(); d++) for (int d = 0; d < v.size(); d++) A(d + index) = v(d);
A(d+index) = v(d);
index += v.size(); index += v.size();
} }

View File

@ -47,8 +47,9 @@ void updateAb(MATRIX& Ab, int j, const Vector& a, const Vector& rd) {
/* ************************************************************************* */ /* ************************************************************************* */
// check *above the diagonal* for non-zero entries // 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(); size_t m = M.rows(), n = M.cols();
assert(m > 0);
// check all non-diagonal entries // check all non-diagonal entries
bool full = false; bool full = false;
size_t i, j; size_t i, j;
@ -92,7 +93,7 @@ Gaussian::shared_ptr Gaussian::SqrtInformation(const Matrix& R, bool smart) {
return Diagonal::Sigmas(diagonal->array().inverse(), true); return Diagonal::Sigmas(diagonal->array().inverse(), true);
} }
// NOTE(frank): only reaches here if !(smart && diagonal) // NOTE(frank): only reaches here if !(smart && diagonal)
return shared_ptr(new Gaussian(R.rows(), R)); return boost::make_shared<Gaussian>(R.rows(), R);
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -108,7 +109,7 @@ Gaussian::shared_ptr Gaussian::Information(const Matrix& information, bool smart
else { else {
Eigen::LLT<Matrix> llt(information); Eigen::LLT<Matrix> llt(information);
Matrix R = llt.matrixU(); Matrix R = llt.matrixU();
return shared_ptr(new Gaussian(n, R)); return boost::make_shared<Gaussian>(n, R);
} }
} }

View File

@ -732,7 +732,7 @@ namespace gtsam {
}; };
// Helper function // Helper function
GTSAM_EXPORT boost::optional<Vector> checkIfDiagonal(const Matrix M); GTSAM_EXPORT boost::optional<Vector> checkIfDiagonal(const Matrix& M);
} // namespace noiseModel } // namespace noiseModel

View File

@ -245,7 +245,7 @@ bool ISAM2Clique::optimizeWildfireNode(const KeySet& replaced, double threshold,
// Back-substitute // Back-substitute
fastBackSubstitute(delta); fastBackSubstitute(delta);
count += conditional_->nrFrontals(); *count += conditional_->nrFrontals();
if (valuesChanged(replaced, originalValues, *delta, threshold)) { if (valuesChanged(replaced, originalValues, *delta, threshold)) {
markFrontalsAsChanged(changed); markFrontalsAsChanged(changed);