[go: up one dir, main page]

getrf2

Function getrf2 

Source
pub unsafe fn getrf2(
    m: usize,
    n: usize,
    a: *mut f64,
    lda: usize,
    ipiv: &mut [i32],
) -> Result<(), String>
Expand description

Computes the LU factorization of a general M-by-N matrix using partial pivoting (unsafe version).

This function is an unsafe variant of getrf that operates on a raw pointer to the matrix data. It performs an LU decomposition of a matrix A, resulting in a factorization of the form P * A = L * U, where:

  • P is a permutation matrix,
  • L is a lower triangular matrix with a unit diagonal,
  • U is an upper triangular matrix.

§Arguments

  • m - The number of rows in the matrix A.
  • n - The number of columns in the matrix A.
  • a - A raw mutable pointer to the first element of the M-by-N matrix A, which is assumed to be in column-major order. On successful exit, the memory region is overwritten with the L and U factors. The unit diagonal of L is not stored.
  • lda - The leading dimension of A. It specifies the stride between consecutive columns in memory and must be at least max(1, m).
  • ipiv - A mutable slice that will be filled with the pivot indices. Its length must be at least min(m, n). For each i from 0 to min(m,n)-1, row i was interchanged with row ipiv[i].

§Returns

  • Ok(()) - If the factorization completed successfully.
  • Err(String)