mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-14 00:38:10 +08:00
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:
parent
7a43a4408b
commit
8a3f552e39
@ -135,6 +135,8 @@ template<typename _MatrixType> class ComplexEigenSolver
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Returns the eigenvectors of given matrix.
|
/** \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
|
* It is assumed that either the constructor
|
||||||
* ComplexEigenSolver(const MatrixType& matrix) or the member
|
* ComplexEigenSolver(const MatrixType& matrix) or the member
|
||||||
@ -151,13 +153,15 @@ template<typename _MatrixType> class ComplexEigenSolver
|
|||||||
* Example: \include ComplexEigenSolver_eigenvectors.cpp
|
* Example: \include ComplexEigenSolver_eigenvectors.cpp
|
||||||
* Output: \verbinclude ComplexEigenSolver_eigenvectors.out
|
* Output: \verbinclude ComplexEigenSolver_eigenvectors.out
|
||||||
*/
|
*/
|
||||||
EigenvectorType eigenvectors() const
|
const EigenvectorType& eigenvectors() const
|
||||||
{
|
{
|
||||||
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
|
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
|
||||||
return m_eivec;
|
return m_eivec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Returns the eigenvalues of given matrix.
|
/** \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
|
* It is assumed that either the constructor
|
||||||
* ComplexEigenSolver(const MatrixType& matrix) or the member
|
* ComplexEigenSolver(const MatrixType& matrix) or the member
|
||||||
@ -171,7 +175,7 @@ template<typename _MatrixType> class ComplexEigenSolver
|
|||||||
* Example: \include ComplexEigenSolver_eigenvalues.cpp
|
* Example: \include ComplexEigenSolver_eigenvalues.cpp
|
||||||
* Output: \verbinclude ComplexEigenSolver_eigenvalues.out
|
* Output: \verbinclude ComplexEigenSolver_eigenvalues.out
|
||||||
*/
|
*/
|
||||||
EigenvalueType eigenvalues() const
|
const EigenvalueType& eigenvalues() const
|
||||||
{
|
{
|
||||||
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
|
ei_assert(m_isInitialized && "ComplexEigenSolver is not initialized.");
|
||||||
return m_eivalues;
|
return m_eivalues;
|
||||||
|
@ -223,7 +223,7 @@ template<typename _MatrixType> class EigenSolver
|
|||||||
|
|
||||||
/** \brief Returns the eigenvalues of given matrix.
|
/** \brief Returns the eigenvalues of given matrix.
|
||||||
*
|
*
|
||||||
* \returns Column vector containing the eigenvalues.
|
* \returns A const reference to the column vector containing the eigenvalues.
|
||||||
*
|
*
|
||||||
* \pre Either the constructor EigenSolver(const MatrixType&) or the
|
* \pre Either the constructor EigenSolver(const MatrixType&) or the
|
||||||
* member function compute(const MatrixType&) has been called before.
|
* member function compute(const MatrixType&) has been called before.
|
||||||
@ -237,7 +237,7 @@ template<typename _MatrixType> class EigenSolver
|
|||||||
* \sa eigenvectors(), pseudoEigenvalueMatrix(),
|
* \sa eigenvectors(), pseudoEigenvalueMatrix(),
|
||||||
* MatrixBase::eigenvalues()
|
* MatrixBase::eigenvalues()
|
||||||
*/
|
*/
|
||||||
EigenvalueType eigenvalues() const
|
const EigenvalueType& eigenvalues() const
|
||||||
{
|
{
|
||||||
ei_assert(m_isInitialized && "EigenSolver is not initialized.");
|
ei_assert(m_isInitialized && "EigenSolver is not initialized.");
|
||||||
return m_eivalues;
|
return m_eivalues;
|
||||||
|
@ -264,7 +264,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
|
|
||||||
/** \brief Returns the eigenvectors of given matrix (pencil).
|
/** \brief Returns the eigenvectors of given matrix (pencil).
|
||||||
*
|
*
|
||||||
* \returns %Matrix whose columns are the eigenvectors.
|
* \returns A const reference to the matrix whose columns are the eigenvectors.
|
||||||
*
|
*
|
||||||
* \pre The eigenvectors have been computed before.
|
* \pre The eigenvectors have been computed before.
|
||||||
*
|
*
|
||||||
@ -280,7 +280,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
*
|
*
|
||||||
* \sa eigenvalues()
|
* \sa eigenvalues()
|
||||||
*/
|
*/
|
||||||
MatrixType eigenvectors() const
|
const MatrixType& eigenvectors() const
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
ei_assert(m_eigenvectorsOk);
|
ei_assert(m_eigenvectorsOk);
|
||||||
@ -290,7 +290,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
|
|
||||||
/** \brief Returns the eigenvalues of given matrix (pencil).
|
/** \brief Returns the eigenvalues of given matrix (pencil).
|
||||||
*
|
*
|
||||||
* \returns Column vector containing the eigenvalues.
|
* \returns A const reference to the column vector containing the eigenvalues.
|
||||||
*
|
*
|
||||||
* \pre The eigenvalues have been computed before.
|
* \pre The eigenvalues have been computed before.
|
||||||
*
|
*
|
||||||
@ -302,7 +302,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
*
|
*
|
||||||
* \sa eigenvectors(), MatrixBase::eigenvalues()
|
* \sa eigenvectors(), MatrixBase::eigenvalues()
|
||||||
*/
|
*/
|
||||||
RealVectorType eigenvalues() const { return m_eivalues; }
|
const RealVectorType& eigenvalues() const { return m_eivalues; }
|
||||||
|
|
||||||
/** \brief Computes the positive-definite square root of the matrix.
|
/** \brief Computes the positive-definite square root of the matrix.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user