|
NAG[x04cbc] NAG[nag_gen_real_mat_print_comp] - Print real general matrix (comprehensive)
|
|
Calling Sequence
x04cbc(matrix_type, diag, m, n, a, format, title, labrow, rlabs, labcol, clabs, ncols, indent, 'outfile'=outfile, 'fail'=fail)
nag_gen_real_mat_print_comp(. . .)
Parameters
|
matrix_type - String;
|
|
|
On entry: indicates the part of the matrix to be printed.
|
|
The whole of the rectangular matrix.
|
|
The lower triangle of the matrix, or the lower trapezium if the matrix has more rows than columns.
|
|
The upper triangle of the matrix, or the upper trapezium if the matrix has more columns than rows.
|
|
Constraint: "Nag_GeneralMatrix", "Nag_LowerMatrix" or "Nag_UpperMatrix". .
|
|
|
diag - String;
|
|
|
On entry: unless , diag must specify whether the diagonal elements of the matrix are to be printed.
|
|
The diagonal elements of the matrix are not referenced and not printed.
|
|
The diagonal elements of the matrix are not referenced, but are assumed all to be unity, and are printed as such.
|
|
The diagonal elements of the matrix are referenced and printed.
|
|
If , then diag must be set to .
|
|
|
m - integer;
n - integer;
|
|
|
On entry: the number of rows and columns of the band matrix, respectively, to be printed.
|
|
If either m or n is less than 1, nag_gen_real_mat_print_comp (x04cbc) will exit immediately after printing title; no row or column labels are printed.
|
|
|
a - Matrix(1..dim1, 1..dim2, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
On entry: the matrix to be printed. Only the elements that will be referred to, as specified by arguments matrix_type and diag, need be set.
|
|
|
format - character;
|
|
|
In addition, nag_gen_real_mat_print_comp (x04cbc) chooses its own format code when format is NULL or .
|
|
If , nag_gen_real_mat_print_comp (x04cbc) 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: format must be of the form . .
|
|
|
title - character;
|
|
|
On entry: a title to be printed above the matrix.
|
|
If , 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.
|
|
|
labrow - String;
|
|
|
On entry: indicates the type of labelling to be applied to the rows of the matrix.
|
|
Prints no row labels.
|
|
Prints integer row labels.
|
|
Prints character labels, which must be supplied in array rlabs.
|
|
Constraint: "Nag_NoLabels", "Nag_IntegerLabels" or "Nag_CharacterLabels". .
|
|
|
rlabs - Vector(1..dim, datatype=string);
|
|
|
Note: the dimension, dim, of the array rlabs must be at least
|
|
when ;
|
|
otherwise.
|
|
On entry: if , must contain labels for the rows of the matrix.
|
|
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.
|
|
|
labcol - String;
|
|
|
On entry: indicates the type of labelling to be applied to the columns of the matrix.
|
|
Prints no column labels.
|
|
Prints integer column labels.
|
|
Prints character labels, which must be supplied in array clabs.
|
|
Constraint: "Nag_NoLabels", "Nag_IntegerLabels" or "Nag_CharacterLabels". .
|
|
|
clabs - Vector(1..dim, datatype=string);
|
|
|
Note: the dimension, dim, of the array clabs must be at least
|
|
when ;
|
|
otherwise.
|
|
On entry: if , must contain labels for the columns of the matrix.
|
|
Labels are right-justified when output. Any label that is too long for the column width, which is determined by format, is truncated.
|
|
|
ncols - integer;
|
|
|
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 format. If a value less than or equal to 0 or greater than 132 is supplied for ncols, then the value 80 is used instead.
|
|
|
indent - integer;
|
|
|
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.
|
|
|
'outfile'=outfile - character; (optional)
|
|
|
On entry: The name of a file to which intermediate or diagnostic output should be appended. If a value is not provided for this parameter then the behaviour of this routine is platform dependent. Usually all output will be suppressed, however on some platforms output will be produced and will be displayed in the Maple session.
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_gen_real_mat_print_comp (x04cbc) prints a real matrix .
|
|
Description
|
|
nag_gen_real_mat_print_comp (x04cbc) prints a double matrix, or part of it, using a format specifier supplied by you. The matrix is output to the file specified by outfile or, by default, to standard output.
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_COL_WIDTH"
is not wide enough to hold at least one matrix column. , .
"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 consult NAG for assistance.
"NE_INVALID_FORMAT"
The string , has not been recognized as a valid format.
"NE_NOT_APPEND_FILE"
Cannot open file for appending.
"NE_NOT_CLOSE_FILE"
Cannot close file .
"NE_NOT_WRITE_FILE"
Cannot open file for writing.
|
|
|
Examples
|
|
>
|
matrix_type := "Nag_GeneralMatrix":
diag := "Nag_NonUnitDiag":
m := 3:
n := 5:
format := "%6.3f":
title := "Original data":
labrow := "Nag_IntegerLabels":
labcol := "Nag_IntegerLabels":
ncols := 90:
indent := 0:
a := Matrix([[1, 0.999, 0.987, 0.936, 0.802],
[0.994, 0.989, 0.963, 0.891, 0.731],
[0.903, 0.885, 0.823, 0.694, 0.467]], datatype=float[8]):
rlabs := Vector(0, datatype=string):
clabs := Vector(0, datatype=string):
try
FileTools[Remove]("matout.txt"):
catch "file does not exist":
end try:
NAG:-x04cbc(matrix_type, diag, m, n, a, format, title, labrow, labcol, ncols, indent, 'rlabs' = rlabs, 'clabs' = clabs, 'outfile'="matout.txt"):
do
outstring := FileTools[Text][ReadLine]("matout.txt"):
if outstring = 0 or outstring = NULL then break; end if:
printf("%s\n",outstring): od:
FileTools[Text][Close]("matout.txt"):
#
|
Original data
1 2 3 4 5
1 1.000 0.999 0.987 0.936 0.802
2 0.994 0.989 0.963 0.891 0.731
3 0.903 0.885 0.823 0.694 0.467
|
|