pub unsafe extern "C" fn cusolverDnXpolar(
handle: cusolverDnHandle_t,
params: cusolverDnParams_t,
uplo: cublasFillMode_t,
M: i64,
N: i64,
dataTypeA: cudaDataType,
A: *mut c_void,
lda: i64,
dataTypeH: cudaDataType,
H: *mut c_void,
ldh: i64,
computeType: cudaDataType,
bufferOnDevice: *mut c_void,
workspaceInBytesOnDevice: size_t,
bufferOnHost: *mut c_void,
workspaceInBytesOnHost: size_t,
d_res_nrm: *mut f64,
d_A_nrmF: *mut f64,
d_rcond: *mut f64,
d_info: *mut c_int,
) -> cusolverStatus_tExpand description
The following helper function calculates the required workspace sizes for cusolverDnXpolar.
The following routine computes the polar decomposition.
This function computes the polar decomposition of an $m \times n$ matrix A (where $m \geq n$). The polar decomposition is written:
$$
A = U_p \cdot H
$$
where $U_p$ is an $m \times n$ matrix with orthonormal columns and $H$ is an $n \times n$ Hermitian positive semidefinite matrix.
cusolverDnXpolar uses the QDWH (QR-based Dynamically Weighted Halley) iteration [14][16] to compute $U_p$. The QDWH iteration converges cubically and requires at most ~6 iterations. For ill-conditioned or rank-deficient matrices A, the routine adds a small perturbation $\xi$ to ensure the polar decomposition converges correctly. The output parameter d_res_nrm reports the magnitude of the residual $\|A - U_p \cdot H\|_2$.
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 cusolverDnXpolar_bufferSize.
If output parameter info = -i (less than zero), the i-th parameter is wrong (not counting handle).
Currently, cusolverDnXpolar supports only the default algorithm.
Algorithms supported by cusolverDnXpolar
cusolverAlgMode_t::CUSOLVER_ALG_0 or NULL | Default algorithm. |
Remark 1: If H is NULL, computation of H is skipped.
Remark 2: uplo = CUBLAS_FILL_MODE_UPPER treats A as upper triangular, saving one QR decomposition. cublasFillMode_t::CUBLAS_FILL_MODE_LOWER is not supported.
Remark 3: d_res_nrm serves dual purpose. On input, if *d_res_nrm >= 0, it overrides the perturbation $\xi$ (skipping automatic search). On output, it reports the residual norm $\|A - U_p \cdot H\|_2$.
List of input arguments for cusolverDnXpolar_bufferSize and cusolverDnXpolar:
The generic API has three different types, dataTypeA is data type of the matrix A, dataTypeH is data type of the matrix H, and computeType is compute type of the operation. cusolverDnXpolar only supports the following four combinations:
Valid combination of data type and compute type
| DataTypeA | DataTypeH | ComputeType | Meaning |
|---|---|---|---|
CUDA_R_32F | CUDA_R_32F | CUDA_R_32F | SPOLAR |
CUDA_R_64F | CUDA_R_64F | CUDA_R_64F | DPOLAR |
CUDA_C_32F | CUDA_C_32F | CUDA_C_32F | CPOLAR |
CUDA_C_64F | CUDA_C_64F | CUDA_C_64F | ZPOLAR |
§Parameters
handle: Handle to the cuSolverDN library context.params: Structure with information collected bycusolverDnSetAdvOptions.uplo: Specifies the structure of matrixA.uplo=cublasFillMode_t::CUBLAS_FILL_MODE_UPPER:Ais upper triangular, saving one QR decomposition.uplo=cublasFillMode_t::CUBLAS_FILL_MODE_FULL:Ais a general matrix.cublasFillMode_t::CUBLAS_FILL_MODE_LOWERis not supported.dataTypeA: Data type of arrayA.A: Array of dimensionlda * nwithldais not less thanmax(1,m). On exit,Ais overwritten with the unitary polar factor $U_p$ with orthonormal columns.lda: Leading dimension of two-dimensional array used to store matrixA.lda >= max(1,m).dataTypeH: Data type of arrayH. Must equaldataTypeA.H: Array of dimensionldh * nwithldhis not less thanmax(1,n). $n \times n$ Hermitian positive semidefinite factor. IfHisNULL, computation ofHis skipped.ldh: Leading dimension of two-dimensional array used to store matrixH.ldh >= max(1,n)whenHis notNULL.computeType: Data type of computation. Must equaldataTypeA.bufferOnDevice: Device workspace. Array of typevoidof sizeworkspaceInBytesOnDevicebytes.workspaceInBytesOnDevice: Size in bytes ofbufferOnDevice, returned bycusolverDnXpolar_bufferSize.bufferOnHost: Host workspace. Array of typevoidof sizeworkspaceInBytesOnHostbytes.workspaceInBytesOnHost: Size in bytes ofbufferOnHost, returned bycusolverDnXpolar_bufferSize.d_res_nrm: On input, if*d_res_nrm >= 0, it overrides the perturbation $\xi$ (skipping automatic search). On output, reports $\Vert A - U_p \cdot H \Vert_2$.d_A_nrmF: $\Vert A \Vert_F$ (Frobenius norm ofA). IfNULL, the computation is skipped.d_rcond: Reciprocal condition number $1/\text{cond}(A, \text{fro})$. IfNULL, the computation is skipped. Undefined if a user-supplied $\xi > 0$ was provided viad_res_nrm.d_info: Ifinfo = 0, the operation is successful. Ifinfo = -i, thei-thparameter is wrong (not counting handle). Ifinfo = 1, the algorithm failed to findrcond > 1.e-15by adding perturbation. Ifinfo = 10, the algorithm failed to converge within 10 iterations.
§Return value
cusolverStatus_t::CUSOLVER_STATUS_INTERNAL_ERROR: An internal operation failed.cusolverStatus_t::CUSOLVER_STATUS_INVALID_VALUE: Invalid parameters were passed (m<0, orn<0, orm<n, orlda < max(1,m), orldh < max(1,n)whenHis notNULL, oruploiscublasFillMode_t::CUBLAS_FILL_MODE_LOWER, ordataTypeH != dataTypeA, orcomputeType != dataTypeA).cusolverStatus_t::CUSOLVER_STATUS_NOT_INITIALIZED: The library was not initialized.cusolverStatus_t::CUSOLVER_STATUS_SUCCESS: The operation completed successfully.