# p?getrf

Computes the LU factorization of a general m-by-n distributed matrix.

## Syntax

call psgetrf(m, n, a, ia, ja, desca, ipiv, info)

call pdgetrf(m, n, a, ia, ja, desca, ipiv, info)

call pcgetrf(m, n, a, ia, ja, desca, ipiv, info)

call pzgetrf(m, n, a, ia, ja, desca, ipiv, info)

## Description

The routine forms the LU factorization of a general m-by-n distributed matrix `sub(A) = A(ia:ia+n-1, ja:ja+n-1)` as

`A = P*L*U`

where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if `m > n`) and U is upper triangular (upper trapezoidal if m < n). L and U are stored in sub(A).

The routine uses partial pivoting, with row interchanges.

## Input Parameters

m

  (global) INTEGER. The number of rows in the distributed submatrix sub(A); `m≥0`.

n

  (global) INTEGER. The number of columns in the distributed submatrix sub(A); `n≥0`.

a

  (local)

  REAL for psgetrf

  DOUBLE PRECISION for pdgetrf

  COMPLEX for pcgetrf

  DOUBLE COMPLEX for pzgetrf.

  Pointer into the local memory to an array of local dimension `(lld_a, LOCc(ja+n-1))`.

  Contains the local pieces of the distributed matrix sub(A) to be factored.

ia, ja

  (global) INTEGER. The row and column indices in the global array A indicating the first row and the first column of the submatrix `A(ia:ia+n-1, ja:ja+n-1)`, respectively.

desca

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix A.

## Output Parameters

a

  Overwritten by local pieces of the factors L and U from the factorization A = P*L*U. The unit diagonal elements of L are not stored.

ipiv

  (local) INTEGER array.

  The dimension of ipiv is (`LOCr(m_a)+ mb_a)`.

  This array contains the pivoting information: local row i was interchanged with global row `ipiv(i)`. This array is tied to the distributed matrix A.

info

  (global) INTEGER.

  If `info=0`, the execution is successful.

  `info < 0`: if the i-th argument is an array and the j-th entry had an illegal value, then `info = -(i*100+j)`; if the i-th argument is a scalar and had an illegal value, then `info = -i`.

  If `info = i`, uii is 0. The factorization has been completed, but the factor U is exactly singular. Division by zero will occur if you use the factor U for solving a system of linear equations.

Parent topic: Routines for Matrix Factorization