x04 Chapter Contents
x04 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_gen_complx_mat_print (x04dac)

## 1  Purpose

nag_gen_complx_mat_print (x04dac) is an easy-to-use function to print a Complex matrix .

## 2  Specification

 #include #include
 void nag_gen_complx_mat_print (Nag_OrderType order, Nag_MatrixType matrix, Nag_DiagType diag, Integer m, Integer n, const Complex a[], Integer pda, const char *title, const char *outfile, NagError *fail)

## 3  Description

nag_gen_complx_mat_print (x04dac) prints a Complex matrix. It is an easy-to-use driver for nag_gen_complx_mat_print_comp (x04dbc). 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_complx_mat_print (x04dac) will choose a format code such that numbers will be printed with a $%8.4\mathrm{f}$, a $%11.4\mathrm{f}$ or a $%13.4\mathrm{e}$ format. The $%8.4\mathrm{f}$ code is chosen if the sizes of all the matrix elements to be printed lie between $0.001$ and $1.0$. The $%11.4\mathrm{f}$ code is chosen if the sizes of all the matrix elements to be printed lie between $0.001$ and $9999.9999$. Otherwise the $%13.4\mathrm{e}$ code is chosen. The chosen code is used to print each complex element of the matrix with the real part above the imaginary part.
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.

None.

## 5  Arguments

1:     orderNag_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 ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     matrixNag_MatrixTypeInput
On entry: indicates the part of the matrix to be printed.
${\mathbf{matrix}}=\mathrm{Nag_GeneralMatrix}$
The whole of the rectangular matrix.
${\mathbf{matrix}}=\mathrm{Nag_LowerMatrix}$
The lower triangle of the matrix, or the lower trapezium if the matrix has more rows than columns.
${\mathbf{matrix}}=\mathrm{Nag_UpperMatrix}$
The upper triangle of the matrix, or the upper trapezium if the matrix has more columns than rows.
Constraint: ${\mathbf{matrix}}=\mathrm{Nag_GeneralMatrix}$, $\mathrm{Nag_LowerMatrix}$ or $\mathrm{Nag_UpperMatrix}$.
3:     diagNag_DiagTypeInput
On entry: indicates whether the diagonal elements of the matrix are to be printed.
${\mathbf{diag}}=\mathrm{Nag_NonRefDiag}$
The diagonal elements of the matrix are not referenced and not printed.
${\mathbf{diag}}=\mathrm{Nag_UnitDiag}$
The diagonal elements of the matrix are not referenced, but are assumed all to be unity, and are printed as such.
${\mathbf{diag}}=\mathrm{Nag_NonUnitDiag}$
The diagonal elements of the matrix are referenced and printed.
If ${\mathbf{matrix}}=\mathrm{Nag_GeneralMatrix}$, then diag must be set to Nag_NonUnitDiag.
Constraints:
• if ${\mathbf{matrix}}\ne \mathrm{Nag_GeneralMatrix}$, ${\mathbf{diag}}=\mathrm{Nag_NonRefDiag}$, $\mathrm{Nag_UnitDiag}$ or $\mathrm{Nag_NonUnitDiag}$;
• if ${\mathbf{matrix}}=\mathrm{Nag_GeneralMatrix}$, ${\mathbf{diag}}=\mathrm{Nag_NonUnitDiag}$.
4:     mIntegerInput
5:     nIntegerInput
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_complx_mat_print (x04dac) will exit immediately after printing title; no row or column labels are printed.
6:     a[$\mathit{dim}$]const ComplexInput
Note: the dimension, dim, of the array a must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pda}}×{\mathbf{n}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}×{\mathbf{pda}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $A$ is stored in
• ${\mathbf{a}}\left[\left(j-1\right)×{\mathbf{pda}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{a}}\left[\left(i-1\right)×{\mathbf{pda}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{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:     pdaIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
8:     titleconst char *Input
On entry: a title to be printed above the matrix.
If ${\mathbf{title}}=\mathbf{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:     outfileconst 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:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Memory allocation failed.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal 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_NOT_APPEND_FILE
Cannot open file $"〈\mathit{\text{value}}〉"$ for appending.
NE_NOT_CLOSE_FILE
Cannot close file $"〈\mathit{\text{value}}〉"$.
NE_NOT_WRITE_FILE
Cannot open file $"〈\mathit{\text{value}}〉"$ for writing .

## 7  Accuracy

Not applicable.

A call to nag_gen_complx_mat_print (x04dac) is equivalent to a call to nag_gen_complx_mat_print_comp (x04dbc) with the following argument values:
```
ncols = 80
indent = 0
labrow = Nag_IntegerLabels
labcol = Nag_IntegerLabels
form = 0
cmplxform = Nag_AboveForm

```

None.