![]() |
cuLite v0.3.1
A lite CUDA C++ Interface
|
Singular Value Decomposition (SVD) solver using cuSOLVER. More...
Public Member Functions | |
| DefaultSVD (CuSolverHandler &cusolver=globalCuSolverHandler()) | |
| Default constructor. | |
| DefaultSVD (svdPolicy_t leftPolicy, svdPolicy_t rightPolicy, CuSolverHandler &cusolver=globalCuSolverHandler()) | |
| Constructor with specified policies. | |
| ~DefaultSVD () | |
| Destructor. | |
| void | reserve (const T_Matrix &mat) |
| Reserves workspace memory for SVD decomposition. | |
| void | clear () |
| Clears all internal data and releases allocated memory. | |
| svdPolicy_t | getLeftPolicy () const |
| Gets the current policy for computing left singular vectors. | |
| svdPolicy_t | getRightPolicy () const |
| Gets the current policy for computing right singular vectors. | |
| void | setLeftPolicy (svdPolicy_t policy) |
| Sets the policy for computing left singular vectors. | |
| void | setRightPolicy (svdPolicy_t policy) |
| Sets the policy for computing right singular vectors. | |
| void | decompose (const T_Matrix &mat) |
| Performs singular value decomposition on the input matrix. | |
| const T_RVector & | singularValues () const |
| Gets the computed singular values. | |
| const T_Matrix & | leftSingularVectors () const |
| Gets the computed left singular vectors. | |
| const T_Matrix & | rightSingularVectors () const |
| Gets the computed right singular vectors. | |
Singular Value Decomposition (SVD) solver using cuSOLVER.
This class provides a high-level interface for computing the singular value decomposition of general matrices using the cuSOLVER library.
For a given \( m \times n \) matrix A, the SVD computes the factorization:
\[ A = U \Sigma V^* \]
where:
The computation of singular vectors can be controlled independently via policy settings (Full, Economy, or None) to optimize performance and memory usage.
| T_Matrix | The matrix type (must be a dense GPU matrix type). |
| culite::DefaultSVD< T_Matrix >::DefaultSVD | ( | CuSolverHandler & | cusolver = globalCuSolverHandler() | ) |
Default constructor.
Initializes the SVD solver with default settings. Both leftPolicy and rightPolicy are initialized to Economy.
| [in] | cusolver | Reference to a cuSOLVER handler instance (defaults to global handler). |
| culite::DefaultSVD< T_Matrix >::DefaultSVD | ( | svdPolicy_t | leftPolicy, |
| svdPolicy_t | rightPolicy, | ||
| CuSolverHandler & | cusolver = globalCuSolverHandler() ) |
Constructor with specified policies.
Initializes the SVD solver with the specified cuSOLVER handler and singular vector computation policies.
| [in] | leftPolicy | Policy for computing left singular vectors U (Economy, Full, or None). |
| [in] | rightPolicy | Policy for computing right singular vectors V (Economy, Full, or None). |
| [in] | cusolver | Reference to a cuSOLVER handler instance (defaults to global handler). |
| culite::DefaultSVD< T_Matrix >::~DefaultSVD | ( | ) |
Destructor.
Releases all allocated resources and clears internal state.
| void culite::DefaultSVD< T_Matrix >::reserve | ( | const T_Matrix & | mat | ) |
Reserves workspace memory for SVD decomposition.
Allocates internal buffers required for SVD computation based on the dimensions of the input matrix and current policies. Must be called before decompose.
| [in] | mat | The matrix for which to reserve workspace (determines dimensions). |
| void culite::DefaultSVD< 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.
|
inline |
Gets the current policy for computing left singular vectors.
|
inline |
Gets the current policy for computing right singular vectors.
|
inline |
Sets the policy for computing left singular vectors.
Changing the policy requires calling reserve again before the next decomposition.
| [in] | policy | The desired left singular vector computation policy. |
|
inline |
Sets the policy for computing right singular vectors.
Changing the policy requires calling reserve again before the next decomposition.
| [in] | policy | The desired right singular vector computation policy. |
| void culite::DefaultSVD< T_Matrix >::decompose | ( | const T_Matrix & | mat | ) |
Performs singular value decomposition on the input matrix.
Computes the singular values and optionally the left and/or right singular vectors of the input matrix using cuSOLVER's SVD routine.
The input matrix is not modified. Results can be retrieved using the accessor methods: singularValues, leftSingularVectors, rightSingularVectors.
| [in] | mat | The matrix to decompose. |
|
inline |
Gets the computed singular values.
|
inline |
Gets the computed left singular vectors.
|
inline |
Gets the computed right singular vectors.