# NAG CL Interfacef01dfc (real_​tri_​matmul)

Settings help

CL Name Style:

## 1Purpose

f01dfc performs one of the matrix-matrix operations
 $C←αAB+βC, C←αATB+βC, C←αABT+βC or C←αATBT+βC,$
where $A$, $B$ and $C$ are real triangular matrices, and $\alpha$ and $\beta$ are real scalars.

## 2Specification

 #include
 void f01dfc (Nag_UploType uplo, Nag_TransType transa, Nag_TransType transb, Integer n, double alpha, const double a[], Integer pda, const double b[], Integer pdb, double beta, double c[], Integer pdc, NagError *fail)
The function may be called by the names: f01dfc or nag_matop_real_tri_matmul.

## 3Description

f01dfc computes the triangular matrix product $C=\alpha \mathrm{op}\left(A\right)\mathrm{op}\left(B\right)+\beta C$, where $\mathrm{op}\left(A\right)$, $\mathrm{op}\left(B\right)$, and $C$ are all upper triangular or all lower triangular matrices, and where $\mathrm{op}\left(A\right)$ is either $A$ or ${A}^{\mathrm{T}}$.

None.

## 5Arguments

1: $\mathbf{uplo}$Nag_UploType Input
On entry: specifies whether $C$ is upper or lower triangular.
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
$C$ is upper triangular.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
$C$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
2: $\mathbf{transa}$Nag_TransType Input
On entry: specifies whether the operation involves $A$ or ${A}^{\mathrm{T}}$.
${\mathbf{transa}}=\mathrm{Nag_NoTrans}$
The operation involves $A$.
${\mathbf{transa}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$
The operation involves ${A}^{\mathrm{T}}$.
Constraint: ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$.
3: $\mathbf{transb}$Nag_TransType Input
On entry: specifies whether the operation involves $B$ or ${B}^{\mathrm{T}}$.
${\mathbf{transb}}=\mathrm{Nag_NoTrans}$
The operation involves $B$.
${\mathbf{transb}}=\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$
The operation involves ${B}^{\mathrm{T}}$.
Constraint: ${\mathbf{transb}}=\mathrm{Nag_NoTrans}$, $\mathrm{Nag_Trans}$ or $\mathrm{Nag_ConjTrans}$.
4: $\mathbf{n}$Integer Input
On entry: $n$, the order of the triangular matrices $A$, $B$, and $C$.
Constraint: ${\mathbf{n}}\ge 0$.
5: $\mathbf{alpha}$double Input
On entry: the scalar $\alpha$.
6: $\mathbf{a}\left[\mathit{dim}\right]$const double Input
Note: the dimension, dim, of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{n}}\right)$.
On entry: the $n×n$ triangular matrix $A$.
${A}_{ij}$ is stored in ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$.
• If ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
• if ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $A$ is upper triangular and the elements of the array below the diagonal are not referenced;
• if ${\mathbf{transa}}=\mathrm{Nag_Trans}$ or ${\mathbf{transa}}=\mathrm{Nag_ConjTrans}$, $A$ is lower triangular and the elements of the array above the diagonal are not referenced.
• If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$
• if ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $A$ is lower triangular and the elements of the array above the diagonal are not referenced;
• if ${\mathbf{transa}}=\mathrm{Nag_Trans}$ or ${\mathbf{transa}}=\mathrm{Nag_ConjTrans}$, $A$ is upper triangular and the elements of the array below the diagonal are not referenced.
7: $\mathbf{pda}$Integer Input
On entry: the stride separating row elements of the matrix $A$ in the array a.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
8: $\mathbf{b}\left[\mathit{dim}\right]$const double Input
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)$.
On entry: the $n×n$ triangular matrix $B$.
${B}_{ij}$ is stored in ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$.
• If ${\mathbf{uplo}}=\mathrm{Nag_Upper}$,
• if ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $B$ is upper triangular and the elements of the array below the diagonal are not referenced;
• if ${\mathbf{transa}}=\mathrm{Nag_Trans}$ or ${\mathbf{transa}}=\mathrm{Nag_ConjTrans}$, $B$ is lower triangular and the elements of the array above the diagonal are not referenced.
• If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$
• if ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $B$ is lower triangular and the elements of the array above the diagonal are not referenced;
• if ${\mathbf{transa}}=\mathrm{Nag_Trans}$ or ${\mathbf{transa}}=\mathrm{Nag_ConjTrans}$, $B$ is upper triangular and the elements of the array below the diagonal are not referenced.
9: $\mathbf{pdb}$Integer Input
On entry: the stride separating row elements of the matrix $B$ in the array b.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10: $\mathbf{beta}$double Input
On entry: the scalar $\beta$.
11: $\mathbf{c}\left[\mathit{dim}\right]$double Input/Output
Note: the dimension, dim, of the array c must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc}}×{\mathbf{n}}\right)$.
${C}_{ij}$ is stored in ${\mathbf{c}}\left[\left(j-1\right)×{\mathbf{pdc}}+i-1\right]$.
• If ${\mathbf{uplo}}=\mathrm{Nag_Upper}$, $C$ is upper triangular and the elements of the array corresponding to the lower triangular part of $C$ are not referenced.
• If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, $C$ is lower triangular and the elements of the array corresponding to the upper triangular part of $C$ are not referenced.
On entry: the $n×n$ matrix $C$.
If ${\mathbf{beta}}=0$, c need not be set.
On exit: the triangular part of $C$, as specified by uplo, is updated.
12: $\mathbf{pdc}$Integer Input
On entry: the stride separating row elements of the matrix $C$ in the array c.
Constraint: ${\mathbf{pdc}}\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 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
NE_INT_2
On entry, ${\mathbf{pda}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdb}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdb}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry, ${\mathbf{pdc}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdc}}\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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

Not applicable.

## 8Parallelism and Performance

f01dfc 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 lower triangular matrix $A$, the upper triangular matrix $B$, and the square matrix $C$. It then calls f01dfc to compute the triangular matrix product $C=\alpha {A}^{\mathrm{T}}B+\beta C$, updating the upper triangular part of $C$.

### 10.1Program Text

Program Text (f01dfce.c)

### 10.2Program Data

Program Data (f01dfce.d)

### 10.3Program Results

Program Results (f01dfce.r)