pub unsafe extern "C" fn cusolverDnXgeev(
handle: cusolverDnHandle_t,
params: cusolverDnParams_t,
jobvl: cusolverEigMode_t,
jobvr: cusolverEigMode_t,
n: i64,
dataTypeA: cudaDataType,
A: *mut c_void,
lda: i64,
dataTypeW: cudaDataType,
W: *mut c_void,
dataTypeVL: cudaDataType,
VL: *mut c_void,
ldvl: i64,
dataTypeVR: cudaDataType,
VR: *mut c_void,
ldvr: i64,
computeType: cudaDataType,
bufferOnDevice: *mut c_void,
workspaceInBytesOnDevice: size_t,
bufferOnHost: *mut c_void,
workspaceInBytesOnHost: size_t,
info: *mut c_int,
) -> cusolverStatus_tExpand description
The helper functions below can calculate the sizes needed for pre-allocated buffer.
The following routine:
computes for an n-by-n real non-symmetric or complex non-Hermitian matrix A the eigenvalues and, optionally, the left and/or right eigenvectors. The right eigenvector v(j) of A satisfies:
$$
A\*v(j) = w(j)\*v(j)
$$
where w(j) is its eigenvalue. The left eigenvalue u(j) of A satisfies:
$$
u(j)^{H}\*A = w(j)\*v(j)^{H}
$$
where $u(j)^{H}$ denotes the conjugate-transpose of u(j).
The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
If A is real-valued, there are two options to return the eigenvalues in W. The first options sets all data types to real-valued types. Then W holds 2*n entries. The first n entries hold the real parts and the last n entries hold the imaginary parts. The LAPACK interface with separate arrays for the real parts WR and the imaginary parts WI can be recovered by settings pointers WR = W, WI = W+n. The second option uses a complex data type for W. Then W is n entries long; each real eigenvalue is stored as a complex number and for each complex conjugate pair, both eigenvalues are returned. The computation is still executed fully in real arithmetic.
The user has to provide device and host working space which are pointed to by the input parameters bufferOnDevice and bufferOnHost. The input parameters workspaceInBytesOnDevice and workspaceInBytesOnHost denote the size in bytes of the device and host working space, and returned by cusolverDnXgeev_bufferSize.
If the output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle). If info = 0, the QR algorithm converged and W contains the computed eigenvalues of A and, if requested, the corresponding left and/or right eigenvectors have been computed. If info = i (greater than zero), the QR algorithm failed to compute all the eigenvalues and no eigenvectors have been computed. The elements i+1:n of W contain eigenvalues which have converged.
Remark 1: geev only supports the computation of right eigenvectors. So, jobvl = cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR must be set.
Remark 2: geev uses balancing to improve the conditioning of the eigenvalues and eigenvectors.
Remark 3: geev is a hybrid CPU-GPU algorithm. Best performance is attained with pinned host memory.
Currently, cusolverDnXgeev supports only the default algorithm.
Please visit cuSOLVER Library Samples - Xgeev for a code example.
Table of algorithms supported by cusolverDnXgeev
cusolverAlgMode_t::CUSOLVER_ALG_0 or NULL | Default algorithm. |
List of input arguments for cusolverDnXgeev_bufferSize and cusolverDnXgeev:
The generic API has five different types, dataTypeA is the data type of the matrix A, dataTypeW is the data type of the array W, dataTypeVL is the data type of the matrix VL, dataTypeVR is the data type of the matrix VR and computeType is compute type of the operation. cusolverDnXgeev only supports the following four combinations:
Valid combination of data type and compute type
| DataTypeA | DataTypeW | DataTypeVL | DataTypeVR | ComputeType | Meaning |
|---|---|---|---|---|---|
CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | SGEEV |
CUDA_R_32F | CUDA_C_32F | CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | 32F mixed real-complex |
CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | DGEEV |
CUDA_R_64F | CUDA_C_64F | CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | 64F mixed real-complex |
CUDA_C_32F | CUDA_C_32F | CUDA_C_32F | CUDA_C_32F | CUDA_C_32F | CGEEV |
CUDA_C_64F | CUDA_C_64F | CUDA_C_64F | CUDA_C_64F | CUDA_C_64F | ZGEEV |
§Parameters
handle: Handle to the cuSolverDN library context.params: Structure with information collected bycusolverDnSetAdvOptions.jobvl: Specifies whether or not to compute left eigenvectors.jobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR: Do not compute left eigenvectors of A;jobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR: Compute left eigenvectors of A.jobvr: Specifies whether or not to compute right eigenvectors.jobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR: Do not compute left eigenvectors of A;jobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR: Compute left eigenvectors of A.n: Number of rows (or columns) of matrixA.dataTypeA: Data type of arrayA.A: Array of dimensionlda * nwithldais not less thanmax(1,n). On entry, the n-by-n matrixA. On exit,Ahas been overwritten.lda: Leading dimension of two-dimensional array used to store matrixA.dataTypeW: Data type of arrayW.W: Array holding the computed eigenvalues ofA. Its length is2*nifdataTypeA=CUDA_R_32FanddataTypeW=CUDA_R_32FordataTypeA=CUDA_R_64FanddataTypeW=CUDA_R_64Fand the first n entries ofWhold the real parts and the last n entries ofWhold the imaginary parts of the eigenvalues. Otherwise, the length is n.dataTypeVL: Data type of arrayVL.VL: Array of dimensionldvl * n. Ifjobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, the left eigenvectorsu(j)are stored one after another in the columns ofVL, in the same order as their eigenvalues. IfdatatypeVLis complex or thej-theigenvalue is real, thenu(j) = VL(:,j), thej-thcolumn ofVL. IfdataTypeVLis real and thej-thand(j+1)-steigenvalues form a complex conjugate pair, thenu(j) = VL(:,j) + i*VL(:,j+1)andu(j+1) = VL(:,j) - i*VL(:,j+1). Ifjobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR,VLis not referenced.ldvl: Leading dimension of two-dimensional array used to store matrixVLwithldvl >= 1. Ifjobvl=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR,ldvl >= n.dataTypeVR: Data type of arrayVR.VR: Array of dimensionldvr * n. Ifjobvr=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, the right eigenvectorsv(j)are stored one after another in the columns ofVR, in the same order as their eigenvalues. IfdatatypeVRis complex or thej-theigenvalue is real, thenv(j) = VR(:,j), thej-thcolumn ofVR. IfdataTypeVRis real and thej-thand(j+1)-steigenvalues form a complex conjugate pair, thenv(j) = VR(:,j) + i*VR(:,j+1)andv(j+1) = VR(:,j) - i*VR(:,j+1). Ifjobvr=cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR,VRis not referenced.ldvr: Leading dimension of two-dimensional array used to store matrixVRwithldvr >= 1. Ifjobvr=cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR,ldvr >= n.computeType: Data type of computation.bufferOnDevice: Device workspace. Array of typevoidof sizeworkspaceInBytesOnDevicebytes.workspaceInBytesOnDevice: Size in bytes ofbufferOnDevice, returned bycusolverDnXgeev_bufferSize.bufferOnHost: Host workspace. Array of typevoidof sizeworkspaceInBytesOnHostbytes.workspaceInBytesOnHost: Size in bytes ofbufferOnHost, returned bycusolverDnXgeev_bufferSize.info: Ifinfo = 0, the operation is successful. Ifinfo = -i, thei-thparameter is wrong (not counting handle). Ifinfo = i(greater than zero), the QR algorithm failed to compute all the eigenvalues and no eigenvectors have been computed; elementsi+1:nofWcontain eigenvalues which have converged.
§Return value
cusolverStatus_t::CUSOLVER_STATUS_INTERNAL_ERROR: An internal operation failed.cusolverStatus_t::CUSOLVER_STATUS_INVALID_VALUE: Invalid parameters were passed (jobvlis notcusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTORorcusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, orjobvris notcusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTORorcusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR,n<0, orlda < max(1,n), orldvl < nifjobvliscusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, orldvr < nifjobvriscusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR).cusolverStatus_t::CUSOLVER_STATUS_NOT_INITIALIZED: The library was not initialized.cusolverStatus_t::CUSOLVER_STATUS_SUCCESS: The operation completed successfully.