# NAG CL Interfacef07arc (zgetrf)

Settings help

CL Name Style:

## 1Purpose

f07arc computes the $LU$ factorization of a complex $m×n$ matrix.

## 2Specification

 #include
 void f07arc (Nag_OrderType order, Integer m, Integer n, Complex a[], Integer pda, Integer ipiv[], NagError *fail)
The function may be called by the names: f07arc, nag_lapacklin_zgetrf or nag_zgetrf.

## 3Description

f07arc forms the $LU$ factorization of a complex $m×n$ matrix $A$ as $A=PLU$, 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). Usually $A$ is square $\left(m=n\right)$, and both $L$ and $U$ are triangular. The function uses partial pivoting, with row interchanges.

## 4References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## 5Arguments

1: $\mathbf{order}$Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{m}$Integer Input
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{m}}\ge 0$.
3: $\mathbf{n}$Integer Input
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4: $\mathbf{a}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array a must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{n}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pda}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $A$ is stored in
• ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{pda}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $m×n$ matrix $A$.
On exit: the factors $L$ and $U$ from the factorization $A=PLU$; the unit diagonal elements of $L$ are not stored.
5: $\mathbf{pda}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
6: $\mathbf{ipiv}\left[\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)\right]$Integer Output
On exit: the pivot indices that define the permutation matrix. At the $\mathit{i}$th step, if ${\mathbf{ipiv}}\left[\mathit{i}-1\right]>\mathit{i}$ then row $\mathit{i}$ of the matrix $A$ was interchanged with row ${\mathbf{ipiv}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,n\right)$. ${\mathbf{ipiv}}\left[i-1\right]\le i$ indicates that, at the $i$th step, a row interchange was not required.
7: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{m}}\ge 0$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}>0$.
NE_INT_2
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_SINGULAR
Element $⟨\mathit{\text{value}}⟩$ of the diagonal is exactly zero. The factorization has been completed, but the factor $U$ is exactly singular, and division by zero will occur if it is used to solve a system of equations.

## 7Accuracy

The computed factors $L$ and $U$ are the exact factors of a perturbed matrix $A+E$, where
 $|E| ≤ c (min(m,n)) ε P |L| |U| ,$
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision.

## 8Parallelism and Performance

f07arc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f07arc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of real floating-point operations is approximately $\frac{8}{3}{n}^{3}$ if $m=n$ (the usual case), $\frac{4}{3}{n}^{2}\left(3m-n\right)$ if $m>n$ and $\frac{4}{3}{m}^{2}\left(3n-m\right)$ if $m.
A call to this function with $m=n$ may be followed by calls to the functions:
• f07asc to solve $AX=B$, ${A}^{\mathrm{T}}X=B$ or ${A}^{\mathrm{H}}X=B$;
• f07auc to estimate the condition number of $A$;
• f07awc to compute the inverse of $A$.
The real analogue of this function is f07adc.

## 10Example

This example computes the $LU$ factorization of the matrix $A$, where
 $A= ( -1.34+2.55i 0.28+3.17i -6.39-2.20i 0.72-0.92i -0.17-1.41i 3.31-0.15i -0.15+1.34i 1.29+1.38i -3.29-2.39i -1.91+4.42i -0.14-1.35i 1.72+1.35i 2.41+0.39i -0.56+1.47i -0.83-0.69i -1.96+0.67i ) .$

### 10.1Program Text

Program Text (f07arce.c)

### 10.2Program Data

Program Data (f07arce.d)

### 10.3Program Results

Program Results (f07arce.r)