Skip to main content

cusolverDnXgeqrf

Function cusolverDnXgeqrf 

Source
pub unsafe extern "C" fn cusolverDnXgeqrf(
    handle: cusolverDnHandle_t,
    params: cusolverDnParams_t,
    m: i64,
    n: i64,
    dataTypeA: cudaDataType,
    A: *mut c_void,
    lda: i64,
    dataTypeTau: cudaDataType,
    tau: *mut c_void,
    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 the QR factorization of a $m \times n$ matrix: $$ A = Q\*R $$

where A is an $m \times n$ matrix, Q is a $m \times n$ matrix, and R is an $n \times n$ upper triangular matrix using the generic API interface.

The user has to provide device and host working spaces which are pointed by input parameters bufferOnDevice and bufferOnHost. The input parameters workspaceInBytesOnDevice (and workspaceInBytesOnHost) is size in bytes of the device (and host) working space, and it is returned by cusolverDnXgeqrf_bufferSize.

The matrix R is overwritten in upper triangular part of A, including diagonal elements.

The matrix Q is not formed explicitly, instead, a sequence of householder vectors are stored in lower triangular part of A. The leading nonzero element of householder vector is assumed to be 1 such that output parameter TAU contains the scaling factor τ. If v is original householder vector, q is the new householder vector corresponding to τ, satisfying the following relation: $$ I - 2\*v\*v^{H} = I - \tau\*q\*q^{H} $$

If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle).

Currently, cusolverDnXgeqrf supports only the default algorithm.

Please visit cuSOLVER Library Samples - Xgeqrf for a code example.

Algorithms supported by cusolverDnXgeqrf

cusolverAlgMode_t::CUSOLVER_ALG_0 or NULLDefault algorithm.

List of input arguments for cusolverDnXgeqrf_bufferSize and cusolverDnXgeqrf:

The generic API has two different types, dataTypeA is data type of the matrix A, dataTypeTau is data type of the array tau and computeType is compute type of the operation. cusolverDnXgeqrf only supports the following four combinations.

Valid combination of data type and compute type

DataTypeAComputeTypeMeaning
CUDA_R_32FCUDA_R_32FSGEQRF
CUDA_R_64FCUDA_R_64FDGEQRF
CUDA_C_32FCUDA_C_32FCGEQRF
CUDA_C_64FCUDA_C_64FZGEQRF

§Parameters

  • handle: Handle to the cuSolverDN library context.
  • params: Structure with information collected by cusolverDnSetAdvOptions.
  • m: Number of rows of matrix A.
  • n: Number of columns of matrix A.
  • dataTypeA: Data type of array A.
  • A: Array of dimension lda * n with lda is not less than max(1,m).
  • lda: Leading dimension of two-dimensional array used to store matrix A.
  • dataTypeTau: Data type of array tau.
  • tau: Array of dimension at least min(m,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 cusolverDnXgeqrf_bufferSize.
  • bufferOnHost: Host workspace. Array of type void of size workspaceInBytesOnHost bytes.
  • workspaceInBytesOnHost: Size in bytes of bufferOnHost, returned by cusolverDnXgeqrf_bufferSize.
  • info: If info = 0, the QR factorization is successful. If info = -i, the i-th parameter is wrong (not counting handle).

§Return value