1.5.1. Linear Algebra Kernels
1.5.1.1. chase::linalg::internal::cpu
-
namespace cpu
Functions
-
template<typename T>
int cholQR1(std::size_t m, std::size_t n, T *V, int ldv, T *A = nullptr) Performs Cholesky QR factorization (degree 1).
This function performs Cholesky QR factorization on the matrix V. It computes ( A = V^T V ) and then solves ( A X = V ).
- Parameters:
m – The number of rows of matrix V.
n – The number of columns of matrix V.
V – The matrix on which the factorization is performed.
ldv – The leading dimension of V.
A – The output matrix that stores the result of the Cholesky factorization (optional, will be allocated if null).
- Returns:
0 if successful, non-zero value otherwise.
-
template<typename T>
int cholQR2(std::size_t m, std::size_t n, T *V, int ldv, T *A = nullptr) Performs Cholesky QR factorization (degree 2).
This function performs Cholesky QR factorization on the matrix V. It applies two iterations of Cholesky QR factorization.
- Parameters:
m – The number of rows of matrix V.
n – The number of columns of matrix V.
V – The matrix on which the factorization is performed.
ldv – The leading dimension of V.
A – The output matrix that stores the result of the Cholesky factorization (optional, will be allocated if null).
- Returns:
0 if successful, non-zero value otherwise.
-
template<typename T>
int shiftedcholQR2(std::size_t m, std::size_t n, T *V, int ldv, T *A = nullptr) Performs Cholesky QR factorization with shifting (degree 2).
This function performs Cholesky QR factorization on the matrix V, with a shift applied to the matrix diagonal. It applies two iterations of Cholesky QR factorization with a diagonal shift.
- Parameters:
m – The number of rows of matrix V.
n – The number of columns of matrix V.
V – The matrix on which the factorization is performed.
ldv – The leading dimension of V.
A – The output matrix that stores the result of the Cholesky factorization (optional, will be allocated if null).
- Returns:
0 if successful, non-zero value otherwise.
-
template<typename T>
void houseHoulderQR(std::size_t m, std::size_t n, T *V, std::size_t ldv) Performs Householder QR factorization.
This function computes the QR factorization of matrix V using the Householder transformation.
- Parameters:
m – The number of rows of matrix V.
n – The number of columns of matrix V.
V – The matrix on which the factorization is performed.
ldv – The leading dimension of V.
-
template<typename T>
chase::Base<T> computeConditionNumber(std::size_t m, std::size_t n, T *V, std::size_t ldv)
-
template<typename T>
void lanczos(std::size_t M, std::size_t numvec, chase::matrix::Matrix<T> *H, T *V, std::size_t ldv, Base<T> *upperb, Base<T> *ritzv, Base<T> *Tau, Base<T> *ritzV) Lanczos algorithm for eigenvalue computation.
This function performs the Lanczos algorithm, which is used to estimate the upper bound of spectra of symmetric/Hermitian matrix. The algorithm is iteratively applied to the matrix H, where the input matrix
His a square matrix of sizeN x N. The Lanczos algorithm builds an orthonormal basis of the Krylov subspace, and the resulting tridiagonal matrix is diagonalized using thet_stemrfunction.- Template Parameters:
T – The data type for the matrix elements (e.g., float, double).
- Parameters:
M – The number of Lanczos iterations.
numvec – The number of runs of Lanczos.
H – The input matrix for the Lanczos algorithm (of size
N x N).V – The input matrix used for storing vectors (of size
N x numvec).ldv – The leading dimension of
V(number of rows).upperb – A pointer to the upper bound of the eigenvalue spectrum.
ritzv – A pointer to store the Ritz eigenvalues.
Tau – A pointer to store the computed Tau values.
ritzV – A pointer to store the Ritz eigenvectors.
-
template<typename T>
void lanczos(std::size_t M, chase::matrix::Matrix<T> *H, T *V, std::size_t ldv, Base<T> *upperb) Lanczos algorithm for eigenvalue computation (simplified version).
This version of the Lanczos algorithm is a simplified version that computes only the upper bound of the eigenvalue spectrum and does not compute eigenvectors. It operates similarly to the full Lanczos algorithm but omits the eigenvector computation step.
- Template Parameters:
T – The data type for the matrix elements (e.g., float, double).
- Parameters:
M – The number of Lanczos iterations.
H – The input matrix for the Lanczos algorithm (of size
N x N).V – The input matrix used for storing vectors (of size
N x 1).ldv – The leading dimension of
V(number of rows).upperb – A pointer to the upper bound of the eigenvalue spectrum.
-
template<typename T>
void lanczos(std::size_t M, std::size_t numvec, chase::matrix::PseudoHermitianMatrix<T> *H, T *V, std::size_t ldv, Base<T> *upperb, Base<T> *ritzv, Base<T> *Tau, Base<T> *ritzV) Lanczos algorithm for eigenvalue computation of Pseudo-Hermitian matrices.
This function performs the Lanczos algorithm, which is used to estimate the upper bound of spectra of the pseudo-Hermitian matrix H, i.e., where H is pseudo-Hermitian and SH is Hermitian Positive Definite. The algorithm is iteratively applied to the matrix H, where the input matrix
His a square matrix of sizeN x N. The Lanczos algorithm builds an orthonormal basis of the Krylov subspace, and the resulting tridiagonal matrix is diagonalized using thet_stemrfunction. This pseudo-code of this implementation can be found in- Template Parameters:
T – The data type for the matrix elements (e.g., float, double).
- Parameters:
M – The number of Lanczos iterations.
numvec – The number of runs of Lanczos.
N – The size of the input matrix
H.H – The input matrix for the Lanczos algorithm (of size
N x N).ldh – The leading dimension of
H(number of rows).V – The input matrix used for storing vectors (of size
N x numvec).ldv – The leading dimension of
V(number of rows).upperb – A pointer to the upper bound of the eigenvalue spectrum.
ritzv – A pointer to store the Ritz eigenvalues.
Tau – A pointer to store the computed Tau values.
ritzV – A pointer to store the Ritz eigenvectors.
-
template<typename T>
void lanczos(std::size_t M, chase::matrix::PseudoHermitianMatrix<T> *H, T *V, std::size_t ldv, Base<T> *upperb) Lanczos algorithm for eigenvalue computation of pseudo-hermitian matrices (simplified version).
This version of the Lanczos algorithm is a simplified version that computes only the upper bound of the eigenvalue spectrum of pseudo-hermitian matrices and does not computei eigenvectors. It operates similarly to the full Lanczos algorithm but omits the eigenvector computation step.
- Template Parameters:
T – The data type for the matrix elements (e.g., float, double).
- Parameters:
M – The number of Lanczos iterations.
H – The input pseudo-hermitian matrix for the Lanczos algorithm (of size
N x N).V – The input matrix used for storing vectors (of size
N x 1).ldv – The leading dimension of
V(number of rows).upperb – A pointer to the upper bound of the eigenvalue spectrum.
-
template<typename T>
void rayleighRitz(chase::matrix::Matrix<T> *H, std::size_t n, T *Q, std::size_t ldq, T *V, std::size_t ldv, Base<T> *ritzv, T *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The computed Ritz values are stored in the
ritzvarray, and the resulting eigenvectors are stored inV.The procedure performs the following steps:
Computes the matrix-vector multiplication: V = H * Q.
Computes A = V’ * Q, where V’ is the conjugate transpose of V.
Solves the eigenvalue problem for A using LAPACK’s
heevdfunction, computing the Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed ritz vectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
N – [in] The number of rows of the matrix H.
H – [in] The input matrix (N x N).
ldh – [in] The leading dimension of the matrix H.
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
V – [out] The output matrix (N x n), which will store the result of the projection.
ldw – [in] The leading dimension of the matrix V.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
void rayleighRitz(chase::matrix::PseudoHermitianMatrix<T> *H, std::size_t n, T *Q, std::size_t ldq, T *V, std::size_t ldv, Base<T> *ritzv, T *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a Pseudo-Hermitian matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The real parts of the computed Ritz values are stored in the
ritzvarray, and the resulting right eigenvectors are stored inV.The procedure performs the following steps:
Computes the matrix-vector multiplication: V = H’ * Q = S * H * S * Q.
Computes A = V’ * Q, where V’ is the conjugate transpose of V.
Solves the eigenvalue problem for A using LAPACK’s
geevfunction, computing the real part of Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed ritz vectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
H – [in] The Pseudo-Hermitian input matrix (N x N).
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
V – [out] The output matrix (N x n), which will store the result of the projection.
ldv – [in] The leading dimension of the matrix V.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
void rayleighRitz_v2(chase::matrix::PseudoHermitianMatrix<T> *H, std::size_t n, T *Q, std::size_t ldq, T *V, std::size_t ldv, Base<T> *ritzv, T *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a Pseudo-Hermitian matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The real parts of the computed Ritz values are stored in the
ritzvarray, and the resulting right eigenvectors are stored inV.The procedure performs the following steps:
Computes the matrix-vector multiplication: V = H’ * Q = S * H * S * Q.
Computes A = V’ * Q, where V’ is the conjugate transpose of V.
Solves the eigenvalue problem for A using LAPACK’s
geevfunction, computing the real part of Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed ritz vectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
H – [in] The Pseudo-Hermitian input matrix (N x N).
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
V – [out] The output matrix (N x n), which will store the result of the projection.
ldv – [in] The leading dimension of the matrix V.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
void residuals(std::size_t N, T *H, std::size_t ldh, std::size_t eigen_nb, Base<T> *evals, T *evecs, std::size_t ldv, Base<T> *resids, T *V = nullptr) Compute the residuals of eigenvectors for a given matrix and eigenvalues.
This function computes the residuals of the eigenvectors, which measure how well the eigenvectors satisfy the eigenvalue equation ( H \mathbf{v}_i = \lambda_i \mathbf{v}_i ). The residual for each eigenvector ( \mathbf{v}_i ) is defined as ( ||H \mathbf{v}_i - \lambda_i \mathbf{v}_i|| ), where ( \lambda_i ) is the corresponding eigenvalue. The computed residuals are stored in the
residsarray.The function performs the following steps:
Computes the matrix-vector multiplication ( V = H \cdot E ), where E are the eigenvectors.
Subtracts the eigenvalue ( \lambda_i ) times the eigenvector from the result.
Computes the 2-norm of the residual for each eigenvector and stores it in the
residsarray.
- Template Parameters:
T – Data type for the matrix and vectors (e.g., float, double, etc.).
- Parameters:
N – [in] The number of rows and columns of the matrix H.
H – [in] The input matrix (N x N).
ldh – [in] The leading dimension of the matrix H.
eigen_nb – [in] The number of eigenvalues and eigenvectors.
evals – [in] The array of eigenvalues.
evecs – [in] The matrix of eigenvectors (N x eigen_nb), where each column is an eigenvector.
ldv – [in] The leading dimension of the matrix evecs.
resids – [out] The array that will store the computed residuals for each eigenvector.
V – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
bool checkSymmetryEasy(std::size_t N, T *H, std::size_t ldh) Checks if a matrix is symmetric using a randomized approach.
This function checks the symmetry of a square matrix ( H ) by performing two matrix-vector multiplications:
It computes ( u = H \cdot v ), where ( v ) is a random vector.
It computes ( uT = H^T \cdot v ), where ( H^T ) is the transpose of ( H ). The matrix is considered symmetric if the vectors ( u ) and ( uT ) are the same, i.e., ( u = uT ).
This method is computationally efficient and uses random vectors to test symmetry with high probability. However, it is not a guarantee for exact symmetry due to numerical errors, but it can be a quick heuristic check.
- Template Parameters:
T – Data type for the matrix (e.g., float, double).
- Parameters:
N – [in] The size of the matrix (N x N).
H – [in] The matrix to be checked for symmetry (of size N x N).
ldh – [in] The leading dimension of the matrix H.
- Returns:
trueif the matrix is symmetric,falseotherwise.
-
template<typename T>
void symOrHermMatrix(char uplo, std::size_t N, T *H, std::size_t ldh) Converts a matrix to its Hermitian or symmetric form based on the given
uploargument.This function modifies the matrix ( H ) in-place such that it becomes symmetric or Hermitian, depending on the value of the
uploparameter.If
uplois ‘U`, the function converts the upper triangular part of the matrix to the Hermitian form, by setting the lower triangular part to the conjugate transpose of the upper part.If
uplois ‘L`, the function converts the lower triangular part of the matrix to the Hermitian form, by setting the upper triangular part to the conjugate transpose of the lower part.
The function assumes that the matrix is square (N x N) and modifies the elements of the matrix in-place. The conjugation is done using the
conjugatefunction.- Template Parameters:
T – Data type for the matrix (e.g., float, double, std::complex).
- Parameters:
uplo – [in] A character indicating which part of the matrix to modify:
’U
for the upper triangular part. -‘L’` for the lower triangular part.
N – [inout] The size of the matrix (N x N). The matrix is modified in-place.
H – [inout] The matrix to be modified. It is transformed into a symmetric or Hermitian matrix.
ldh – [in] The leading dimension of the matrix H.
-
template<typename T>
void computeDiagonalAbsSum(std::size_t m, std::size_t n, T *A, std::size_t lda, Base<T> *sum) Computes the sum of the absolute values of the diagonal elements of a matrix.
This function computes the sum of the absolute values of the diagonal elements of the given matrix ( A ). It iterates over the diagonal elements (i.e., elements where the row index equals the column index) and adds the absolute value of each diagonal element to the
sum.- Template Parameters:
T – Data type for the matrix elements (e.g., float, double).
- Parameters:
m – [in] The number of rows in the matrix ( A ).
n – [in] The number of columns in the matrix ( A ).
A – [in] The matrix of size ( m \times n ), where the diagonal elements are summed.
lda – [in] The leading dimension of the matrix ( A ), which is the number of elements between the start of one column and the start of the next column.
sum – [out] The resulting sum of the absolute values of the diagonal elements.
-
template<typename T>
void shiftMatrixDiagonal(std::size_t m, std::size_t n, T *A, std::size_t lda, T shift) Shifts the diagonal elements of a matrix by a given value.
This function adds a specified shift value to the diagonal elements of the given matrix ( A ). It modifies the matrix in place by adding the
shiftto each diagonal element (i.e., elements where the row index equals the column index).- Template Parameters:
T – Data type for the matrix elements (e.g., float, double).
- Parameters:
m – [in] The number of rows in the matrix ( A ).
n – [in] The number of columns in the matrix ( A ).
A – [inout] The matrix of size ( m \times n ), whose diagonal elements are shifted.
lda – [in] The leading dimension of the matrix ( A ), which is the number of elements between the start of one column and the start of the next column.
shift – [in] The value to be added to each diagonal element.
-
template<typename T>
void flipLowerHalfMatrixSign(std::size_t m, std::size_t n, T *A, std::size_t lda) Flip the sign of the lower half part of the matrix.
This function toggles the sign of the lower half part of the matrix, i.e., the lower half part is multiplied by -1.0
- Template Parameters:
T – Data type for the matrix elements (e.g., float, double).
- Parameters:
m – [in] The number of rows in the matrix ( A ).
n – [in] The number of columns in the matrix ( A ).
A – [inout] The matrix of size ( m \times n ), whose diagonal elements are shifted.
lda – [in] The leading dimension of the matrix ( A ), which is the number of elements between the start of one column and the start of the next column.
-
template<typename T>
void scaleLowerBlockRows(T *A, std::size_t lda, std::size_t row_start, std::size_t nrows_lower, std::size_t ncols, T scale) Scale \(A[\mathrm{row\_start}+r,\,c] \leftarrow \alpha A[\ldots]\) for \(r \in [0,\mathrm{nrows\_lower})\), \(c \in [0,\mathrm{ncols})\) (column-major, lda).
-
template<typename T>
void flipRightHalfMatrixSign(std::size_t m, std::size_t n, T *A, std::size_t lda) Flip the sign of the right part of the matrix.
This function toggles the sign of the right part of the matrix, i.e., the right part is multiplied by -1.0
- Template Parameters:
T – Data type for the matrix elements (e.g., float, double).
- Parameters:
m – [in] The number of rows in the matrix ( A ).
n – [in] The number of columns in the matrix ( A ).
A – [inout] The matrix of size ( m \times n ), whose diagonal elements are shifted.
lda – [in] The leading dimension of the matrix ( A ), which is the number of elements between the start of one column and the start of the next column.
-
template<typename T>
1.5.1.2. chase::linalg::internal::cuda
-
namespace cuda
Functions
-
template<typename T>
int cholQR1(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, chase::matrix::Matrix<T, chase::platform::GPU> &V, T *workspace = nullptr, int lwork = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr, int *external_devInfo = nullptr)
-
template<typename T>
int cholQR2(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, chase::matrix::Matrix<T, chase::platform::GPU> &V, T *workspace = nullptr, int lwork = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr, int *external_devInfo = nullptr)
-
template<typename T>
void houseHoulderQR(cusolverDnHandle_t cusolver_handle, chase::matrix::Matrix<T, chase::platform::GPU> &V, T *d_tau, int *devInfo, T *workspace = nullptr, int lwork = 0)
-
template<typename T>
int shiftedcholQR2(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, chase::matrix::Matrix<T, chase::platform::GPU> &V, T *workspace = nullptr, int lwork = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr, int *external_devInfo = nullptr)
-
template<typename T>
void lanczos(cublasHandle_t handle, std::size_t M, std::size_t numvec, chase::matrix::Matrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V, chase::Base<T> *upperb, chase::Base<T> *ritzv, chase::Base<T> *Tau, chase::Base<T> *ritzV)
-
template<typename T>
void lanczos(cublasHandle_t handle, std::size_t M, chase::matrix::Matrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V, chase::Base<T> *upperb)
-
template<typename T>
void lanczos(cublasHandle_t handle, std::size_t M, std::size_t numvec, chase::matrix::PseudoHermitianMatrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V, chase::Base<T> *upperb, chase::Base<T> *ritzv, chase::Base<T> *Tau, chase::Base<T> *ritzV)
-
template<typename T>
void lanczos(cublasHandle_t handle, std::size_t M, chase::matrix::PseudoHermitianMatrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V, chase::Base<T> *upperb)
-
template<typename T>
void rayleighRitz(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, chase::matrix::Matrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V1, chase::matrix::Matrix<T, chase::platform::GPU> &V2, chase::matrix::Matrix<chase::Base<T>, chase::platform::GPU> &ritzv, std::size_t offset, std::size_t subSize, int *devInfo, T *workspace = nullptr, int lwork_heevd = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The computed Ritz values are stored in the
ritzvarray, and the resulting eigenvectors are stored inW.The procedure performs the following steps:
Computes the matrix-vector multiplication: W = H * Q.
Computes A = W’ * Q, where W’ is the conjugate transpose of W.
Solves the eigenvalue problem for A using LAPACK’s
heevdfunction, computing the Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed eigenvectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
N – [in] The number of rows of the matrix H.
H – [in] The input matrix (N x N).
ldh – [in] The leading dimension of the matrix H.
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
W – [out] The output matrix (N x n), which will store the result of the projection.
ldw – [in] The leading dimension of the matrix W.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
void rayleighRitz(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, cusolverDnParams_t params, chase::matrix::PseudoHermitianMatrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V1, chase::matrix::Matrix<T, chase::platform::GPU> &V2, chase::matrix::Matrix<chase::Base<T>, chase::platform::GPU> &ritzv, std::size_t offset, std::size_t subSize, int *devInfo, T *d_workspace = nullptr, int d_lwork = 0, T *h_workspace = nullptr, int h_lwork = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a Pseudo-Hermitian matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The computed Ritz values are stored in the
ritzvarray, and the resulting eigenvectors are stored inW.The procedure performs the following steps:
Computes the matrix-vector multiplication: W = H * Q.
Computes A = W’ * Q, where W’ is the conjugate transpose of W.
Solves the eigenvalue problem for A using LAPACK’s
heevdfunction, computing the Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed eigenvectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
N – [in] The number of rows of the matrix H.
H – [in] The input matrix (N x N).
ldh – [in] The leading dimension of the matrix H.
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
W – [out] The output matrix (N x n), which will store the result of the projection.
ldw – [in] The leading dimension of the matrix W.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
void rayleighRitz_v2(cublasHandle_t cublas_handle, cusolverDnHandle_t cusolver_handle, cusolverDnParams_t, chase::matrix::PseudoHermitianMatrix<T, chase::platform::GPU> *H, chase::matrix::Matrix<T, chase::platform::GPU> &V1, chase::matrix::Matrix<T, chase::platform::GPU> &V2, chase::matrix::Matrix<chase::Base<T>, chase::platform::GPU> &ritzv, std::size_t offset, std::size_t subSize, int *devInfo, T *workspace = nullptr, int lwork = 0, chase::matrix::Matrix<T, chase::platform::GPU> *A = nullptr) Perform the Rayleigh-Ritz procedure to compute eigenvalues and eigenvectors of a Pseudo-Hermitian matrix.
The Rayleigh-Ritz method computes an approximation to the eigenvalues and eigenvectors of a matrix by projecting the matrix onto a subspace defined by a set of vectors (Q) and solving the eigenvalue problem for the reduced matrix. The computed Ritz values are stored in the
ritzvarray, and the resulting eigenvectors are stored inW.The procedure performs the following steps:
Computes the matrix-vector multiplication: W = H * Q.
Computes A = W’ * Q, where W’ is the conjugate transpose of W.
Solves the eigenvalue problem for A using LAPACK’s
heevdfunction, computing the Ritz values inritzv.Computes the final approximation to the eigenvectors by multiplying Q with the computed eigenvectors.
- Template Parameters:
T – Data type for the matrix (e.g., float, double, etc.).
- Parameters:
N – [in] The number of rows of the matrix H.
H – [in] The input matrix (N x N).
ldh – [in] The leading dimension of the matrix H.
n – [in] The number of vectors in Q (subspace size).
Q – [in] The input matrix of size (N x n), whose columns are the basis vectors for the subspace.
ldq – [in] The leading dimension of the matrix Q.
W – [out] The output matrix (N x n), which will store the result of the projection.
ldw – [in] The leading dimension of the matrix W.
ritzv – [out] The array of Ritz values, which contains the eigenvalue approximations.
A – [in] A temporary matrix used in intermediate calculations. If not provided, it is allocated internally.
-
template<typename T>
1.5.1.3. chase::linalg::internal::mpi
Note
The MPI kernel namespace contains functions for distributed CPU operations. These are internal implementation details. For user-facing documentation, refer to the implementation classes (Implementation Classes).
1.5.1.4. chase::linalg::internal::nccl
Note
The NCCL kernel namespace contains functions for distributed GPU operations using NCCL. These are internal implementation details. For user-facing documentation, refer to the implementation classes (Implementation Classes).
1.5.1.5. chase::linalg::internal::cuda_mpi
Note
The CUDA-aware MPI kernel namespace contains functions for GPU operations with CUDA-aware MPI. These are internal implementation details. For user-facing documentation, refer to the implementation classes (Implementation Classes).