Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_matop_ztrttf (f01vf)

## Purpose

nag_matop_ztrttf (f01vf) copies a complex triangular matrix, stored in a full format array, to a Rectangular Full Packed (RFP) format array.

## Syntax

[ar, info] = f01vf(transr, uplo, a, 'n', n)
[ar, info] = nag_matop_ztrttf(transr, uplo, a, 'n', n)

## Description

nag_matop_ztrttf (f01vf) packs a complex $n$ by $n$ triangular matrix $A$, stored conventionally in a full format array, into RFP format. This function is intended for possible use in conjunction with functions from Chapters F07 and F16 where some functions that use triangular matrices store them in RFP format. The RFP storage format is described in Rectangular Full Packed (RFP) Storage in the F07 Chapter Introduction.

## References

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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{transr}$ – string (length ≥ 1)
Specifies whether the normal RFP representation of $A$ or its conjugate transpose is stored.
${\mathbf{transr}}=\text{'N'}$
The RFP representation of the matrix $A$ is stored.
${\mathbf{transr}}=\text{'C'}$
The conjugate transpose of the RFP representation of the matrix $A$ is stored.
Constraint: ${\mathbf{transr}}=\text{'N'}$ or $\text{'C'}$.
2:     $\mathrm{uplo}$ – string (length ≥ 1)
Specifies whether $A$ is upper or lower triangular.
${\mathbf{uplo}}=\text{'U'}$
$A$ is upper triangular.
${\mathbf{uplo}}=\text{'L'}$
$A$ is lower triangular.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
3:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a must be at least ${\mathbf{n}}$.
The 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.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the first dimension of the array a.
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{ar}\left({\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$ – complex array
The upper or lower $n$ by $n$ triangular matrix $A$ (as specified by uplo) in either normal or transposed RFP format (as specified by transr). The storage format is described in Rectangular Full Packed (RFP) Storage in the F07 Chapter Introduction.
2:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

Not applicable.

None.

## Example

This example reads in a triangular matrix and copies it to RFP format.
```function f01vf_example

fprintf('f01vf example results\n\n');

uplo   = 'u';
transr = 'n';
a = [1.1000 + 1.1000i,  1.2000 + 1.2000i,  1.3000 + 1.3000i,  1.4000 + 1.4000i;
0,              2.2000 + 2.2000i,  2.3000 + 2.3000i,  2.4000 + 2.4000i;
0,                  0,             3.3000 + 3.3000i,  3.4000 + 3.4000i;
0,                  0,                  0,            4.4000 + 4.4000i];
% Print the unpacked matrix
fprintf('\n');
[ifail] = x04db(uplo, 'n', a, 'b', 'f5.2', 'Unpacked matrix a:', 'i', ...
'i', int64(80), int64(0));
% Convert to Rectangular Full Packed form
[ar, info] = f01vf(transr, uplo, a);
% Print the packed vector
fprintf('\n');
[ifail] = x04db('g', 'x', ar, 'b', 'f5.2', 'RFP Packed Array ar:', 'i', ...
'n', int64(80), int64(0));

n = int64(size(a,1));
k = int64(n/2);
q = n - k;
if transr=='N' || transr=='n'
lar1 = 2*k + 1;
lar2 = q;
else
lar1 = q;
lar2 = 2*k + 1;
end

ar = reshape(ar,lar1,lar2);

fprintf('\n');
[ifail] = x04db('g', 'x', ar, 'b', 'f5.2', ...
'RFP Packed Array ar (graphical representation):', 'i', ...
'i', int64(80), int64(0), 'm', lar1, 'n', lar2);

```
```f01vf example results

Unpacked matrix a:
1             2             3             4
1  ( 1.10, 1.10) ( 1.20, 1.20) ( 1.30, 1.30) ( 1.40, 1.40)
2                ( 2.20, 2.20) ( 2.30, 2.30) ( 2.40, 2.40)
3                              ( 3.30, 3.30) ( 3.40, 3.40)
4                                            ( 4.40, 4.40)

RFP Packed Array ar:
1  ( 1.30, 1.30)
2  ( 2.30, 2.30)
3  ( 3.30, 3.30)
4  ( 1.10,-1.10)
5  ( 1.20,-1.20)
6  ( 1.40, 1.40)
7  ( 2.40, 2.40)
8  ( 3.40, 3.40)
9  ( 4.40, 4.40)
10  ( 2.20,-2.20)

RFP Packed Array ar (graphical representation):
1             2
1  ( 1.30, 1.30) ( 1.40, 1.40)
2  ( 2.30, 2.30) ( 2.40, 2.40)
3  ( 3.30, 3.30) ( 3.40, 3.40)
4  ( 1.10,-1.10) ( 4.40, 4.40)
5  ( 1.20,-1.20) ( 2.20,-2.20)
```