# ?getf2

Computes the LU factorization of a general m-by-n matrix using partial pivoting with row interchanges (unblocked algorithm).

## Syntax

call sgetf2( m, n, a, lda, ipiv, info )

call dgetf2( m, n, a, lda, ipiv, info )

call cgetf2( m, n, a, lda, ipiv, info )

call zgetf2( m, n, a, lda, ipiv, info )

## Description

The routine computes the LU factorization of a general m-by-n matrix A using partial pivoting with row interchanges. The factorization has the form

`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`).

## Input Parameters

m

  INTEGER. The number of rows in the matrix A (`m ≥ 0`).

n

  INTEGER. The number of columns in A (`n ≥ 0`).

a

  REAL for sgetf2

  DOUBLE PRECISION for dgetf2

  COMPLEX for cgetf2

  COMPLEX*16 for zgetf2.

  Array, DIMENSION (lda,*). Contains the matrix A to be factored. The second dimension of a must be at least `max(1, n)`.

lda

  INTEGER. The first dimension of a; at least `max(1, m)`.

## Output Parameters

a

  Overwritten by L and U. The unit diagonal elements of L are not stored.

ipiv

  INTEGER.

  Array, DIMENSION at least `max(1,min(m,n))`.

  The pivot indices: for `1 ≤ i ≤ n` , row i was interchanged with row ipiv(i).

info

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

  If `info = -i`, the i-th parameter had an illegal value.

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

Parent topic: Auxiliary Routines