cuLite v0.3.1
A lite CUDA C++ Interface
Loading...
Searching...
No Matches
ex07a_eigenproblem_geev.cpp
#include <iostream>
#include <cla3p/dense.hpp>
#include <culite/dense.hpp>
#include <culite/eigsol.hpp>
int main()
{
/*
* Create a random (5x5) dense matrix on host and transfer to device
*/
HostA >> A;
HostB >> B;
std::cout << "A:\n" << A;
std::cout << "B:\n" << B;
/*
* Create an eigensolver that computes right eigenvectors (default)
*/
/*
* Decompose A
*/
geev.decompose(A);
std::cout << "Eigenvalues (A):\n" << geev.eigenvalues();
std::cout << "Right Eigenvectors (A):\n" << geev.rightEigenvectors();
/*
* Create an eigensolver that computes only eigenvalues (no eigenvectors)
*/
geev.setCalcLeft(false);
geev.setCalcRight(false);
geev.decompose(B);
std::cout << "Eigenvalues only (B):\n" << geev.eigenvalues();
return 0;
}
static XxMatrix< T_Scalar > random(int_t nr, int_t nc, const Property &pr=Property::General(), T_RScalar lo=T_RScalar(0), T_RScalar hi=T_RScalar(1))
Eigenvalue decomposition solver using LAPACK/cuSOLVER GEEV routines.
Definition lapack_geev.hpp:60
void setCalcRight(bool calcRight)
Sets whether to compute right eigenvectors.
Definition lapack_geev.hpp:120
const T_CVector & eigenvalues() const
Gets the computed eigenvalues.
Definition lapack_geev.hpp:157
void setCalcLeft(bool calcLeft)
Sets whether to compute left eigenvectors.
Definition lapack_geev.hpp:114
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
XxMatrix< real_t > RdMatrix
XxMatrix< real_t > RdMatrix
Double precision real matrix.
Definition dense.hpp:55