diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index 7bcd32b9f..7136db768 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -32,6 +32,9 @@ #include #include +#include +#include + using namespace std; namespace gtsam { @@ -697,6 +700,19 @@ std::string formatMatrixIndented(const std::string& label, const Matrix& matrix, return ss.str(); } +void inplace_QR(Matrix& A){ + size_t rows = A.rows(); + size_t cols = A.cols(); + size_t size = std::min(rows,cols); + typedef Eigen::internal::plain_diag_type::type HCoeffsType; + typedef Eigen::internal::plain_row_type::type RowVectorType; + HCoeffsType hCoeffs(size); + RowVectorType temp(cols); + + Eigen::internal::householder_qr_inplace_blocked::run(A, hCoeffs, 48, temp.data()); + + zeroBelowDiagonal(A); +} } // namespace gtsam diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index d5c433d35..ee3c84464 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -25,10 +25,8 @@ #include #include #include - #include #include -#include #include @@ -372,21 +370,8 @@ GTSAM_EXPORT std::pair qr(const Matrix& A); * @param A is the input matrix, and is the output * @param clear_below_diagonal enables zeroing out below diagonal */ -template -void inplace_QR(MATRIX& A) { - size_t rows = A.rows(); - size_t cols = A.cols(); - size_t size = std::min(rows,cols); - - typedef Eigen::internal::plain_diag_type::type HCoeffsType; - typedef Eigen::internal::plain_row_type::type RowVectorType; - HCoeffsType hCoeffs(size); - RowVectorType temp(cols); - - Eigen::internal::householder_qr_inplace_blocked::run(A, hCoeffs, 48, temp.data()); - - zeroBelowDiagonal(A); -} +//template +void inplace_QR(Matrix& A); /** * Imperative algorithm for in-place full elimination with