NAG FL Interface
f01zaf (real_​tri_​pack)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Subroutine f01zaf ( job, uplo, diag, n, a, lda, b, ifail)
Integer, Intent (In) :: n, lda
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (Inout) :: a(lda,n), b((n*(n+1))/2)
Character (1), Intent (In) :: job, uplo, diag
C Header Interface
#include <nag.h>
void  f01zaf_ (const char *job, const char *uplo, const char *diag, const Integer *n, double a[], const Integer *lda, double b[], Integer *ifail, const Charlen length_job, const Charlen length_uplo, const Charlen length_diag)
The routine may be called by the names f01zaf or nagf_matop_real_tri_pack.

3 Description

f01zaf 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 routine is intended for possible use in conjunction with routines from Chapters F06, F07 and F08 where some routines that use triangular matrices store them in the packed form described below.

4 References

None.

5 Arguments

1: job Character(1) Input
On entry: 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 Character(1) Input
On entry: 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 Character(1) Input
On entry: 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: n Integer Input
On entry: n, the number of rows and columns of the triangular matrix.
Constraint: n>0.
5: a(lda,n) Real (Kind=nag_wp) array Input/Output
On entry: if job='P', 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.
On exit: if job='U', 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.
6: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01zaf is called.
Constraint: ldan.
7: b((n×(n+1))/2) Real (Kind=nag_wp) array Input/Output
On entry: if job='U', b must contain the triangular matrix packed by column.
On exit: if job='P', 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.
8: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, job'P' or 'U': job=value.
ifail=2
On entry, uplo'U' or 'L': uplo=value.
ifail=3
On entry, diag'N', 'U' or 'B': diag=value.
ifail=4
On entry, n=value.
Constraint: n1.
ifail=5
On entry, lda=value and n=value.
Constraint: ldan.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f01zaf is not threaded in any implementation.

9 Further Comments

None.

10 Example

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

10.1 Program Text

Program Text (f01zafe.f90)

10.2 Program Data

Program Data (f01zafe.d)

10.3 Program Results

Program Results (f01zafe.r)