# NAG Library Function Document

## 1Purpose

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

## 2Specification

 #include #include
 void nag_ztfsm (Nag_OrderType order, Nag_RFP_Store transr, Nag_SideType side, Nag_UploType uplo, Nag_TransType trans, Nag_DiagType diag, Integer m, Integer n, Complex alpha, const Complex ar[], Complex b[], Integer pdb, NagError *fail)

## 3Description

nag_ztfsm (f16zlc) solves (for $X$) a triangular linear system of one of the forms
 $AX=αB , AHX=αB , XA=αB or XAH=αB ,$
where $A$ is a complex triangular matrix stored in RFP format, $B$, $X$ are $m$ by $n$ complex matrices, and $\alpha$ is a complex 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{order}$Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:    $\mathbf{transr}$Nag_RFP_StoreInput
On entry: specifies whether the normal RFP representation of $A$ or its conjugate transpose is stored.
${\mathbf{transr}}=\mathrm{Nag_RFP_Normal}$
The matrix $A$ is stored in normal RFP format.
${\mathbf{transr}}=\mathrm{Nag_RFP_ConjTrans}$
The conjugate transpose of the RFP representation of the matrix $A$ is stored.
Constraint: ${\mathbf{transr}}=\mathrm{Nag_RFP_Normal}$ or $\mathrm{Nag_RFP_ConjTrans}$.
3:    $\mathbf{side}$Nag_SideTypeInput
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}}=\mathrm{Nag_LeftSide}$
$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}}=\mathrm{Nag_RightSide}$
$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}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_RightSide}$.
4:    $\mathbf{uplo}$Nag_UploTypeInput
On entry: specifies whether $A$ is upper or lower triangular.
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
$A$ is upper triangular.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
$A$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
5:    $\mathbf{trans}$Nag_TransTypeInput
On entry: specifies whether the operation involves ${A}^{-1}$ or ${A}^{-\mathrm{H}}$, i.e., whether or not $A$ is transpose conjugated in the linear system to be solved.
${\mathbf{trans}}=\mathrm{Nag_NoTrans}$
The operation involves ${A}^{-1}$, i.e., $A$ is not transpose conjugated.
${\mathbf{trans}}=\mathrm{Nag_ConjTrans}$
The operation involves ${A}^{-\mathrm{H}}$, i.e., $A$ is transpose conjugated.
Constraint: ${\mathbf{trans}}=\mathrm{Nag_NoTrans}$ or $\mathrm{Nag_ConjTrans}$.
6:    $\mathbf{diag}$Nag_DiagTypeInput
On entry: specifies whether $A$ has nonunit or unit diagonal elements.
${\mathbf{diag}}=\mathrm{Nag_NonUnitDiag}$
The diagonal elements of $A$ are stored explicitly.
${\mathbf{diag}}=\mathrm{Nag_UnitDiag}$
The diagonal elements of $A$ are assumed to be $1$, the corresponding elements of ar are not referenced.
Constraint: ${\mathbf{diag}}=\mathrm{Nag_NonUnitDiag}$ or $\mathrm{Nag_UnitDiag}$.
7:    $\mathbf{m}$IntegerInput
On entry: $m$, the number of rows of the matrix $B$.
Constraint: ${\mathbf{m}}\ge 0$.
8:    $\mathbf{n}$IntegerInput
On entry: $n$, the number of columns of the matrix $B$.
Constraint: ${\mathbf{n}}\ge 0$.
9:    $\mathbf{alpha}$ComplexInput
On entry: the scalar $\alpha$.
10:  $\mathbf{ar}\left[\mathit{dim}\right]$const ComplexInput
Note: the dimension, dim, of the array ar must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×\left({\mathbf{m}}+1\right)/2\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$.
On entry: the $m$ by $m$ triangular matrix $A$ if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or the $n$ by $n$ triangular matrix $A$ if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, 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$, ar is not referenced.
11:  $\mathbf{b}\left[\mathit{dim}\right]$ComplexInput/Output
Note: the dimension, dim, of the array b must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdb}}×{\mathbf{n}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pdb}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
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$.
If ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${B}_{ij}$ is stored in ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$.
If ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${B}_{ij}$ is stored in ${\mathbf{b}}\left[\left(i-1\right)×{\mathbf{pdb}}+j-1\right]$.
12:  $\mathbf{pdb}$IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
13:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INT_2
On entry, ${\mathbf{pdb}}=〈\mathit{\text{value}}〉$, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry, ${\mathbf{pdb}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8Parallelism and Performance

nag_ztfsm (f16zlc) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

## 10Example

This example reads in the upper triangular part of a symmetric matrix $A$ which it converts to RFP format. It also reads in $\alpha$ and a $4$ by $3$ matrix $B$ and then performs the matrix-matrix operation $B←\alpha {A}^{-1}B$.

### 10.1Program Text

Program Text (f16zlce.c)

### 10.2Program Data

Program Data (f16zlce.d)

### 10.3Program Results

Program Results (f16zlce.r)

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