NAG C Library Function Document

nag_gen_real_mat_print (x04cac)


nag_gen_real_mat_print (x04cac) is an easy-to-use function to print a real matrix .


#include <nag.h>
#include <nagx04.h>
void  nag_gen_real_mat_print (Nag_OrderType order, Nag_MatrixType matrix, Nag_DiagType diag, Integer m, Integer n, const double a[], Integer pda, const char *title, const char *outfile, NagError *fail)


nag_gen_real_mat_print (x04cac) prints a double matrix. It is an easy-to-use driver for nag_gen_real_mat_print_comp (x04cbc). The function uses default values for the format in which numbers are printed, for labelling the rows and columns, and for output record length.
nag_gen_real_mat_print (x04cac) will choose a format code such that numbers will be printed with 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.
The matrix is printed with integer row and column labels, and with a maximum record length of 80.
The matrix is output to the file specified by outfile or, by default, to standard output.




1:     order Nag_OrderTypeInput
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 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     matrix Nag_MatrixTypeInput
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: matrix=Nag_GeneralMatrix, Nag_LowerMatrix or Nag_UpperMatrix.
3:     diag Nag_DiagTypeInput
On entry: indicates 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 matrix=Nag_GeneralMatrix, then diag must be set to Nag_NonUnitDiag.
  • if matrixNag_GeneralMatrix, diag=Nag_NonRefDiag, Nag_UnitDiag or Nag_NonUnitDiag;
  • if matrix=Nag_GeneralMatrix, diag=Nag_NonUnitDiag.
4:     m IntegerInput
5:     n IntegerInput
On entry: the number of rows and columns of the matrix, respectively, to be printed.
If either m or n is less than 1, nag_gen_real_mat_print (x04cac) will exit immediately after printing title; no row or column labels are printed.
6:     a[dim] const doubleInput
Note: the dimension, dim, of the array a must be at least
  • max1,pda×n when order=Nag_ColMajor;
  • max1,m×pda when order=Nag_RowMajor.
The i,jth element of the matrix A is stored in
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: the matrix to be printed. Only the elements that will be referred to, as specified by arguments matrix and diag, need be set.
7:     pda IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
  • if order=Nag_ColMajor, pdamax1,m;
  • if order=Nag_RowMajor, pdamax1,n.
8:     title const char *Input
On entry: a title to be printed above the matrix.
If title=NULL, no title (and no blank line) will be printed.
If title contains more than 80 characters, the contents of title will be wrapped onto more than one line, with the break after 80 characters.
Any trailing blank characters in title are ignored.
9:     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.
10:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

Memory allocation failed.
On entry, argument value had an illegal value.
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.
Cannot open file value for appending.
Cannot close file value.
Cannot open file value for writing.


Not applicable.

Parallelism and Performance

nag_gen_real_mat_print (x04cac) is not threaded in any implementation.

Further Comments

A call to nag_gen_real_mat_print (x04cac) is equivalent to a call to nag_gen_real_mat_print_comp (x04cbc) with the following argument values:

ncols = 80
indent = 0
labrow = Nag_IntegerLabels
labcol = Nag_IntegerLabels
form = 0


See Section 10 in nag_dgeqrf (f08aec).