# NAG FL Interfacef01dgf (real_​tri_​matmul_​inplace)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f01dgf performs one of the matrix-matrix operations
 $B←αAB, B←αATB, B←αBA or B←αBAT,$
where $A$ and $B$ are real triangular matrices, and $\alpha$ is a real scalar.

## 2Specification

Fortran Interface
 Subroutine f01dgf ( side, uplo, n, a, lda, b, ldb,
 Integer, Intent (In) :: n, lda, ldb Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: alpha, a(lda,*) Real (Kind=nag_wp), Intent (Inout) :: b(ldb,*) Character (1), Intent (In) :: side, uplo, transa
#include <nag.h>
 void f01dgf_ (const char *side, const char *uplo, const char *transa, const Integer *n, const double *alpha, const double a[], const Integer *lda, double b[], const Integer *ldb, Integer *ifail, const Charlen length_side, const Charlen length_uplo, const Charlen length_transa)
The routine may be called by the names f01dgf or nagf_matop_real_tri_matmul_inplace.

## 3Description

f01dgf computes the matrix product $B=\alpha AB$ or $B=\alpha BA$ for two upper triangular or two lower triangular matrices. The storage method for matrices $A$ and $B$ must match (e.g., $A$ and $B$ must both be upper triangular or lower triangular matrices). When the transpose of the input matrix $A$ is used during computation, the solution matrix $B$ is a general matrix. Otherwise, the solution matrix $B$ is a triangular matrix with the storage method identified by the input argument uplo.
None.

## 5Arguments

1: $\mathbf{side}$Character(1) Input
On entry: specifies whether $B$ is operated on from the left or the right.
${\mathbf{side}}=\text{'L'}$
$B$ is pre-multiplied from the left.
${\mathbf{side}}=\text{'R'}$
$B$ is post-multiplied from the right.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
2: $\mathbf{uplo}$Character(1) Input
On entry: specifies whether $A$ and $B$ are upper or lower triangular.
${\mathbf{uplo}}=\text{'U'}$
$A$ and $B$ are upper triangular.
${\mathbf{uplo}}=\text{'L'}$
$A$ and $B$ are lower triangular.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
3: $\mathbf{transa}$Character(1) Input
On entry: specifies whether the operation involves $A$ or ${A}^{\mathrm{T}}$.
${\mathbf{transa}}=\text{'N'}$
The operation involves $A$.
${\mathbf{transa}}=\text{'T'}$ or $\text{'C'}$
The operation involves ${A}^{\mathrm{T}}$.
Constraint: ${\mathbf{transa}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
4: $\mathbf{n}$Integer Input
On entry: $n$, the order of the triangular matrices $A$ and $B$.
Constraint: ${\mathbf{n}}\ge 0$.
5: $\mathbf{alpha}$Real (Kind=nag_wp) Input
On entry: the scalar $\alpha$.
6: $\mathbf{a}\left({\mathbf{lda}},*\right)$Real (Kind=nag_wp) array Input
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $n×n$ triangular matrix $A$.
• If ${\mathbf{uplo}}=\text{'U'}$, $A$ is upper triangular and the elements of the array below the diagonal are not referenced.
• If ${\mathbf{uplo}}=\text{'L'}$, $A$ is lower triangular and the elements of the array above the diagonal are not referenced.
7: $\mathbf{lda}$Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01dgf is called.
Constraint: ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
8: $\mathbf{b}\left({\mathbf{ldb}},*\right)$Real (Kind=nag_wp) array Input/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 $n×n$ triangular matrix $B$.
• If ${\mathbf{uplo}}=\text{'U'}$, $B$ is upper triangular and the elements of the array below the diagonal are not referenced.
• If ${\mathbf{uplo}}=\text{'L'}$, $B$ is lower triangularand the elements of the array above the diagonal are not referenced.
If ${\mathbf{alpha}}=0$, b need not be set.
On exit: $B$ is overwritten.
• If ${\mathbf{transa}}=\text{'N'}$,
• if ${\mathbf{uplo}}=\text{'U'}$, $B$ is upper triangular and the elements of the array below the diagonal are not set.
• if ${\mathbf{uplo}}=\text{'L'}$, $B$ is lower triangular and the elements of the array above the diagonal are not set.
• If ${\mathbf{transa}}=\text{'T'}$ or $\text{'C'}$, $B$ is a general matrix.
9: $\mathbf{ldb}$Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f01dgf is called.
Constraint: ${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10: $\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{side}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{uplo}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{transa}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{transa}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
${\mathbf{ifail}}=4$
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
${\mathbf{ifail}}=5$
On entry, ${\mathbf{lda}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{ldb}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
${\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.

Not applicable.

## 8Parallelism and Performance

f01dgf 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 two upper triangular matrices $A$ and $B$. It then calls f01dgf to compute the triangular matrix product $B=\alpha {A}^{\mathrm{T}}B$.

### 10.1Program Text

Program Text (f01dgfe.f90)

### 10.2Program Data

Program Data (f01dgfe.d)

### 10.3Program Results

Program Results (f01dgfe.r)