diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-05-24 17:43:06 +0100 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-05-24 17:43:06 +0100 |
commit | 7a43a4408bd3a04616bb91f9d039bdaf0ff976dd (patch) | |
tree | 7f773e0af3c9d70ee091348982ff85856b7b8391 /Eigen/src/Eigenvalues/Tridiagonalization.h | |
parent | 68820fd4e8a8206d7bd1e80a773877322f7fe3ce (diff) |
Replace local variables by member variables in compute() methods.
This is to avoid dynamic memory allocations in the compute() methods of
ComplexEigenSolver, EigenSolver, and SelfAdjointEigenSolver where possible.
As a result, Tridiagonalization::decomposeInPlace() is no longer used.
Biggest remaining issue is the allocation in HouseholderSequence::evalTo().
Diffstat (limited to 'Eigen/src/Eigenvalues/Tridiagonalization.h')
-rw-r--r-- | Eigen/src/Eigenvalues/Tridiagonalization.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Eigen/src/Eigenvalues/Tridiagonalization.h b/Eigen/src/Eigenvalues/Tridiagonalization.h index 43509863a..6ea852a6b 100644 --- a/Eigen/src/Eigenvalues/Tridiagonalization.h +++ b/Eigen/src/Eigenvalues/Tridiagonalization.h @@ -70,10 +70,10 @@ template<typename _MatrixType> class Tridiagonalization enum { Size = MatrixType::RowsAtCompileTime, - SizeMinusOne = Size == Dynamic ? Dynamic : Size - 1, + SizeMinusOne = Size == Dynamic ? Dynamic : (Size > 1 ? Size - 1 : 1), Options = MatrixType::Options, MaxSize = MatrixType::MaxRowsAtCompileTime, - MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : MaxSize - 1 + MaxSizeMinusOne = MaxSize == Dynamic ? Dynamic : (MaxSize > 1 ? MaxSize - 1 : 1) }; typedef Matrix<Scalar, SizeMinusOne, 1, Options & ~RowMajor, MaxSizeMinusOne, 1> CoeffVectorType; @@ -108,7 +108,7 @@ template<typename _MatrixType> class Tridiagonalization * \sa compute() for an example. */ Tridiagonalization(int size = Size==Dynamic ? 2 : Size) - : m_matrix(size,size), m_hCoeffs(size-1) + : m_matrix(size,size), m_hCoeffs(size > 1 ? size-1 : 1) {} /** \brief Constructor; computes tridiagonal decomposition of given matrix. @@ -122,7 +122,7 @@ template<typename _MatrixType> class Tridiagonalization * Output: \verbinclude Tridiagonalization_Tridiagonalization_MatrixType.out */ Tridiagonalization(const MatrixType& matrix) - : m_matrix(matrix), m_hCoeffs(matrix.cols()-1) + : m_matrix(matrix), m_hCoeffs(matrix.cols() > 1 ? matrix.cols()-1 : 1) { _compute(m_matrix, m_hCoeffs); } |