NAG CL Interface
x04cdc (print_​matrix_​real_​packed_​comp)

Settings help

CL Name Style:


1 Purpose

x04cdc prints a double triangular matrix stored in a packed one-dimensional array.

2 Specification

#include <nag.h>
void  x04cdc (Nag_OrderType order, Nag_UploType uplo, Nag_DiagType diag, Integer n, const double a[], const char *form, const char *title, Nag_LabelType labrow, const char *rlabs[], Nag_LabelType labcol, const char *clabs[], Integer ncols, Integer indent, const char *outfile, NagError *fail)
The function may be called by the names: x04cdc, nag_file_print_matrix_real_packed_comp or nag_pack_real_mat_print_comp.

3 Description

x04cdc prints a double triangular matrix stored in packed form, using a format specifier supplied by you. The matrix is output to the file specified by outfile or, by default, to standard output.

4 References

None.

5 Arguments

1: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: uplo Nag_UploType Input
On entry: indicates the type of the matrix to be printed
uplo=Nag_Lower
The matrix is lower triangular
uplo=Nag_Upper
The matrix is upper triangular
Constraint: uplo=Nag_Lower or Nag_Upper.
3: diag Nag_DiagType Input
On entry: indicates whether the diagonal elements of the matrix are to be printed.
diag=Nag_NonRefDiag
The diagonal elements of the matrix are not referenced and not printed.
diag=Nag_UnitDiag
The diagonal elements of the matrix are not referenced, but are assumed all to be unity, and are printed as such.
diag=Nag_NonUnitDiag
The diagonal elements of the matrix are referenced and printed.
Constraint: diag=Nag_NonRefDiag, Nag_UnitDiag or Nag_NonUnitDiag.
4: n Integer Input
On entry: the order of the matrix to be printed.
If n is less than 1, x04cdc will exit immediately after printing title; no row or column labels are printed.
5: a[dim] const double Input
Note: the dimension, dim, of the array a must be at least max(1,n×(n+1)/2).
On entry: the matrix to be printed. Note that a must have space for the diagonal elements of the matrix, even if these are not stored.
The storage of elements Aij depends on the order and uplo arguments as follows:
if order=Nag_ColMajor and uplo=Nag_Upper,
Aij is stored in a[(j-1)×j/2+i-1], for ij;
if order=Nag_ColMajor and uplo=Nag_Lower,
Aij is stored in a[(2n-j)×(j-1)/2+i-1], for ij;
if order=Nag_RowMajor and uplo=Nag_Upper,
Aij is stored in a[(2n-i)×(i-1)/2+j-1], for ij;
if order=Nag_RowMajor and uplo=Nag_Lower,
Aij is stored in a[(i-1)×i/2+j-1], for ij.
If diag=Nag_UnitDiag, the diagonal elements of A are assumed to be 1, and are not referenced; the same storage scheme is used whether diag=Nag_NonUnitDiag or diag=Nag_UnitDiag.
6: form const char * Input
On entry: a valid C format code. This should be of the form %[flag]ww.pp[format​ ​indicator], where ww.pp indicates that up to two digits may be used to specify the field width and precision respectively. Only % and format​ ​indicator must be present. flag can be one of -, +, <space> or # and format​ ​indicator can be e, E, f, g or G. Thus, possible formats include %f, %+23.15G, %.6e. form is used to print elements of the matrix A.
In addition, x04cdc chooses its own format code when form is NULL or form='*'.
form=NULL
x04cdc will choose a format code such that numbers will be printed with either a %8.4f, a %11.4f or a %13.4e format. The %8.4f code is chosen if the sizes of all the matrix elements to be printed lie between 0.001 and 1.0. The %11.4f code is chosen if the sizes of all the matrix elements to be printed lie between 0.001 and 9999.9999. Otherwise the %13.4e code is chosen.
form='*'
x04cdc will choose a format code such that numbers will be printed to as many significant digits as are necessary to distinguish between neighbouring machine numbers. Thus any two numbers that are stored with different internal representations should look different on output.
Constraint: form must be of the form %[flag]ww.pp[format​ ​indicator].
7: title const char * Input
On entry: a title to be printed above the matrix, or name of the matrix.
If title=NULL, no title (and no blank line) will be printed.
If title contains more than ncols characters, the contents of title will be wrapped onto more than one line, with the break after ncols characters.
Any trailing blank characters in title are ignored.
8: labrow Nag_LabelType Input
On entry: indicates the type of labelling to be applied to the rows of the matrix.
labrow=Nag_NoLabels
Prints no row labels.
labrow=Nag_IntegerLabels
Prints integer row labels.
labrow=Nag_CharacterLabels
Prints character labels, which must be supplied in array rlabs.
Constraint: labrow=Nag_NoLabels, Nag_IntegerLabels or Nag_CharacterLabels.
9: rlabs[dim] const char * Input
Note: the dimension, dim, of the array rlabs must be at least
  • n when labrow=Nag_CharacterLabels;
  • otherwise rlabs may be NULL.
On entry: if labrow=Nag_CharacterLabels, rlabs must contain labels for the rows of the matrix; otherwise rlabs is not referenced and may be NULL.
Labels are right-justified when output, in a field which is as wide as necessary to hold the longest row label. Note that this field width is subtracted from the number of usable columns, ncols.
10: labcol Nag_LabelType Input
On entry: indicates the type of labelling to be applied to the columns of the matrix.
labcol=Nag_NoLabels
Prints no column labels.
labcol=Nag_IntegerLabels
Prints integer column labels.
labcol=Nag_CharacterLabels
Prints character labels, which must be supplied in array clabs.
Constraint: labcol=Nag_NoLabels, Nag_IntegerLabels or Nag_CharacterLabels.
11: clabs[dim] const char * Input
Note: the dimension, dim, of the array clabs must be at least
  • n when labcol=Nag_CharacterLabels;
  • otherwise clabs may be NULL.
On entry: if labcol=Nag_CharacterLabels, clabs must contain labels for the columns of the matrix; otherwise clabs is not referenced and may be NULL.
Labels are right-justified when output. Any label that is too long for the column width, which is determined by form, is truncated.
12: ncols Integer Input
On entry: the maximum output record length. If the number of columns of the matrix is too large to be accommodated in ncols characters, the matrix will be printed in parts, containing the largest possible number of matrix columns, and each part separated by a blank line.
ncols must be large enough to hold at least one column of the matrix using the format specifier in form. If a value less than or equal to 0 or greater than 132 is supplied for ncols, then the value 80 is used instead.
13: indent Integer Input
On entry: the number of columns by which the matrix (and any title and labels) should be indented. The effective value of ncols is reduced by indent columns. If a value less than 0 or greater than ncols is supplied for indent, the value 0 is used instead.
14: outfile const char * Input
On entry: the name of a file to which output will be directed. If outfile is NULL the output will be directed to standard output.
15: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_COL_WIDTH
value is not wide enough to hold at least one matrix column. ncols=value and indent=value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_INVALID_FORMAT
The string value has not been recognized as a valid format.
NE_NOT_APPEND_FILE
Cannot open file value for appending.
NE_NOT_CLOSE_FILE
Cannot close file value.
NE_NOT_WRITE_FILE
Cannot open file value for writing.

7 Accuracy

Not applicable.

8 Parallelism and Performance

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

9 Further Comments

None.

10 Example

None.