f07as solves a complex system of linear equations with multiple right-hand sides,
 $AX=B, ATX=B or AHX=B,$
where $A$ has been factorized by f07ar.

# Syntax

C#
```public static void f07as(
string trans,
int n,
int nrhs,
Complex[,] a,
int[] ipiv,
Complex[,] b,
out int info
)```
Visual Basic
```Public Shared Sub f07as ( _
trans As String, _
n As Integer, _
nrhs As Integer, _
a As Complex(,), _
ipiv As Integer(), _
b As Complex(,), _
<OutAttribute> ByRef info As Integer _
)```
Visual C++
```public:
static void f07as(
String^ trans,
int n,
int nrhs,
array<Complex,2>^ a,
array<int>^ ipiv,
array<Complex,2>^ b,
[OutAttribute] int% info
)```
F#
```static member f07as :
trans : string *
n : int *
nrhs : int *
a : Complex[,] *
ipiv : int[] *
b : Complex[,] *
info : int byref -> unit
```

#### Parameters

trans
Type: System..::..String
On entry: indicates the form of the equations.
${\mathbf{trans}}=\text{"N"}$
$AX=B$ is solved for $X$.
${\mathbf{trans}}=\text{"T"}$
${A}^{\mathrm{T}}X=B$ is solved for $X$.
${\mathbf{trans}}=\text{"C"}$
${A}^{\mathrm{H}}X=B$ is solved for $X$.
Constraint: ${\mathbf{trans}}=\text{"N"}$, $\text{"T"}$ or $\text{"C"}$.
n
Type: System..::..Int32
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
nrhs
Type: System..::..Int32
On entry: $r$, the number of right-hand sides.
Constraint: ${\mathbf{nrhs}}\ge 0$.
a
Type: array<NagLibrary..::..Complex,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $LU$ factorization of $A$, as returned by f07ar.
ipiv
Type: array<System..::..Int32>[]()[][]
An array of size [dim1]
Note: the dimension of the array ipiv must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the pivot indices, as returned by f07ar.
b
Type: array<NagLibrary..::..Complex,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Note: the second dimension of the array b must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{nrhs}}\right)$.
On entry: the $n$ by $r$ right-hand side matrix $B$.
On exit: the $n$ by $r$ solution matrix $X$.
info
Type: System..::..Int32%
On exit: ${\mathbf{info}}=0$ unless the method detects an error (see [Error Indicators and Warnings]).

# Description

f07as is used to solve a complex system of linear equations $AX=B$, ${A}^{\mathrm{T}}X=B$ or ${A}^{\mathrm{H}}X=B$, the method must be preceded by a call to f07ar which computes the $LU$ factorization of $A$ as $A=PLU$. The solution is computed by forward and backward substitution.
If ${\mathbf{trans}}=\text{"N"}$, the solution is computed by solving $PLY=B$ and then $UX=Y$.
If ${\mathbf{trans}}=\text{"T"}$, the solution is computed by solving ${U}^{\mathrm{T}}Y=B$ and then ${L}^{\mathrm{T}}{P}^{\mathrm{T}}X=Y$.
If ${\mathbf{trans}}=\text{"C"}$, the solution is computed by solving ${U}^{\mathrm{H}}Y=B$ and then ${L}^{\mathrm{H}}{P}^{\mathrm{T}}X=Y$.

# References

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

# Error Indicators and Warnings

Some error messages may refer to parameters that are dropped from this interface (LDA, LDB) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-4000$
Invalid dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

For each right-hand side vector $b$, the computed solution $x$ is the exact solution of a perturbed system of equations $\left(A+E\right)x=b$, where
 $E≤cnεPLU,$
$c\left(n\right)$ is a modest linear function of $n$, and $\epsilon$ is the machine precision.
If $\stackrel{^}{x}$ is the true solution, then the computed solution $x$ satisfies a forward error bound of the form
 $x-x^∞x∞≤cncondA,xε$
where $\mathrm{cond}\left(A,x\right)={‖\left|{A}^{-1}\right|\left|A\right|\left|x\right|‖}_{\infty }/{‖x‖}_{\infty }\le \mathrm{cond}\left(A\right)={‖\left|{A}^{-1}\right|\left|A\right|‖}_{\infty }\le {\kappa }_{\infty }\left(A\right)$.
Note that $\mathrm{cond}\left(A,x\right)$ can be much smaller than $\mathrm{cond}\left(A\right)$, and $\mathrm{cond}\left({A}^{\mathrm{H}}\right)$ (which is the same as $\mathrm{cond}\left({A}^{\mathrm{T}}\right)$) can be much larger (or smaller) than $\mathrm{cond}\left(A\right)$.
Forward and backward error bounds can be computed by calling (F07AVF not in this release), and an estimate for ${\kappa }_{\infty }\left(A\right)$ can be obtained by calling (F07AUF not in this release) with ${\mathbf{norm}}=\text{"I"}$.

# Parallelism and Performance

None.

The total number of real floating-point operations is approximately $8{n}^{2}r$.