pub fn xgetrf<TA: DataTypeLike>(
ctx: &Context,
params: &Params,
m: usize,
n: usize,
a: MatrixMut<'_, TA>,
pivots: Option<&mut DeviceMemory<i64>>,
compute_type: DataType,
workspace: ByteWorkspaceMut<'_>,
dev_info: &mut DeviceMemory<i32>,
) -> Result<()>Expand description
Computes the LU factorization of an $m \times n$ matrix
where A is an $m \times n$ matrix, P is a permutation matrix, L is a lower triangular matrix with unit diagonal, and U is an upper triangular matrix.
If LU factorization failed, that is, matrix A (U) is singular, dev_info = i indicates U(i,i) = 0.
If the reported info value is -i, the ith parameter is invalid.
If pivots is None, no pivoting is performed.
The factorization is A=L*U, which is not numerically stable.
Whether LU factorization succeeds or fails, pivots contains the pivoting
sequence. Row i is interchanged with row pivots[i].
Provide device and host workspace through workspace.
Use xgetrf_buffer_size to determine the required sizes for
workspace.device and workspace.host.
Callers can combine xgetrf and xgetrs to complete a linear solver.
Currently, xgetrf supports two algorithms.
To select the legacy implementation, call Params::set_adv_options.
Algorithms supported by xgetrf
| Algorithm | Notes |
|---|---|
AlgorithmMode::Default | Fastest algorithm; requires a large workspace of m*n elements. |
AlgorithmMode::Algorithm1 | Legacy implementation. |
List of input arguments for xgetrf_buffer_size and xgetrf:
The generic cuSOLVER routine has two data types: data_type_a is the data type of matrix A, and compute_type is the operation’s compute type.
xgetrf only supports the following four combinations.
Valid combination of data type and compute type
| data_type_a | compute_type | Meaning |
|---|---|---|
DataType::F32 | DataType::F32 | SGETRF |
DataType::F64 | DataType::F64 | DGETRF |
DataType::ComplexF32 | DataType::ComplexF32 | CGETRF |
DataType::ComplexF64 | DataType::ComplexF64 | ZGETRF |
§Errors
Returns an error if cuSOLVER has not been initialized, if the matrix dimensions or leading dimension are invalid, or if cuSOLVER reports an internal failure.