F04 Chapter Contents
F04 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF04AGF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F04AGF calculates the approximate solution of a set of real symmetric positive definite linear equations with multiple right-hand sides, $AX=B$, where $A$ has been factorized by F03AEF.

## 2  Specification

 SUBROUTINE F04AGF ( N, IR, A, LDA, P, B, LDB, X, LDX)
 INTEGER N, IR, LDA, LDB, LDX REAL (KIND=nag_wp) A(LDA,N), P(N), B(LDB,IR), X(LDX,IR)

## 3  Description

To solve a set of real linear equations $AX=B$ where $A$ is symmetric positive definite, F04AGF must be preceded by a call to F03AEF which computes a Cholesky factorization of $A$ as $A=L{L}^{\mathrm{T}}$, where $L$ is lower triangular. The columns $x$ of the solution $X$ are found by forward and backward substitution in $Ly=b$ and ${L}^{\mathrm{T}}x=y$, where $b$ is a column of the right-hand sides.

## 4  References

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

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 1$.
2:     IR – INTEGERInput
On entry: $r$, the number of right-hand sides.
3:     A(LDA,N) – REAL (KIND=nag_wp) arrayInput
On entry: the upper triangle of the $n$ by $n$ positive definite symmetric matrix $A$, and the subdiagonal elements of its Cholesky factor $L$, as returned by F03AEF.
On exit: is used as internal workspace, but is restored on exit.
4:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F04AGF is called.
Constraint: ${\mathbf{LDA}}\ge {\mathbf{N}}$.
5:     P(N) – REAL (KIND=nag_wp) arrayInput
On entry: the reciprocals of the diagonal elements of $L$, as returned by F03AEF.
On exit: is used as internal workspace, but is restored on exit.
6:     B(LDB,IR) – REAL (KIND=nag_wp) arrayInput
On entry: the $n$ by $r$ right-hand side matrix $B$. See also Section 8.
7:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F04AGF is called.
Constraint: ${\mathbf{LDB}}\ge {\mathbf{N}}$.
8:     X(LDX,IR) – REAL (KIND=nag_wp) arrayOutput
On exit: the $n$ by $r$ solution matrix $X$. See also Section 8.
9:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which F04AGF is called.
Constraint: ${\mathbf{LDX}}\ge {\mathbf{N}}$.

## 6  Error Indicators and Warnings

If an error is detected in an input parameter F04AGF will act as if a soft noisy exit has been requested (see Section 3.3.4 in the Essential Introduction).

## 7  Accuracy

The accuracy of the computed solutions depends on the conditioning of the original matrix. For a detailed error analysis see page 39 of Wilkinson and Reinsch (1971).

The time taken is approximately proportional to ${n}^{2}r$.

## 9  Example

This example solves the set of linear equations $AX=B$ where
 $A= 5 7 6 5 7 10 8 7 6 8 10 9 5 7 9 10 and B= 23 32 33 31 .$

### 9.1  Program Text

Program Text (f04agfe.f90)

### 9.2  Program Data

Program Data (f04agfe.d)

### 9.3  Program Results

Program Results (f04agfe.r)