From 286898a8471584310c81ae020afae1b8c553f6eb Mon Sep 17 00:00:00 2001 From: Gerry Chen Date: Wed, 20 Jan 2021 12:25:20 -0500 Subject: [PATCH] move SparseMatrixBoostTriplets typedef to gfg --- gtsam/base/Matrix.h | 6 ------ gtsam/linear/GaussianFactorGraph.cpp | 11 ++++++----- gtsam/linear/GaussianFactorGraph.h | 3 +++ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index 11058ef40..b4ecf6f6a 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -75,12 +75,6 @@ GTSAM_MAKE_MATRIX_DEFS(9); typedef Eigen::Block SubMatrix; typedef Eigen::Block ConstSubMatrix; -/// Sparse matrix representation as vector of tuples. -/// See SparseMatrix.h for additional representations SparseMatrixEigenTriplets -/// and SparseMatrixEigen -typedef std::vector> - SparseMatrixBoostTriplets; - // Matrix formatting arguments when printing. // Akin to Matlab style. const Eigen::IOFormat& matlabFormat(); diff --git a/gtsam/linear/GaussianFactorGraph.cpp b/gtsam/linear/GaussianFactorGraph.cpp index c4e4ed109..825c6c5d2 100644 --- a/gtsam/linear/GaussianFactorGraph.cpp +++ b/gtsam/linear/GaussianFactorGraph.cpp @@ -99,30 +99,31 @@ namespace gtsam { return result; } + using BoostTriplets = GaussianFactorGraph::SparseMatrixBoostTriplets; /* ************************************************************************* */ - SparseMatrixBoostTriplets GaussianFactorGraph::sparseJacobian( + BoostTriplets GaussianFactorGraph::sparseJacobian( const Ordering& ordering, size_t& nrows, size_t& ncols) const { - SparseMatrixBoostTriplets entries; + BoostTriplets entries; entries.reserve(60 * size()); sparseJacobianInPlace(entries, ordering, nrows, ncols); return entries; } /* ************************************************************************* */ - SparseMatrixBoostTriplets GaussianFactorGraph::sparseJacobian( + BoostTriplets GaussianFactorGraph::sparseJacobian( const Ordering& ordering) const { size_t dummy1, dummy2; return sparseJacobian(ordering, dummy1, dummy2); } /* ************************************************************************* */ - SparseMatrixBoostTriplets GaussianFactorGraph::sparseJacobian( + BoostTriplets GaussianFactorGraph::sparseJacobian( size_t& nrows, size_t& ncols) const { return sparseJacobian(Ordering(this->keys()), nrows, ncols); } /* ************************************************************************* */ - SparseMatrixBoostTriplets GaussianFactorGraph::sparseJacobian() const { + BoostTriplets GaussianFactorGraph::sparseJacobian() const { size_t dummy1, dummy2; return sparseJacobian(dummy1, dummy2); } diff --git a/gtsam/linear/GaussianFactorGraph.h b/gtsam/linear/GaussianFactorGraph.h index 2f21d9619..f2ca3bd60 100644 --- a/gtsam/linear/GaussianFactorGraph.h +++ b/gtsam/linear/GaussianFactorGraph.h @@ -180,6 +180,9 @@ namespace gtsam { ///@name Linear Algebra ///@{ + typedef std::vector> + SparseMatrixBoostTriplets; ///< Sparse matrix representation as vector of tuples. + /** * Populates a container of triplets: (i, j, s) to generate an m-by-n sparse * augmented Jacobian matrix, where i(k) and j(k) are the base 0 row and