hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_real_tri_pack (f01za)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_matop_real_tri_pack (f01za) copies a real triangular matrix stored in a packed one-dimensional array into an unpacked two-dimensional array, or vice versa.

Syntax

[a, b, ifail] = f01za(job, uplo, diag, a, b, 'n', n)
[a, b, ifail] = nag_matop_real_tri_pack(job, uplo, diag, a, b, 'n', n)

Description

nag_matop_real_tri_pack (f01za) unpacks a triangular matrix stored in a vector into a two-dimensional array, or packs a triangular matrix stored in a two-dimensional array into a vector. The matrix is packed by column. This function is intended for possible use in conjunction with functions from Chapters F07 and F08 where some functions that use triangular matrices store them in the packed form described below.

References

None.

Parameters

Compulsory Input Parameters

1:     job – string (length ≥ 1)
Specifies whether the triangular matrix is to be packed or unpacked.
job='P' (Pack)
The matrix is to be packed into array b.
job='U' (Unpack)
The matrix is to be unpacked into array a.
Constraint: job='P' or 'U'.
2:     uplo – string (length ≥ 1)
Specifies the type of the matrix to be copied
uplo='L' (Lower)
The matrix is lower triangular. In this case the packed vector holds, or will hold on exit, the matrix elements in the following order: 1,1,2,1,,n,1, 2,2,3,2,,n,2, etc..
uplo='U' (Upper)
The matrix is upper triangular. In this case the packed vector holds, or will hold on exit, the matrix elements in the following order: 1,1, 1,2, 2,2, 1,3, 2,3, 3,3, 1,4, etc..
Constraint: uplo='L' or 'U'.
3:     diag – string (length ≥ 1)
Must specify whether the diagonal elements of the matrix are to be copied.
diag='B' (Blank)
The diagonal elements of the matrix are not referenced and not copied.
diag='U' (Unit diagonal)
The diagonal elements of the matrix are not referenced, but are assumed all to be unity, and are copied as such.
diag='N' (Non-unit diagonal)
The diagonal elements of the matrix are referenced and copied.
Constraint: diag='B', 'U' or 'N'.
4:     aldan – double array
lda, the first dimension of the array, must satisfy the constraint ldan.
If job='P', then the leading n by n part of a must contain the matrix to be copied, stored in unpacked form, in the upper or lower triangle depending on argument uplo. The opposite triangle of a is not referenced and need not be assigned.
5:     bn×n+1/2 – double array
If job='U', then b must contain the triangular matrix packed by column.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array a and the second dimension of the array a. (An error is raised if these dimensions are not equal.)
n, the number of rows and columns of the triangular matrix.
Constraint: n>0.

Output Parameters

1:     aldan – double array
If job='U', then the leading n by n part of array a contains the copied matrix, stored in unpacked form, in the upper or lower triangle depending on argument uplo. The opposite triangle of a is not referenced.
2:     bn×n+1/2 – double array
If job='P', then b contains the triangular matrix packed by column.
Note that b must have space for the diagonal elements of the matrix, even if these are not stored.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,job'P' or 'U'.
   ifail=2
On entry,uplo'L' or 'U'.
   ifail=3
On entry,diag'N', 'U' or 'B'.
   ifail=4
On entry,n<1.
   ifail=5
On entry,lda<n.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

This example reads in a triangular matrix A, and copies it to the packed matrix B.
function f01za_example


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

a = [1.1, 1.2, 1.3, 1.4;
     0,   2.2, 2.3, 2.4;
     0,   0,   3.3, 3.4;
     0,   0,   0,   4.4];
b = zeros(10, 1);

job  = 'Pack';
uplo = 'U';
diag = 'N';

[A, ap, ifail] = f01za(job, uplo, diag, a, b);

disp('Unpacked Matrix A:');
disp(A);
fprintf('\n');
disp('Packed Vector ap:');
disp(ap);


f01za example results

Unpacked Matrix A:
    1.1000    1.2000    1.3000    1.4000
         0    2.2000    2.3000    2.4000
         0         0    3.3000    3.4000
         0         0         0    4.4000


Packed Vector ap:
    1.1000
    1.2000
    2.2000
    1.3000
    2.3000
    3.3000
    1.4000
    2.4000
    3.4000
    4.4000


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015