cuLite v0.3.1
A lite CUDA C++ Interface
Loading...
Searching...
No Matches
culite::LapackGeev< T_Matrix > Class Template Reference

Eigenvalue decomposition solver using LAPACK/cuSOLVER GEEV routines. More...

Public Member Functions

 LapackGeev (CuSolverHandler &cusolver=globalCuSolverHandler())
 Default constructor.
 LapackGeev (bool calcLeft, bool calcRight, CuSolverHandler &cusolver=globalCuSolverHandler())
 Constructor.
 ~LapackGeev ()
 Destructor.
bool getCalcLeft () const
 Checks if left eigenvectors will be computed.
bool getCalcRight () const
 Checks if right eigenvectors will be computed.
void setCalcLeft (bool calcLeft)
 Sets whether to compute left eigenvectors.
void setCalcRight (bool calcRight)
 Sets whether to compute right eigenvectors.
void reserve (const T_Matrix &mat)
 Reserves workspace memory for eigenvalue decomposition.
void clear ()
 Clears all internal data and releases allocated memory.
void decompose (const T_Matrix &mat)
 Performs eigenvalue decomposition on the input matrix.
const T_CVector & eigenvalues () const
 Gets the computed eigenvalues.
const T_CMatrix & leftEigenvectors () const
 Gets the computed left eigenvectors.
const T_CMatrix & rightEigenvectors () const
 Gets the computed right eigenvectors.

Detailed Description

template<typename T_Matrix>
class culite::LapackGeev< T_Matrix >

Eigenvalue decomposition solver using LAPACK/cuSOLVER GEEV routines.

This class provides a high-level interface for computing eigenvalues and eigenvectors of general (non-symmetric) matrices using the cuSOLVER library's GEEV implementation.

The GEEV routine computes the eigenvalue decomposition of a general matrix A:

  • Right eigenvectors: \( A v_i = \lambda_i v_i \)
  • Left eigenvectors: \( w_i^H A = \lambda_i w_i^H \)

Results are always returned as complex matrices/vectors, even for real input matrices.

Template Parameters
T_MatrixThe matrix type (can be real or complex).

Usage Example

culite::dns::RdMatrix A = ...; // Input matrix
LapackGeev<culite::dns::RdMatrix> geev;
geev.reserve(A); // Optional
geev.decompose(A);
void reserve(const T_Matrix &mat)
Reserves workspace memory for eigenvalue decomposition.
const T_CVector & eigenvalues() const
Gets the computed eigenvalues.
Definition lapack_geev.hpp:157
void decompose(const T_Matrix &mat)
Performs eigenvalue decomposition on the input matrix.
const T_CMatrix & rightEigenvectors() const
Gets the computed right eigenvectors.
Definition lapack_geev.hpp:173
CxMatrix< complex_t > CdMatrix
Double precision complex matrix.
Definition dense.hpp:67
XxMatrix< real_t > RdMatrix
Double precision real matrix.
Definition dense.hpp:55
CxVector< complex_t > CdVector
Double precision complex device vector.
Definition dense.hpp:43
Examples
ex07a_eigenproblem_geev.cpp.

Constructor & Destructor Documentation

◆ LapackGeev() [1/2]

template<typename T_Matrix>
culite::LapackGeev< T_Matrix >::LapackGeev ( CuSolverHandler & cusolver = globalCuSolverHandler())

Default constructor.

Initializes the eigenvalue solver with default settings. calcLeft is initialized to false and calcRight is initialized to true.

Parameters
[in]cusolverReference to a cuSOLVER handler instance (defaults to global handler).

◆ LapackGeev() [2/2]

template<typename T_Matrix>
culite::LapackGeev< T_Matrix >::LapackGeev ( bool calcLeft,
bool calcRight,
CuSolverHandler & cusolver = globalCuSolverHandler() )

Constructor.

Initializes the eigenvalue solver with the specified cuSOLVER handler and eigenvector computation options.

Parameters
[in]calcLeftIf true, computes left eigenvectors.
[in]calcRightIf true, computes right eigenvectors.
[in]cusolverReference to a cuSOLVER handler instance (defaults to global handler).

◆ ~LapackGeev()

template<typename T_Matrix>
culite::LapackGeev< T_Matrix >::~LapackGeev ( )

Destructor.

Releases all allocated resources and clears internal state.

Member Function Documentation

◆ getCalcLeft()

template<typename T_Matrix>
bool culite::LapackGeev< T_Matrix >::getCalcLeft ( ) const
inline

Checks if left eigenvectors will be computed.

Returns
True if left eigenvectors will be computed, false otherwise.

◆ getCalcRight()

template<typename T_Matrix>
bool culite::LapackGeev< T_Matrix >::getCalcRight ( ) const
inline

Checks if right eigenvectors will be computed.

Returns
True if right eigenvectors will be computed, false otherwise.

◆ setCalcLeft()

template<typename T_Matrix>
void culite::LapackGeev< T_Matrix >::setCalcLeft ( bool calcLeft)
inline

Sets whether to compute left eigenvectors.

Parameters
[in]calcLeftIf true, left eigenvectors will be computed in decompose.
Examples
ex07a_eigenproblem_geev.cpp.

◆ setCalcRight()

template<typename T_Matrix>
void culite::LapackGeev< T_Matrix >::setCalcRight ( bool calcRight)
inline

Sets whether to compute right eigenvectors.

Parameters
[in]calcRightIf true, right eigenvectors will be computed in decompose.
Examples
ex07a_eigenproblem_geev.cpp.

◆ reserve()

template<typename T_Matrix>
void culite::LapackGeev< T_Matrix >::reserve ( const T_Matrix & mat)

Reserves workspace memory for eigenvalue decomposition.

Allocates internal buffers required for eigenvalue computation based on the dimensions of the input matrix. Must be called before decompose.

Parameters
[in]matThe matrix for which to reserve workspace (determines dimensions).

◆ clear()

template<typename T_Matrix>
void culite::LapackGeev< T_Matrix >::clear ( )

Clears all internal data and releases allocated memory.

Resets the solver to its initial state, releasing all computed results and internal workspace buffers.

◆ decompose()

template<typename T_Matrix>
void culite::LapackGeev< T_Matrix >::decompose ( const T_Matrix & mat)

Performs eigenvalue decomposition on the input matrix.

Computes the eigenvalues and optionally the left and/or right eigenvectors of the input matrix using cuSOLVER's GEEV routine.

The input matrix is not modified. Results can be retrieved using the accessor methods: eigenvalues, leftEigenvectors, rightEigenvectors.

Parameters
[in]matThe matrix to decompose.
Precondition
reserve must have been called with a matrix of matching dimensions.
Note
For real input matrices, eigenvalues and eigenvectors are returned as complex.
Examples
ex07a_eigenproblem_geev.cpp.

◆ eigenvalues()

template<typename T_Matrix>
const T_CVector & culite::LapackGeev< T_Matrix >::eigenvalues ( ) const
inline

Gets the computed eigenvalues.

Returns
Const reference to the complex vector containing the eigenvalues.
Note
Only valid after calling decompose.
Examples
ex07a_eigenproblem_geev.cpp.

◆ leftEigenvectors()

template<typename T_Matrix>
const T_CMatrix & culite::LapackGeev< T_Matrix >::leftEigenvectors ( ) const
inline

Gets the computed left eigenvectors.

Returns
Const reference to the complex matrix containing the left eigenvectors.
Note
Only valid after calling decompose with calcLeft=true.
Each column i contains the left eigenvector corresponding to eigenvalue i.

◆ rightEigenvectors()

template<typename T_Matrix>
const T_CMatrix & culite::LapackGeev< T_Matrix >::rightEigenvectors ( ) const
inline

Gets the computed right eigenvectors.

Returns
Const reference to the complex matrix containing the right eigenvectors.
Note
Only valid after calling decompose with calcRight=true.
Each column i contains the right eigenvector corresponding to eigenvalue i.
Examples
ex07a_eigenproblem_geev.cpp.