# NAG CPP Interfacenagcpp::sparse::direct_real_gen_matmul (f11mk)

## 1Purpose

direct_real_gen_matmul computes a matrix-matrix or transposed matrix-matrix product involving a real, square, sparse nonsymmetric matrix stored in compressed column (Harwell–Boeing) format.

## 2Specification

```#include "f11/nagcpp_f11mk.hpp"
```
```template <typename ICOLZP, typename IROWIX, typename A, typename B, typename C>

void function direct_real_gen_matmul(const string trans, const double alpha, const ICOLZP &icolzp, const IROWIX &irowix, const A &a, const B &b, const double beta, C &&c, OptionalF11MK opt)```
```template <typename ICOLZP, typename IROWIX, typename A, typename B, typename C>

void function direct_real_gen_matmul(const string trans, const double alpha, const ICOLZP &icolzp, const IROWIX &irowix, const A &a, const B &b, const double beta, C &&c)```

## 3Description

direct_real_gen_matmul computes either the matrix-matrix product $C←\alpha AB+\beta C$, or the transposed matrix-matrix product $C←\alpha {A}^{\mathrm{T}}B+\beta C$, according to the value of the argument trans, where $A$ is a real $n$ by $n$ sparse nonsymmetric matrix, of arbitrary sparsity pattern with $\mathit{nnz}$ nonzero elements, $B$ and $C$ are $n$ by $m$ real dense matrices. The matrix $A$ is stored in compressed column (Harwell–Boeing) storage format. The array a stores all nonzero elements of $A$, while arrays icolzp and irowix store the compressed column indices and row indices of $A$ respectively.
None.

## 5Arguments

1: $\mathbf{trans}$string Input
On entry: specifies whether or not the matrix $A$ is transposed.
${\mathbf{trans}}=\text{'N'}$
$\alpha AB+\beta C$ is computed.
${\mathbf{trans}}=\text{'T'}$
$\alpha {A}^{\mathrm{T}}B+\beta C$ is computed.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'T'}$.
2: $\mathbf{alpha}$double Input
On entry: $\alpha$, the scalar factor in the matrix multiplication.
3: $\mathbf{icolzp}\left({\mathbf{n}}+1\right)$types::f77_integer array Input
On entry: the new column index array of sparse matrix $A$. See Section 2.1.3 in the F11 Chapter Introduction.
4: $\mathbf{irowix}\left(\mathrm{vl_asize}\right)$types::f77_integer array Input
On entry: the row index array of sparse matrix $A$. See Section 2.1.3 in the F11 Chapter Introduction.
5: $\mathbf{a}\left(\mathrm{vl_asize}\right)$double array Input
On entry: the array of nonzero values in the sparse matrix $A$.
6: $\mathbf{b}\left({\mathbf{n}},{\mathbf{m}}\right)$double array Input
On entry: the $n$ by $m$ matrix $B$.
7: $\mathbf{beta}$double Input
On entry: the scalar factor $\beta$.
8: $\mathbf{c}\left({\mathbf{n}},{\mathbf{m}}\right)$double array Input/Output
On entry: the $n$ by $m$ matrix $C$.
On exit: $C$ is overwritten by $\alpha AB+\beta C$ or $\alpha {A}^{\mathrm{T}}B+\beta C$ depending on the value of trans.
9: $\mathbf{opt}$OptionalF11MK Input/Output
Optional parameter container, derived from Optional.

1: $\mathbf{n}$
$n$, the order of the matrix $A$
2: $\mathbf{m}$
$m$, the number of columns of matrices $B$ and $C$

## 6Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=1$
On entry, ${\mathbf{m}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{m}}\ge 0$.
$\mathbf{errorid}=1$
On entry, ${\mathbf{n}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{n}}\ge 0$.
$\mathbf{errorid}=1$
On entry, ${\mathbf{trans}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{trans}}=\text{"N"}\text{​ or ​}\text{"T"}$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument has $⟨\mathit{\text{value}}⟩$ dimensions.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument was a vector of size $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
The size for the supplied array could not be ascertained.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a $⟨\mathit{\text{value}}⟩$ x $⟨\mathit{\text{value}}⟩$ array.
Supplied argument has $⟨\mathit{\text{value}}⟩$ dimensions.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a $⟨\mathit{\text{value}}⟩$ x $⟨\mathit{\text{value}}⟩$ array.
Supplied argument was a $⟨\mathit{\text{value}}⟩$ x $⟨\mathit{\text{value}}⟩$ array.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a $⟨\mathit{\text{value}}⟩$ x $⟨\mathit{\text{value}}⟩$ array.
Not all of the sizes for the supplied array could be ascertained.
$\mathbf{errorid}=10602$
On entry, the raw data component of $⟨\mathit{\text{value}}⟩$ is null.
$\mathbf{errorid}=10603$
On entry, unable to ascertain a value for $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10604$
On entry, the data in $⟨\mathit{\text{value}}⟩$ is stored in $⟨\mathit{\text{value}}⟩$ Major Order.
The data was expected to be in $⟨\mathit{\text{value}}⟩$ Major Order.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.

Not applicable.

## 8Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.