x04db prints a complex matrix stored in a two-dimensional array.

# Syntax

C#
```public static void x04db(
string matrix,
string diag,
int m,
int n,
Complex[,] a,
string usefrm,
string form,
string title,
string labrow,
string[] rlabs,
string labcol,
string[] clabs,
int ncols,
int indent,
out int ifail
)```
Visual Basic
```Public Shared Sub x04db ( _
matrix As String, _
diag As String, _
m As Integer, _
n As Integer, _
a As Complex(,), _
usefrm As String, _
form As String, _
title As String, _
labrow As String, _
rlabs As String(), _
labcol As String, _
clabs As String(), _
ncols As Integer, _
indent As Integer, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void x04db(
String^ matrix,
String^ diag,
int m,
int n,
array<Complex,2>^ a,
String^ usefrm,
String^ form,
String^ title,
String^ labrow,
array<String^>^ rlabs,
String^ labcol,
array<String^>^ clabs,
int ncols,
int indent,
[OutAttribute] int% ifail
)```
F#
```static member x04db :
matrix : string *
diag : string *
m : int *
n : int *
a : Complex[,] *
usefrm : string *
form : string *
title : string *
labrow : string *
rlabs : string[] *
labcol : string *
clabs : string[] *
ncols : int *
indent : int *
ifail : int byref -> unit
```

#### Parameters

matrix
Type: System..::..String
On entry: indicates the part of the matrix to be printed.
${\mathbf{matrix}}=\text{"G"}$
The whole of the rectangular matrix.
${\mathbf{matrix}}=\text{"L"}$
The lower triangle of the matrix, or the lower trapezium if the matrix has more rows than columns.
${\mathbf{matrix}}=\text{"U"}$
The upper triangle of the matrix, or the upper trapezium if the matrix has more columns than rows.
Constraint: ${\mathbf{matrix}}=\text{"G"}$, $\text{"L"}$ or $\text{"U"}$.
diag
Type: System..::..String
On entry: unless ${\mathbf{matrix}}=\text{"G"}$, diag must specify whether the diagonal elements of the matrix are to be printed.
${\mathbf{diag}}=\text{"B"}$
The diagonal elements of the matrix are not referenced and not printed.
${\mathbf{diag}}=\text{"U"}$
The diagonal elements of the matrix are not referenced, but are assumed all to be unity, and are printed as such.
${\mathbf{diag}}=\text{"N"}$
The diagonal elements of the matrix are referenced and printed.
If ${\mathbf{matrix}}=\text{"G"}$, then diag need not be set.
Constraint: if ${\mathbf{matrix}}\ne \text{"G"}$, ${\mathbf{diag}}=\text{"B"}$, $\text{"U"}$ or $\text{"N"}$.
m
Type: System..::..Int32
On entry: the number of rows and columns of the matrix, respectively, to be printed.
If either m or n is less than $1$, x04db will exit immediately after printing title; no row or column labels are printed.
n
Type: System..::..Int32
On entry: the number of rows and columns of the matrix, respectively, to be printed.
If either m or n is less than $1$, x04db will exit immediately after printing title; no row or column labels are printed.
a
Type: array<NagLibrary..::..Complex,2>[,](,)[,][,]
An array of size [dim1, dim2]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the matrix to be printed. Only the elements that will be referred to, as specified by parameters matrix and diag, need be set.
usefrm
Type: System..::..String
On entry: indicates how the value of form is to be used to print matrix elements, except in MATLAB mode where usefrm is ignored.
${\mathbf{usefrm}}=\text{"A"}$
The format code in form 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 usefrm option is used. A typical value of form for this usefrm option might be $\text{'E13.4'}$, $\text{'*'}$ or .
${\mathbf{usefrm}}=\text{"B"}$
The format code in form is assumed to contain a single edit-descriptor such as $\text{'E13.4'}$, $\text{'*'}$ or  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 usefrm option might look like this: $\left(12.345,-11.323\right)$.
${\mathbf{usefrm}}=\text{"D"}$
The format code in form is used unaltered to print a complex number. This usefrm option allows you flexibility to specify exactly how the number is printed. With this option for usefrm and a suitable value for form it is possible, for example, to print a complex number in the form $\left(0.123+3.214i\right)$ or $\left(\text{0.123E−02},\text{0.234E−01}\right)$. See [Example] for an example illustrating this option.
Constraint: ${\mathbf{usefrm}}=\text{"A"}$, $\text{"B"}$ or $\text{"D"}$.
form
Type: System..::..String
On entry: describes the Fortran format code that is used in conjunction with usefrm for printing the elements of the matrix a. The format code may be any allowed on the system, whether it is standard Fortran or not. It may or may not be enclosed in brackets.
In addition, there are the following special codes which force x04db to choose its own format code:
x04db will choose a format code such that numbers will be printed with an F8.4, an F11.4 or a 1PE13.4 format. The F8.4 code is chosen if the sizes of the real and imaginary parts of all the matrix elements to be printed lie between $0.001$ and $1.0$. The F11.4 code is chosen if the sizes of all the numbers to be printed lie between $0.001$ and $9999.9999$. Otherwise the 1PE13.4 code is chosen.
${\mathbf{form}}=\text{'*'}$
x04db 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. Whether they do in fact look different will depend on the run-time library of the Fortran compiler in use.
By preceding the desired format code by the string ‘MATLAB’, x04db will print the matrix such that it can be input into MATLAB, and title will be used as the name of the matrix.
More complicated values of form, to print a complex number in a desired form, may be used. See the description of parameter usefrm for more details.
Examples of valid values for form are $\text{'(F11.4)'}$, $\text{'1P,2E13.5'}$, $\text{'MATLABF11.4'}$, $\text{'MATLAB*'}$.
Constraint: the character length of the format specifier in form must be $\text{}\le 80$.
title
Type: System..::..String
On entry: a title to be printed above the matrix, or name of 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.
If printing in MATLAB mode, title will be used as the name of the matrix.
labrow
Type: System..::..String
On entry: indicates the type of labelling to be applied to the rows of the matrix, except in MATLAB mode where labrow is ignored.
${\mathbf{labrow}}=\text{"N"}$
Prints no row labels.
${\mathbf{labrow}}=\text{"I"}$
Prints integer row labels.
${\mathbf{labrow}}=\text{"C"}$
Prints character labels, which must be supplied in array rlabs.
Constraint: ${\mathbf{labrow}}=\text{"N"}$, $\text{"I"}$ or $\text{"C"}$.
rlabs
Type: array<System..::..String>[]()[][]
An array of size [dim1]
Note: the dimension of the array rlabs must be at least ${\mathbf{m}}$ if ${\mathbf{labrow}}=\text{"C"}$, and at least $1$ otherwise.
On entry: if ${\mathbf{labrow}}=\text{"C"}$, rlabs must contain labels for the rows of the matrix, except in MATLAB mode where rlabs is ignored.
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
Type: System..::..String
On entry: indicates the type of labelling to be applied to the columns of the matrix, except in MATLAB mode where labcol is ignored.
${\mathbf{labcol}}=\text{"N"}$
Prints no column labels.
${\mathbf{labcol}}=\text{"I"}$
Prints integer column labels.
${\mathbf{labcol}}=\text{"C"}$
Prints character labels, which must be supplied in array clabs.
Constraint: ${\mathbf{labcol}}=\text{"N"}$, $\text{"I"}$ or $\text{"C"}$.
clabs
Type: array<System..::..String>[]()[][]
An array of size [dim1]
Note: the dimension of the array clabs must be at least ${\mathbf{n}}$ if ${\mathbf{labcol}}=\text{"C"}$, and at least $1$ otherwise.
On entry: if ${\mathbf{labcol}}=\text{"C"}$, clabs must contain labels for the columns of the matrix, except in MATLAB mode where clabs is ignored.
Labels are right-justified when output. Any label that is too long for the column width, which is determined by form, is truncated.
ncols
Type: System..::..Int32
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 0 or greater than $132$ is supplied for ncols, then the value $80$ is used instead.
indent
Type: System..::..Int32
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.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

x04db prints a complex matrix, or part of it, using a format specifier supplied by you. The matrix is output to the unit defined by (X04ABF not in this release).

None.

# Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDA) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{matrix}}\ne \text{"G"}$, $\text{"L"}$ or $\text{"U"}$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{matrix}}=\text{"L"}$ or $\text{"U"}$, but ${\mathbf{diag}}\ne \text{"N"}$, $\text{"U"}$ or $\text{"B"}$.
${\mathbf{ifail}}=4$
 On entry, ${\mathbf{usefrm}}\ne \text{"A"}$, $\text{"B"}$ or $\text{"D"}$.
${\mathbf{ifail}}=5$
 On entry, the format specifier in form is more than $80$ characters long.
${\mathbf{ifail}}=6$
The format specifier in form cannot be used to output a number. The specifier probably has too wide a field width or contains an illegal edit descriptor.
${\mathbf{ifail}}=7$
 On entry, either labrow or ${\mathbf{labcol}}\ne \text{"N"}$, $\text{"I"}$ or $\text{"C"}$.
${\mathbf{ifail}}=8$
The quantity ${\mathbf{ncols}}-{\mathbf{indent}}-\mathit{labwid}$ (where $\mathit{labwid}$ is the width needed for the row labels) is not large enough to hold at least one column of the matrix.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-4000$
Invalid dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

Not applicable.

None.

# Example

The example program calls x04db three times, first to print a $3$ by $4$ rectangular matrix, next to print a $4$ by $4$ upper triangular matrix, and then to print a $3$ by $4$ lower triangular matrix; various options for labelling and formatting are illustrated.

Example program (C#): x04dbe.cs

Example program results: x04dbe.r