# NAG Library Routine Document

## 1Purpose

f06wbf (dtfsm) performs one of the matrix-matrix operations
 $B←αA-1B , B←αA-TB , B←αBA-1 or B←αBA-T ,$
where $A$ is a real triangular matrix stored in Rectangular Full Packed (RFP) format, $B$ is an $m$ by $n$ real matrix, and $\alpha$ is a real scalar. ${A}^{-\mathrm{T}}$ denotes ${\left({A}^{\mathrm{T}}\right)}^{-1}$ or equivalently ${\left({A}^{-1}\right)}^{\mathrm{T}}$.
No test for singularity or near-singularity of $A$ is included in this routine. Such tests must be performed before calling this routine.

## 2Specification

Fortran Interface
 Subroutine f06wbf ( side, uplo, diag, m, n, a, b, ldb)
 Integer, Intent (In) :: m, n, ldb Real (Kind=nag_wp), Intent (In) :: alpha, a(*) Real (Kind=nag_wp), Intent (Inout) :: b(ldb,*) Character (1), Intent (In) :: transr, side, uplo, trans, diag
#include nagmk26.h
 void f06wbf_ ( const char *transr, const char *side, const char *uplo, const char *trans, const char *diag, const Integer *m, const Integer *n, const double *alpha, const double a[], double b[], const Integer *ldb, const Charlen length_transr, const Charlen length_side, const Charlen length_uplo, const Charlen length_trans, const Charlen length_diag)
The routine may be called by its LAPACK name dtfsm.

## 3Description

f06wbf (dtfsm) solves (for $X$) a triangular linear system of one of the forms
 $AX=αB , ATX=αB , XA=αB or XAT=αB ,$
where $A$ is a real triangular matrix stored in RFP format, $B$, $X$ are $m$ by $n$ real matrices, and $\alpha$ is a real scalar. The RFP storage format is described in Section 3.3.3 in the F07 Chapter Introduction.

## 4References

Gustavson F G, Waśniewski J, Dongarra J J and Langou J (2010) Rectangular full packed format for Cholesky's algorithm: factorization, solution, and inversion ACM Trans. Math. Software 37, 2

## 5Arguments

1:     $\mathbf{transr}$ – Character(1)Input
On entry: specifies whether the RFP representation of $A$ is normal or transposed.
${\mathbf{transr}}=\text{'N'}$
The matrix $A$ is stored in normal RFP format.
${\mathbf{transr}}=\text{'T'}$
The matrix $A$ is stored in transposed RFP format.
Constraint: ${\mathbf{transr}}=\text{'N'}$ or $\text{'T'}$.
2:     $\mathbf{side}$ – Character(1)Input
On entry: specifies whether $B$ is operated on from the left or the right, or similarly whether $A$ (or its transpose) appears to the left or right of the solution matrix in the linear system to be solved.
${\mathbf{side}}=\text{'L'}$
$B$ is pre-multiplied from the left. The system to be solved has the form $AX=\alpha B$ or ${A}^{\mathrm{T}}X=\alpha B$.
${\mathbf{side}}=\text{'R'}$
$B$ is post-multiplied from the right. The system to be solved has the form $XA=\alpha B$ or $X{A}^{\mathrm{T}}=\alpha B$.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
3:     $\mathbf{uplo}$ – Character(1)Input
On entry: specifies whether $A$ is upper or lower triangular.
${\mathbf{uplo}}=\text{'U'}$
$A$ is upper triangular.
${\mathbf{uplo}}=\text{'L'}$
$A$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
4:     $\mathbf{trans}$ – Character(1)Input
On entry: specifies whether the operation involves ${A}^{-1}$ or ${A}^{-\mathrm{T}}$, i.e., whether or not $A$ is transposed in the linear system to be solved.
${\mathbf{trans}}=\text{'N'}$
The operation involves ${A}^{-1}$, i.e., $A$ is not transposed.
${\mathbf{trans}}=\text{'T'}$
The operation involves ${A}^{-\mathrm{T}}$, i.e., $A$ is transposed.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'T'}$.
5:     $\mathbf{diag}$ – Character(1)Input
On entry: specifies whether $A$ has nonunit or unit diagonal elements.
${\mathbf{diag}}=\text{'N'}$
The diagonal elements of $A$ are stored explicitly.
${\mathbf{diag}}=\text{'U'}$
The diagonal elements of $A$ are assumed to be $1$, the corresponding elements of a are not referenced.
Constraint: ${\mathbf{diag}}=\text{'N'}$ or $\text{'U'}$.
6:     $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of rows of the matrix $B$.
Constraint: ${\mathbf{m}}\ge 0$.
7:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of columns of the matrix $B$.
Constraint: ${\mathbf{n}}\ge 0$.
8:     $\mathbf{alpha}$ – Real (Kind=nag_wp)Input
On entry: the scalar $\alpha$.
9:     $\mathbf{a}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×\left({\mathbf{m}}+1\right)/2\right)$ if ${\mathbf{side}}=\text{'L'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$ if ${\mathbf{side}}=\text{'R'}$.
On entry: $A$, the $m$ by $m$ triangular matrix $A$ if ${\mathbf{side}}=\text{'L'}$ or the $n$ by $n$ triangular matrix $A$ if ${\mathbf{side}}=\text{'R'}$, stored in RFP format (as specified by transr). The storage format is described in detail in Section 3.3.3 in the F07 Chapter Introduction. If ${\mathbf{alpha}}=0.0$, a is not referenced.
10:   $\mathbf{b}\left({\mathbf{ldb}},*\right)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array b must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $m$ by $n$ matrix $B$.
If ${\mathbf{alpha}}=0$, b need not be set.
On exit: the updated matrix $B$, or similarly the solution matrix $X$.
11:   $\mathbf{ldb}$ – IntegerInput
On entry: the first dimension of the array b as declared in the (sub)program from which f06wbf (dtfsm) is called.
Constraint: ${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.

None.

Not applicable.

## 8Parallelism and Performance

f06wbf (dtfsm) 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 reads in the lower triangular part of a symmetric matrix $A$ which it converts to RFP format. It also reads in $\alpha$ and a $6$ by $4$ matrix $B$ and then performs the matrix-matrix operation $B←\alpha {A}^{-1}B$.

### 10.1Program Text

Program Text (f06wbfe.f90)

### 10.2Program Data

Program Data (f06wbfe.d)

### 10.3Program Results

Program Results (f06wbfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017