|
NAG[x04dbc] NAG[nag_gen_complx_mat_print_comp] - Print complex general matrix (comprehensive)
|
|
Calling Sequence
x04dbc(matrix_type, diag, m, n, a, cmplxform, format, title, labrow, labcol, ncols, indent, 'rlabs'=rlabs, 'clabs'=clabs, 'outfile'=outfile, 'fail'=fail)
nag_gen_complx_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_complx_mat_print_comp (x04dbc) will exit immediately after printing title; no row or column labels are printed.
|
|
|
a - Matrix(1..dim1, 1..dim2, datatype=complex[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.
|
|
|
cmplxform - String;
|
|
|
On entry: indicates how the value of format is to be used to print matrix elements.
|
|
The format code in format is assumed to contain a single real edit-descriptor which is to be used to print the real and imaginary parts of each complex number one above the other. Each row of the matrix is separated by a blank line, and any row labels are attached only to the real parts. This option means that about twice as many columns can be fitted into ncols characters than if any other cmplxform option is used. A typical value of format for this cmplxform option might be %11.4e.
|
|
The format code in format is assumed to contain a single edit-descriptor such as %13.4f, * or NULL, which is used to print the real and imaginary parts of each complex number separated by a comma, and surrounded by brackets. Thus a matrix element printed with this cmplxform option might look like this: .
|
|
Constraint: "Nag_AboveForm", "Nag_BracketForm" or "Nag_DirectForm". .
|
|
|
format - character;
|
|
|
On entry: a valid C format code. This should be of the form , where indicates that up to two digits may be used to specify the field width and precision respectively. Only % and must be present. can be one of , , or # and can be e, E, f, g or G. Thus, possible formats include %f, %-11.4G, %.6e. format is used in conjunction with argument cmplxform, to print elements of the matrix .
|
|
In addition, nag_gen_complx_mat_print_comp (x04dbc) chooses its own format code when format is NULL or .
|
|
If , nag_gen_complx_mat_print_comp (x04dbc) 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.
|
|
More complicated values of format, to print a complex number in a desired form, may be used. See the description of argument cmplxform above for more details.
|
|
|
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". .
|
|
|
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". .
|
|
|
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.
|
|
|
'rlabs'=rlabs - Vector(1..dim, datatype=string); (optional)
|
|
|
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.
|
|
|
'clabs'=clabs - Vector(1..dim, datatype=string); (optional)
|
|
|
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.
|
|
|
'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_complx_mat_print_comp (x04dbc) prints a complex matrix .
|
|
Description
|
|
nag_gen_complx_mat_print_comp (x04dbc) prints a complex 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:
cmplxform := "Nag_BracketForm":
format := "%8.4f":
title := "Original data":
labrow := "Nag_IntegerLabels":
labcol := "Nag_IntegerLabels":
ncols := 80:
indent := 0:
a := Matrix([[1 +0*I , 0.999 -0.04*I , 0.987 -0.159*I , 0.9360000000000001 -0.352*I , 0.802 -0.597*I ], [0.994 -0.111*I , 0.989 -0.151*I , 0.963 -0.268*I , 0.891 -0.454*I , 0.731 -0.6820000000000001*I ], [0.903 -0.43*I , 0.885 -0.466*I , 0.823 -0.5679999999999999*I , 0.694 -0.72*I , 0.467 -0.884*I ]], datatype=complex[8]):
rlabs := Vector(0, datatype=string):
clabs := Vector(0, datatype=string):
try
FileTools[Remove]("matout.txt"):
catch "file does not exist":
end try:
NAG:-x04dbc(matrix_type, diag, m, n, a, cmplxform, 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
1 ( 1.0000, 0.0000) ( 0.9990, -0.0400) ( 0.9870, -0.1590)
2 ( 0.9940, -0.1110) ( 0.9890, -0.1510) ( 0.9630, -0.2680)
3 ( 0.9030, -0.4300) ( 0.8850, -0.4660) ( 0.8230, -0.5680)
4 5
1 ( 0.9360, -0.3520) ( 0.8020, -0.5970)
2 ( 0.8910, -0.4540) ( 0.7310, -0.6820)
3 ( 0.6940, -0.7200) ( 0.4670, -0.8840)
|
|