f04 Chapter Contents
f04 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_hermitian_lin_eqn_mult_rhs (f04awc)

## 1  Purpose

nag_hermitian_lin_eqn_mult_rhs (f04awc) calculates the approximate solution of a set of complex Hermitian positive definite linear equations with multiple right-hand sides, $AX=B$, where $A$ has been factorized by nag_complex_cholesky (f01bnc).

## 2  Specification

 #include #include
 void nag_hermitian_lin_eqn_mult_rhs (Integer n, Integer nrhs, Complex a[], Integer tda, double p[], const Complex b[], Integer tdb, Complex x[], Integer tdx, NagError *fail)

## 3  Description

To solve a set of complex linear equations, $AX=B$, where $A$ is positive definite Hermitian, this function must be preceded by a call to nag_complex_cholesky (f01bnc) which computes a Cholesky factorization $A={U}^{H}U$, where $U$ is an upper triangular matrix with real diagonal elements. The columns $x$ of the solution $X$ are found in two steps ${U}^{H}y=b$ and $Ux=y$, where $b$ is a column of the right-hand side matrix $B$.

## 4  References

Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag

## 5  Arguments

1:     nIntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 1$.
2:     nrhsIntegerInput
On entry: $r$, the number of right-hand sides.
Constraint: ${\mathbf{nrhs}}\ge 1$.
3:     a[${\mathbf{n}}×{\mathbf{tda}}$]ComplexInput
Note: the $\left(i,j\right)$th element of the matrix $A$ is stored in ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{tda}}+j-1\right]$.
On entry: the off-diagonal elements of the upper triangular matrix $U$ as returned by nag_complex_cholesky (f01bnc). The lower triangle of the array is not used.
4:     tdaIntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint: ${\mathbf{tda}}\ge {\mathbf{n}}$.
5:     p[n]doubleInput
On entry: the reciprocals of the diagonal elements of $U$, as returned by nag_complex_cholesky (f01bnc).
6:     b[${\mathbf{n}}×{\mathbf{tdb}}$]const ComplexInput
Note: the $\left(i,j\right)$th element of the matrix $B$ is stored in ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{tdb}}+j-1\right]$.
On entry: the $n$ by $r$ right-hand side matrix $B$. See also Section 8.
7:     tdbIntegerInput
On entry: the stride separating matrix column elements in the array b.
Constraint: ${\mathbf{tdb}}\ge {\mathbf{nrhs}}$.
8:     x[${\mathbf{n}}×{\mathbf{tdx}}$]ComplexOutput
Note: the $\left(i,j\right)$th element of the matrix $X$ is stored in ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{tdx}}+j-1\right]$.
On exit: the $n$ by $r$ solution matrix $X$. See also Section 8.
9:     tdxIntegerInput
On entry: the stride separating matrix column elements in the array x.
Constraint: ${\mathbf{tdx}}\ge {\mathbf{nrhs}}$.
10:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_2_INT_ARG_LT
On entry, ${\mathbf{tda}}=〈\mathit{\text{value}}〉$ while ${\mathbf{n}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tda}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{tdb}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdb}}\ge {\mathbf{nrhs}}$.
On entry, ${\mathbf{tdx}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdx}}\ge {\mathbf{nrhs}}$.
NE_INT_ARG_LT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 1$.
On entry, ${\mathbf{nrhs}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nrhs}}\ge 1$.

## 7  Accuracy

The solutions should be the best possible for the precision of computation having regard to the condition of $A$. The computed solution $x$, corresponding to the right-hand side $b$, satisfies the bound
 $x-A -1 b A -1 b ≤ c ε k .$
Here $c$ is a modest function of $n$, $\epsilon$ is the machine precision, and $k$ is the condition number defined by
 $k = A A -1 .$

The time taken by nag_hermitian_lin_eqn_mult_rhs (f04awc) is approximately proportional to ${n}^{2}r$.
The function may be called with the same actual array supplied for arguments b and x, in which case the solution vectors will overwrite the right-hand sides.

## 9  Example

To solve the set of linear equations $AX=B$ where $A$ is the positive definite Hermitian matrix:
 $- 15 +2 i -2 1 - 2 i -1 2 -2 i 1 - 4 + 3 i -1 1 + 2 i - 20 -2 i 1 - 2 + 2 i -2 3 - 3 i -1 2 -2 i 1 - 2 - 1 i - 18 -2 i 1 - 1 + 2 i 1 - 4 - 3 i -2 3 + 3 i 1 - 1 - 2 i - 26 -2 i$
and $B$ is the single column vector:
 $25+34i 21+19i 12-21i 21-27i .$

### 9.1  Program Text

Program Text (f04awce.c)

### 9.2  Program Data

Program Data (f04awce.d)

### 9.3  Program Results

Program Results (f04awce.r)