Skip to main content

cusolverDnXgeev

Function cusolverDnXgeev 

Source
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_t
Expand 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 NULLDefault 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

DataTypeADataTypeWDataTypeVLDataTypeVRComputeTypeMeaning
CUDA_R_32FCUDA_R_32FCUDA_R_32FCUDA_R_32FCUDA_R_32FSGEEV
CUDA_R_32FCUDA_C_32FCUDA_R_32FCUDA_R_32FCUDA_R_32F32F mixed real-complex
CUDA_R_64FCUDA_R_64FCUDA_R_64FCUDA_R_64FCUDA_R_64FDGEEV
CUDA_R_64FCUDA_C_64FCUDA_R_64FCUDA_R_64FCUDA_R_64F64F mixed real-complex
CUDA_C_32FCUDA_C_32FCUDA_C_32FCUDA_C_32FCUDA_C_32FCGEEV
CUDA_C_64FCUDA_C_64FCUDA_C_64FCUDA_C_64FCUDA_C_64FZGEEV

§Parameters

  • handle: Handle to the cuSolverDN library context.
  • params: Structure with information collected by cusolverDnSetAdvOptions.
  • 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 matrix A.
  • dataTypeA: Data type of array A.
  • A: Array of dimension lda * n with lda is not less than max(1,n). On entry, the n-by-n matrix A. On exit, A has been overwritten.
  • lda: Leading dimension of two-dimensional array used to store matrix A.
  • dataTypeW: Data type of array W.
  • W: Array holding the computed eigenvalues of A. Its length is 2*n if dataTypeA = CUDA_R_32F and dataTypeW = CUDA_R_32F or dataTypeA = CUDA_R_64F and dataTypeW = CUDA_R_64F and the first n entries of W hold the real parts and the last n entries of W hold the imaginary parts of the eigenvalues. Otherwise, the length is n.
  • dataTypeVL: Data type of array VL.
  • VL: Array of dimension ldvl * n. If jobvl = cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues. If datatypeVL is complex or the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL. If dataTypeVL is real and the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and u(j+1) = VL(:,j) - i*VL(:,j+1). If jobvl = cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR, VL is not referenced.
  • ldvl: Leading dimension of two-dimensional array used to store matrix VL with ldvl >= 1. If jobvl = cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, ldvl >= n.
  • dataTypeVR: Data type of array VR.
  • VR: Array of dimension ldvr * n. If jobvr = cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If datatypeVR is complex or the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If dataTypeVR is real and the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) = VR(:,j) - i*VR(:,j+1). If jobvr = cusolverEigMode_t::CUSOLVER_EIG_MODE_NOVECTOR, VR is not referenced.
  • ldvr: Leading dimension of two-dimensional array used to store matrix VR with ldvr >= 1. If jobvr = cusolverEigMode_t::CUSOLVER_EIG_MODE_VECTOR, ldvr >= n.
  • computeType: Data type of computation.
  • bufferOnDevice: Device workspace. Array of type void of size workspaceInBytesOnDevice bytes.
  • workspaceInBytesOnDevice: Size in bytes of bufferOnDevice, returned by cusolverDnXgeev_bufferSize.
  • bufferOnHost: Host workspace. Array of type void of size workspaceInBytesOnHost bytes.
  • workspaceInBytesOnHost: Size in bytes of bufferOnHost, returned by cusolverDnXgeev_bufferSize.
  • info: If info = 0, the operation is successful. If info = -i, the i-th parameter is wrong (not counting handle). If info = i (greater than zero), the QR algorithm failed to compute all the eigenvalues and no eigenvectors have been computed; elements i+1:n of W contain eigenvalues which have converged.

§Return value