Return matrices by constant reference where possible.

This changes the return type of:
* eigenvectors() and eigenvalues() in ComplexEigenSolver
* eigenvalues() in EigenSolver
* eigenvectors() and eigenvalues() in SelfAdjointEigenSolver
This commit is contained in:
Jitse Niesen
2010-05-24 17:43:27 +01:00
parent 7a43a4408b
commit 8a3f552e39
3 changed files with 12 additions and 8 deletions

View File

@@ -135,6 +135,8 @@ template<typename _MatrixType> class ComplexEigenSolver
}
/** \brief Returns the eigenvectors of given matrix.
*
* \returns A const reference to the matrix whose columns are the eigenvectors.
*
* It is assumed that either the constructor
* ComplexEigenSolver(const MatrixType& matrix) or the member
@@ -151,13 +153,15 @@ template<typename _MatrixType> class ComplexEigenSolver
* Example: \include ComplexEigenSolver_eigenvectors.cpp
* Output: \verbinclude ComplexEigenSolver_eigenvectors.out
*/
EigenvectorType eigenvectors() const
const EigenvectorType& eigenvectors() const
{
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_eivec;
}
/** \brief Returns the eigenvalues of given matrix.
*
* \returns A const reference to the column vector containing the eigenvalues.
*
* It is assumed that either the constructor
* ComplexEigenSolver(const MatrixType& matrix) or the member
@@ -171,7 +175,7 @@ template<typename _MatrixType> class ComplexEigenSolver
* Example: \include ComplexEigenSolver_eigenvalues.cpp
* Output: \verbinclude ComplexEigenSolver_eigenvalues.out
*/
EigenvalueType eigenvalues() const
const EigenvalueType& eigenvalues() const
{
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
return m_eivalues;