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_dtpttr (f01vc)

## Purpose

nag_matop_dtpttr (f01vc) unpacks a real triangular matrix, stored in a standard packed format array, to a full format array.

## Syntax

[a, info] = f01vc(uplo, n, ap)
[a, info] = nag_matop_dtpttr(uplo, n, ap)

## Description

nag_matop_dtpttr (f01vc) unpacks a real $n$ by $n$ triangular matrix $A$, stored in an array of length $n\left(n+1\right)/2$, to conventional storage in a full format array. This function is intended for possible use in conjunction with functions from Chapters F07, F08 and F16 where some functions use triangular matrices stored in the packed form. Packed storage format is described in Packed storage in the F07 Chapter Introduction.

None.

## Parameters

### Compulsory Input Parameters

1:     $\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'}$.
2:     $\mathrm{n}$int64int32nag_int scalar
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
3:     $\mathrm{ap}\left({\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$ – double array
The $n$ by $n$ triangular matrix $A$, packed by columns.
More precisely,
• if ${\mathbf{uplo}}=\text{'U'}$, the upper triangle of $A$ must be stored with element ${A}_{ij}$ in ${\mathbf{ap}}\left(i+j\left(j-1\right)/2\right)$ for $i\le j$;
• if ${\mathbf{uplo}}=\text{'L'}$, the lower triangle of $A$ must be stored with element ${A}_{ij}$ in ${\mathbf{ap}}\left(i+\left(2n-j\right)\left(j-1\right)/2\right)$ for $i\ge j$.

None.

### Output Parameters

1:     $\mathrm{a}\left(\mathit{lda},:\right)$ – double array
The first dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a will be ${\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.
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 packed by columns and unpacks it to full format.
```function f01vc_example

fprintf('f01vc example results\n\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 unpacked matrix
fprintf('\n');
[ifail] = x04cb('g', 'x', ap, 'f5.2', 'Packed matrix a:', 'i', ...
{''}, 'i', {''}, int64(80), int64(0));
% Convert to unpacked form
[a, info] = f01vc(uplo, n, ap);
% Print the packed vector
fprintf('\n');
[ifail] = x04cb(uplo, 'n', a, 'f5.2', 'Unpacked matrix ap:', 'i', ...
{''}, 'n', {''}, int64(80), int64(0));

```
```f01vc example results

Packed matrix a:
1
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

Unpacked matrix ap:
1  1.10 1.20 1.30 1.40
2       2.20 2.30 2.40
3            3.30 3.40
4                 4.40
```