From fc202bab398ed9b78ef8452f8e4ef35e233965f6 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 13 Feb 2015 18:57:41 +0100 Subject: Index refactoring: StorageIndex must be used for storage only (and locally when it make sense). In all other cases use the global Index type. --- Eigen/src/SparseQR/SparseQR.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'Eigen/src/SparseQR') diff --git a/Eigen/src/SparseQR/SparseQR.h b/Eigen/src/SparseQR/SparseQR.h index 58bfc1cb4..920b884e5 100644 --- a/Eigen/src/SparseQR/SparseQR.h +++ b/Eigen/src/SparseQR/SparseQR.h @@ -109,11 +109,11 @@ class SparseQR : public SparseSolverBase > /** \returns the number of rows of the represented matrix. */ - inline StorageIndex rows() const { return m_pmat.rows(); } + inline Index rows() const { return m_pmat.rows(); } /** \returns the number of columns of the represented matrix. */ - inline StorageIndex cols() const { return m_pmat.cols();} + inline Index cols() const { return m_pmat.cols();} /** \returns a const reference to the \b sparse upper triangular matrix R of the QR factorization. */ @@ -123,7 +123,7 @@ class SparseQR : public SparseSolverBase > * * \sa setPivotThreshold() */ - StorageIndex rank() const + Index rank() const { eigen_assert(m_isInitialized && "The factorization should be called first, use compute()"); return m_nonzeropivots; @@ -260,7 +260,7 @@ class SparseQR : public SparseSolverBase > PermutationType m_outputPerm_c; // The final column permutation RealScalar m_threshold; // Threshold to determine null Householder reflections bool m_useDefaultThreshold; // Use default threshold - StorageIndex m_nonzeropivots; // Number of non zero pivots found + Index m_nonzeropivots; // Number of non zero pivots found IndexVector m_etree; // Column elimination tree IndexVector m_firstRowElt; // First element in each row bool m_isQSorted; // whether Q is sorted or not @@ -289,9 +289,9 @@ void SparseQR::analyzePattern(const MatrixType& mat) // Compute the column fill reducing ordering OrderingType ord; ord(matCpy, m_perm_c); - StorageIndex n = mat.cols(); - StorageIndex m = mat.rows(); - StorageIndex diagSize = (std::min)(m,n); + Index n = mat.cols(); + Index m = mat.rows(); + Index diagSize = (std::min)(m,n); if (!m_perm_c.size()) { @@ -327,9 +327,9 @@ void SparseQR::factorize(const MatrixType& mat) using std::abs; eigen_assert(m_analysisIsok && "analyzePattern() should be called before this step"); - Index m = mat.rows(); - Index n = mat.cols(); - Index diagSize = (std::min)(m,n); + StorageIndex m = mat.rows(); + StorageIndex n = mat.cols(); + StorageIndex diagSize = (std::min)(m,n); IndexVector mark((std::max)(m,n)); mark.setConstant(-1); // Record the visited nodes IndexVector Ridx(n), Qidx(m); // Store temporarily the row indexes for the current column of R and Q Index nzcolR, nzcolQ; // Number of nonzero for the current column of R and Q @@ -578,7 +578,6 @@ struct SparseQR_QProduct : ReturnByValue struct SparseQRMatrixQReturnType : public EigenBase > { - typedef typename SparseQRType::StorageIndex StorageIndex; typedef typename SparseQRType::Scalar Scalar; typedef Matrix DenseMatrix; explicit SparseQRMatrixQReturnType(const SparseQRType& qr) : m_qr(qr) {} @@ -647,8 +645,8 @@ struct SparseQRMatrixQReturnType : public EigenBase(m_qr); } - inline StorageIndex rows() const { return m_qr.rows(); } - inline StorageIndex cols() const { return (std::min)(m_qr.rows(),m_qr.cols()); } + inline Index rows() const { return m_qr.rows(); } + inline Index cols() const { return (std::min)(m_qr.rows(),m_qr.cols()); } // To use for operations with the transpose of Q SparseQRMatrixQTransposeReturnType transpose() const { -- cgit v1.2.3