# NAG CL Interfacef01dgc (real_​tri_​matmul_​inplace)

Settings help

CL Name Style:

## 1Purpose

f01dgc 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

 #include
 void f01dgc (Nag_SideType side, Nag_UploType uplo, Nag_TransType transa, Integer n, double alpha, const double a[], Integer pda, double b[], Integer pdb, NagError *fail)
The function may be called by the names: f01dgc or nag_matop_real_tri_matmul_inplace.

## 3Description

f01dgc 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}$Nag_SideType Input
On entry: specifies whether $B$ is operated on from the left or the right.
${\mathbf{side}}=\mathrm{Nag_LeftSide}$
$B$ is pre-multiplied from the left.
${\mathbf{side}}=\mathrm{Nag_RightSide}$
$B$ is post-multiplied from the right.
Constraint: ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_RightSide}$.
2: $\mathbf{uplo}$Nag_UploType Input
On entry: specifies whether $A$ and $B$ are upper or lower triangular.
${\mathbf{uplo}}=\mathrm{Nag_Upper}$
$A$ and $B$ are upper triangular.
${\mathbf{uplo}}=\mathrm{Nag_Lower}$
$A$ and $B$ are lower triangular.
Constraint: ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ or $\mathrm{Nag_Lower}$.
3: $\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}$.
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}$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}$, the upper triangular part of $A$ must be stored and the elements of the array below the diagonal are not referenced.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, the lower triangular part of $A$ must be stored and the elements of the array above 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]$double Input/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)$.
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}$, the upper triangular part of $B$ must be stored and the elements of the array below the diagonal are not referenced.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$, the lower triangular part of $B$ must be stored and 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.
${B}_{ij}$ is stored in ${\mathbf{b}}\left[\left(j-1\right)×{\mathbf{pdb}}+i-1\right]$.
If ${\mathbf{uplo}}=\mathrm{Nag_Upper}$ and ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $B$ is upper triangular and the elements of the array below the diagonal are not set.
If ${\mathbf{uplo}}=\mathrm{Nag_Lower}$ and ${\mathbf{transa}}=\mathrm{Nag_NoTrans}$, $B$ is lower triangular and the elements of the array above the diagonal are not set.
If ${\mathbf{transa}}=\mathrm{Nag_Trans}$ or ${\mathbf{transa}}=\mathrm{Nag_ConjTrans}$, $B$ is a general matrix.
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{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)$.
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

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

### 10.1Program Text

Program Text (f01dgce.c)

### 10.2Program Data

Program Data (f01dgce.d)

### 10.3Program Results

Program Results (f01dgce.r)