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)

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'job='P' (Pack)
The matrix is to be packed into array b.
job = 'U'job='U' (Unpack)
The matrix is to be unpacked into array a.
Constraint: job = 'P'job='P' or 'U''U'.
2:     uplo – string (length ≥ 1)
Specifies the type of the matrix to be copied
uplo = 'L'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)(1,1),(2,1),,(n,1), (2,2),(3,2),,(n,2), etc..
uplo = 'U'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,1), (1,2)(1,2), (2,2)(2,2), (1,3)(1,3), (2,3)(2,3), (3,3)(3,3), (1,4)(1,4), etc..
Constraint: uplo = 'L'uplo='L' or 'U''U'.
3:     diag – string (length ≥ 1)
Must specify whether the diagonal elements of the matrix are to be copied.
diag = 'B'diag='B' (Blank)
The diagonal elements of the matrix are not referenced and not copied.
diag = 'U'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'diag='N' (Non-unit diagonal)
The diagonal elements of the matrix are referenced and copied.
Constraint: diag = 'B'diag='B', 'U''U' or 'N''N'.
4:     a(lda,n) – double array
lda, the first dimension of the array, must satisfy the constraint ldanldan.
If job = 'P'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 parameter uplo. The opposite triangle of a is not referenced and need not be assigned.
5:     b((n × (n + 1)) / 2(n×(n+1))/2) – double array
If job = 'U'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.)
nn, the number of rows and columns of the triangular matrix.
Constraint: n > 0n>0.

Input Parameters Omitted from the MATLAB Interface

lda

Output Parameters

1:     a(lda,n) – double array
ldanldan.
If job = 'U'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 parameter uplo. The opposite triangle of a is not referenced.
2:     b((n × (n + 1)) / 2(n×(n+1))/2) – double array
If job = 'P'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 = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,job'P'job'P' or 'U''U'.
  ifail = 2ifail=2
On entry,uplo'L'uplo'L' or 'U''U'.
  ifail = 3ifail=3
On entry,diag'N'diag'N', 'U''U' or 'B''B'.
  ifail = 4ifail=4
On entry,n < 1n<1.
  ifail = 5ifail=5
On entry,lda < nlda<n.

Accuracy

Not applicable.

Further Comments

None.

Example

function nag_matop_real_tri_pack_example
job = 'Pack';
uplo = 'U';
diag = '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);
[aOut, bOut, ifail] = nag_matop_real_tri_pack(job, uplo, diag, a, b)
 

aOut =

    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


bOut =

    1.1000
    1.2000
    2.2000
    1.3000
    2.3000
    3.3000
    1.4000
    2.4000
    3.4000
    4.4000


ifail =

                    0


function f01za_example
job = 'Pack';
uplo = 'U';
diag = '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);
[aOut, bOut, ifail] = f01za(job, uplo, diag, a, b)
 

aOut =

    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


bOut =

    1.1000
    1.2000
    2.2000
    1.3000
    2.3000
    3.3000
    1.4000
    2.4000
    3.4000
    4.4000


ifail =

                    0



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–2013