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_dtpttf (f01vj)

## Purpose

nag_matop_dtpttf (f01vj) copies a real triangular matrix stored in packed format to Rectangular Full Packed (RFP) format. The RFP storage format is described in Section [Rectangular Full Packed (RFP) Storage] in the F07 Chapter Introduction and the packed storage format is described in Section [Packed storage] in the F07 Chapter Introduction.

## Syntax

[arf, info] = f01vj(transr, uplo, n, ap)
[arf, info] = nag_matop_dtpttf(transr, uplo, n, ap)

## Description

nag_matop_dtpttf (f01vj) copies a real n$n$ by n$n$ triangular matrix, A$A$, stored packed format, to RFP format. This function is intended for possible use in conjunction with functions from Chapter F07 where some functions that use triangular matrices store them in RFP format.

None.

## Parameters

### Compulsory Input Parameters

1:     transr – string (length ≥ 1)
Specifies whether the RFP representation of A$A$ is normal or transposed.
transr = 'N'${\mathbf{transr}}=\text{'N'}$
The matrix A$A$ is stored in normal RFP format.
transr = 'T'${\mathbf{transr}}=\text{'T'}$
The matrix A$A$ is stored in transposed RFP format.
Constraint: transr = 'N'${\mathbf{transr}}=\text{'N'}$ or 'T'$\text{'T'}$.
2:     uplo – string (length ≥ 1)
Specifies whether A$A$ is upper or lower triangular.
uplo = 'U'${\mathbf{uplo}}=\text{'U'}$
A$A$ is upper triangular.
uplo = 'L'${\mathbf{uplo}}=\text{'L'}$
A$A$ is lower triangular.
Constraint: uplo = 'U'${\mathbf{uplo}}=\text{'U'}$ or 'L'$\text{'L'}$.
3:     n – int64int32nag_int scalar
n$n$, the order of the matrix A$A$.
Constraint: n0${\mathbf{n}}\ge 0$.
4:     ap(n × (n + 1) / 2${\mathbf{n}}×\left({\mathbf{n}}+1\right)/2$) – double array
The n$n$ by n$n$ triangular matrix A$A$, packed by columns.
More precisely,
• if uplo = 'U'${\mathbf{uplo}}=\text{'U'}$, the upper triangle of A$A$ must be stored with element Aij${A}_{ij}$ in ap(i + j(j1) / 2)${\mathbf{ap}}\left(i+j\left(j-1\right)/2\right)$ for ij$i\le j$;
• if uplo = 'L'${\mathbf{uplo}}=\text{'L'}$, the lower triangle of A$A$ must be stored with element Aij${A}_{ij}$ in ap(i + (2nj)(j1) / 2)${\mathbf{ap}}\left(i+\left(2n-j\right)\left(j-1\right)/2\right)$ for ij$i\ge j$.

None.

None.

### Output Parameters

1:     arf(n × (n + 1) / 2${\mathbf{n}}×\left({\mathbf{n}}+1\right)/2$) – double array
The triangular matrix A$A$ in RFP format, as described in Section [Rectangular Full Packed (RFP) Storage] in the F07 Chapter Introduction.
2:     info – int64int32nag_int scalar
info = 0${\mathbf{info}}=0$ unless the function detects an error (see Section [Error Indicators and Warnings]).

## Error Indicators and Warnings

info = i${\mathbf{info}}=-i$
If info = i${\mathbf{info}}=-i$, parameter i$i$ had an illegal value on entry. The parameters are numbered as follows:
1: transr, 2: uplo, 3: n, 4: ap, 5: arf, 6: info.

Not applicable.

None.

## Example

```function nag_matop_dtpttf_example
transr = 'n';
uplo   = 'u';
n      = int64(4);
ap = [1.1; 1.2; 2.2; 1.3; 2.3; 3.3; 1.4; 2.4; 3.4; 4.4];
% Print the packed array
fprintf('\n');
[ifail] = ...
nag_file_print_matrix_real_gen_comp('g', 'x', ap, 'f5.2', 'Packed array ap:', 'i', ...
{''}, 'n', {''}, int64(80), int64(0));
% Convert to Rectangular Full Packed form
[arf, info] = nag_matop_dtpttf(transr, uplo, n, ap);
% Print the Rectangular Full Packed array
fprintf('\n');
[ifail] = ...
nag_file_print_matrix_real_gen_comp('g', 'x', arf, 'f5.2', 'RFP packed array arf:', 'i', ...
{''}, 'n', {''}, int64(80), int64(0))
```
```

Packed array ap:
1  1.10
2  1.20
3  2.20
4  1.30
5  2.30
6  3.30
7  1.40
8  2.40
9  3.40
10  4.40

RFP packed array arf:
1  1.30
2  2.30
3  3.30
4  1.10
5  1.20
6  1.40
7  2.40
8  3.40
9  4.40
10  2.20

ifail =

0

```
```function f01vj_example
transr = 'n';
uplo   = 'u';
n      = int64(4);
ap = [1.1; 1.2; 2.2; 1.3; 2.3; 3.3; 1.4; 2.4; 3.4; 4.4];
% Print the packed array
fprintf('\n');
[ifail] = x04cb('g', 'x', ap, 'f5.2', 'Packed array ap:', 'i', ...
{''}, 'n', {''}, int64(80), int64(0));
% Convert to Rectangular Full Packed form
[arf, info] = f01vj(transr, uplo, n, ap);
% Print the Rectangular Full Packed array
fprintf('\n');
[ifail] = x04cb('g', 'x', arf, 'f5.2', 'RFP packed array arf:', 'i', ...
{''}, 'n', {''}, int64(80), int64(0))
```
```

Packed array ap:
1  1.10
2  1.20
3  2.20
4  1.30
5  2.30
6  3.30
7  1.40
8  2.40
9  3.40
10  4.40

RFP packed array arf:
1  1.30
2  2.30
3  3.30
4  1.10
5  1.20
6  1.40
7  2.40
8  3.40
9  4.40
10  2.20

ifail =

0

```