NAG FL Interfacef04lhf (real_​blkdiag_​fac_​solve)

▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

1Purpose

f04lhf calculates the approximate solution of a set of real linear equations with multiple right-hand sides, $AX=B$ or ${A}^{\mathrm{T}}X=B$, where $A$ is an almost block-diagonal matrix which has been factorized by f01lhf.

2Specification

Fortran Interface
 Subroutine f04lhf ( n, a, lena, b, ldb, ir,
 Integer, Intent (In) :: n, nbloks, blkstr(3,nbloks), lena, pivot(n), ldb, ir Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: a(lena) Real (Kind=nag_wp), Intent (Inout) :: b(ldb,ir) Character (1), Intent (In) :: trans
#include <nag.h>
 void f04lhf_ (const char *trans, const Integer *n, const Integer *nbloks, const Integer blkstr[], const double a[], const Integer *lena, const Integer pivot[], double b[], const Integer *ldb, const Integer *ir, Integer *ifail, const Charlen length_trans)
The routine may be called by the names f04lhf or nagf_linsys_real_blkdiag_fac_solve.

3Description

f04lhf solves a set of real linear equations $AX=B$ or ${A}^{\mathrm{T}}X=B$, where $A$ is almost block-diagonal. $A$ must first be factorized by f01lhf. f04lhf then computes $X$ by forward and backward substitution over the blocks.

4References

Diaz J C, Fairweather G and Keast P (1983) Fortran packages for solving certain almost block diagonal linear systems by modified alternate row and column elimination ACM Trans. Math. Software 9 358–375

5Arguments

1: $\mathbf{trans}$Character(1) Input
On entry: specifies the equations to be solved.
${\mathbf{trans}}=\text{'N'}$
Solve $AX=B$.
${\mathbf{trans}}=\text{'T'}$
Solve ${A}^{\mathrm{T}}X=B$.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'T'}$.
2: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}>0$.
3: $\mathbf{nbloks}$Integer Input
On entry: the total number of blocks of the matrix $A$, as supplied to f04lhf.
Constraint: $0<{\mathbf{nbloks}}\le {\mathbf{n}}$.
4: $\mathbf{blkstr}\left(3,{\mathbf{nbloks}}\right)$Integer array Input
On entry: information which describes the block structure of $A$, as supplied to f04lhf.
5: $\mathbf{a}\left({\mathbf{lena}}\right)$Real (Kind=nag_wp) array Input
On entry: the elements in the factorization of $A$, as returned by f04lhf.
6: $\mathbf{lena}$Integer Input
On entry: the dimension of the array a as declared in the (sub)program from which f04lhf is called.
Constraint: ${\mathbf{lena}}\ge \sum _{k=1}^{{\mathbf{nbloks}}}{\mathbf{blkstr}}\left(1,k\right)×{\mathbf{blkstr}}\left(2,k\right)$.
7: $\mathbf{pivot}\left({\mathbf{n}}\right)$Integer array Input
On entry: details of the interchanges in the factorization, as returned by f04lhf.
8: $\mathbf{b}\left({\mathbf{ldb}},{\mathbf{ir}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: the $n×r$ right-hand side matrix $B$.
On exit: b is overwritten by the $n×r$ solution matrix $X$.
9: $\mathbf{ldb}$Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f04lhf is called.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{n}}$.
10: $\mathbf{ir}$Integer Input
On entry: $r$, the number of right-hand sides.
Constraint: ${\mathbf{ir}}>0$.
11: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{ir}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ir}}\ge 1$.
On entry, $K=⟨\mathit{\text{value}}⟩$, ${\mathbf{blkstr}}\left(2,K\right)=⟨\mathit{\text{value}}⟩$, ${\mathbf{blkstr}}\left(3,K\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(1,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(2,K\right)-{\mathbf{blkstr}}\left(3,K\right)\le {\mathbf{blkstr}}\left(1,K\right)$.
On entry, $K=⟨\mathit{\text{value}}⟩$, ${\mathbf{blkstr}}\left(2,K\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(1,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(2,K\right)\ge {\mathbf{blkstr}}\left(1,K\right)$.
On entry, $K=⟨\mathit{\text{value}}⟩$, ${\mathbf{blkstr}}\left(3,K\right)=⟨\mathit{\text{value}}⟩$, ${\mathbf{blkstr}}\left(3,K-1\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(2,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(3,K\right)+{\mathbf{blkstr}}\left(3,K-1\right)\ge {\mathbf{blkstr}}\left(2,K\right)$.
On entry, $K=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(1,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(1,K\right)\ge 1$.
On entry, $K=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(2,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(2,K\right)\ge 1$.
On entry, $K=⟨\mathit{\text{value}}⟩$ and ${\mathbf{blkstr}}\left(3,K\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{blkstr}}\left(3,K\right)\ge 0$.
On entry, ${\mathbf{ldb}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{n}}$.
On entry, lena is too small. ${\mathbf{lena}}=⟨\mathit{\text{value}}⟩$. Minimum possible dimension: $⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 1$.
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nbloks}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge {\mathbf{nbloks}}$.
On entry, ${\mathbf{nbloks}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nbloks}}\ge 1$.
On entry, the following equality does not hold: ${\mathbf{blkstr}}\left(2,1\right)+\mathrm{sum}\left({\mathbf{blkstr}}\left(2,k\right)-{\mathbf{blkstr}}\left(3,k-1\right):k=2,{\mathbf{nbloks}}\right)={\mathbf{n}}$.
On entry, the following equality does not hold: $\mathrm{sum}\left({\mathbf{blkstr}}\left(1,k\right):k=1,{\mathbf{nbloks}}\right)={\mathbf{n}}$.
On entry, the following inequality was not satisfied for: $J=⟨\mathit{\text{value}}⟩$. $\mathrm{sum}\left({\mathbf{blkstr}}\left(2,k\right)-{\mathbf{blkstr}}\left(3,k\right):k=1,J\right)\le$ $\mathrm{sum}\left({\mathbf{blkstr}}\left(1,k\right):k=1,J\right)\le$ ${\mathbf{blkstr}}\left(2,1\right)+\mathrm{sum}\left({\mathbf{blkstr}}\left(2,k\right)-{\mathbf{blkstr}}\left(3,k-1\right):k=2,J\right)$.
On entry, ${\mathbf{trans}}\ne \text{'N'}$ or $\text{'T'}$: ${\mathbf{trans}}=⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7Accuracy

The accuracy of the computed solution depends on the conditioning of the original matrix $A$.

8Parallelism and Performance

f04lhf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

10Example

This example solves the set of linear equations $Ax=b$ where
 $A=( -1.00 -0.98 -0.79 -0.15 -1.00 -0.25 -0.87 0.35 0.78 0.31 -0.85 0.89 -0.69 -0.98 -0.76 -0.82 0.12 -0.01 0.75 0.32 -1.00 -0.53 -0.83 -0.98 -0.58 0.04 0.87 0.38 -1.00 -0.21 -0.93 -0.84 0.37 -0.94 -0.96 -1.00 -0.99 -0.91 -0.28 0.90 0.78 -0.93 -0.76 0.48 -0.87 -0.14 -1.00 -0.59 -0.99 0.21 -0.73 -0.48 -0.93 -0.91 0.10 -0.89 -0.68 -0.09 -0.58 -0.21 0.85 -0.39 0.79 -0.71 0.39 -0.99 -0.12 -0.75 0.17 -1.37 1.29 -1.59 1.10 -1.63 -1.01 -0.27 0.08 0.61 0.54 -0.41 0.16 -0.46 -0.67 0.56 -0.99 0.16 -0.16 0.98 -0.24 -0.41 0.40 -0.93 0.70 0.43 0.71 -0.97 -0.60 -0.30 0.18 -0.47 -0.98 -0.73 0.07 0.04 -0.25 -0.92 -0.52 -0.46 -0.58 0.89 -0.94 -0.54 -1.00 -0.36 )$
and
 $b=( -2.92 -1.17 -1.30 -1.17 -2.10 -4.51 -1.71 -4.59 -4.19 -0.93 -3.31 0.52 -0.12 -0.05 -0.98 -2.07 -2.73 -1.95 )$
The exact solution is
 $x=(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)T.$

10.1Program Text

Program Text (f04lhfe.f90)

10.2Program Data

Program Data (f04lhfe.d)

10.3Program Results

Program Results (f04lhfe.r)