FNLMath : Utilities : WROPT
WROPT
Sets or retrieves an option for printing a matrix.
Required Arguments
IOPT — Indicator of option type. (Input)
IOPT
Description of Option Type
1, 1
Horizontal centering or left justification of matrix to be printed
2, 2
Method for printing large matrices
3, 3
Paging
4, 4
Method for printing NaN (not a number), and negative and positive machine infinity.
5, 5
Title option
6, 6
Default format for real and complex numbers
7, 7
Spacing between columns
8, 8
Maximum horizontal space reserved for row labels
9, 9
Indentation of continuation lines for row labels
10, 10
Hot zone option for determining line breaks for row labels
11, 11
Maximum horizontal space reserved for column labels
12, 12
Hot zone option for determining line breaks for column labels
13, 13
Hot zone option for determining line breaks for titles
14, 14
Option for the label that appears in the upper left hand corner that can be used as a heading for the row numbers or a label for the column headings for WR**N routines
15, 15
Option for skipping a line between invocations of WR**N routines, provided a new page is not to be issued
16, 16
Option for vertical alignment of the matrix values relative to the associated row labels that occupy more than one line
0
Reset all the current settings saved in internal variables back to their last setting made with an invocation of WROPT with ISCOPE = 1. (This option is used internally by routines printing a matrix and is not useful otherwise.)
If IOPT is negative, ISETNG and ISCOPE are input and are saved in internal variables. If IOPT is positive, ISETNG is output and receives the currently active setting for the option (if ISCOPE = 0) or the last global setting for the option (if ISCOPE = 1).
If IOPT = 0, ISETNG and ISCOPE are not referenced.
ISETNG — Setting for option selected by IOPT. (Input, if IOPT is negative; output, if IOPT is positive; not referenced if IOPT = 0)
IOPT
ISETNG
Meaning
1, 1
0
Matrix is left justified
 
1
Matrix is centered horizontally on page
2, 2
0
A complete row is printed before the next row is printed. Wrapping is used if necessary.
 
m
Here, m is a positive integer. Let n1 be the maximum number of columns beginning with column 1 that fit across the page (as determined by the widths of the printing formats). First, columns 1 through n1 are printed for rows 1 through m. Let n2 be the maximum number of columns beginning with column n1 + 1 that fit across the page. Second, columns n1 + 1 through n1 + n2 are printed for rows 1 through m. This continues until the last columns are printed for rows 1 through m. Printing continues in this fashion for the next m rows, etc.
3, 3
2
Printing begins on the next line, and no paging occurs.
 
1
Paging is on. Every invocation of a WR*** routine begins on a new page, and paging occurs within each invocation as is needed
 
0
Paging is on. The first invocation of a WR*** routine begins on a new page, and subsequent paging occurs as is needed. With this option, every invocation of a WR*** routine ends with a call to WROPT to reset this option to k, a positive integer giving the number of lines printed on the current page.
 
k
Here, k is a positive integer. Paging is on, and k lines have been printed on the current page. If k is less than the page length IPAGE (see PGOPT), then IPAGE k lines are printed before a new page instruction is issued. If k is greater than or equal to IPAGE, then the first invocation of a WR*** routine begins on a new page. In any case, subsequent paging occurs as is needed. With this option, every invocation of a WR*** routine ends with a call to WROPT to reset the value of k.
4, 4
0
NaN is printed as a series of decimal points, negative machine infinity is printed as a series of minus signs, and positive machine infinity is printed as a series of plus signs.
 
1
NaN is printed as a series of blank characters, negative machine infinity is printed as a series of minus signs, and positive machine infinity is printed as a series of plus signs.
 
2
NaN is printed as “NaN,” negative machine infinity is printed as “-Inf” and positive machine infinity is printed as “Inf.”
 
3
NaN is printed as a series of blank characters, negative machine infinity is printed as “-Inf,” and positive machine infinity is printed as “Inf.”
5, 5
0
Title appears only on first page.
 
1
Title appears on the first page and all continuation pages.
6, 6
0
Format is (W10.4). See Comment 2.
 
1
Format is (W12.6). See Comment 2.
 
2
Format is (1PE12.5 ).
 
3
Format is Vn.4 where the field width n is determined. See Comment 2.
 
4
Format is Vn.6 where the field width n is determined. See Comment 2.
 
5
Format is 1PEn.d where n = d + 7, and d + 1 is the maximum number of significant digits.
7, 7
K1
Number of characters left blank between columns. K1 must be between 0 and 5, inclusively.
8, 8
K2
Maximum width (in characters) reserved for row labels. K2 = 0 means use the default.
9, 9
K3
Number of characters used to indent continuation lines for row labels. K3 must be between 0 and 10, inclusively.
10, 10
K4
Width (in characters) of the hot zone where line breaks in row labels can occur. K4 = 0 means use the default. K 4 must not exceed 50.
11, 11
K5
Maximum width (in characters) reserved for column labels. K5 = 0 means use the default.
12, 12
K6
Width (in characters) of the hot zone where line breaks in column labels can occur. K 6 = 0 means use the default. K 6 must not exceed 50.
13, 13
K7
Width (in characters) of the hot zone where line breaks in titles can occur. K 7 must be between 1 and 50, inclusively.
14
0
There is no label in the upper left hand corner.
 
1
The label in the upper left hand corner is “Component” if a row vector or column vector is printed; the label is “Row/Column” if both the number of rows and columns are greater than one; otherwise, there is no label.
15
0
A blank line is printed on each invocation of a WR**N routine before the matrix title provided a new page is not to be issued.
 
1
A blank line is not printed on each invocation of a WR**N routine before the matrix title.
16, 16
0
The matrix values are aligned vertically with the last line of the associated row label for the case IOPT = 2 and ISET is positive.
 
1
The matrix values are aligned vertically with the first line of the associated row label.
ISCOPE — Indicator of the scope of the option. (Input if IOPT is nonzero; not referenced if IOPT = 0)
ISCOPE
Action
0
Setting is temporarily active for the next invocation of a WR*** matrix printing routine.
1
Setting is active until it is changed by another invocation of WROPT.
FORTRAN 90 Interface
Generic: CALL WROPT (IOPT, ISETNG, ISCOPE)
Specific: The specific interface name is WROPT.
FORTRAN 77 Interface
Single: CALL WROPT (IOPT, ISETNG, ISCOPE)
Description
Routine WROPT allows the user to set or retrieve an option for printing a matrix. The options controlled by WROPT include the following: horizontal centering, a method for printing large matrices, paging, method for printing NaN (not a number) and positive and negative machine infinities, printing titles, default formats for numbers, spacing between columns, maximum widths reserved for row and column labels, indentation of row labels that continue beyond one line, widths of hot zones for breaking of labels and titles, the default heading for row labels, whether to print a blank line between invocations of routines, and vertical alignment of matrix entries with respect to row labels continued beyond one line. (NaN and positive and negative machine infinities can be retrieved by AMACH and DMACH that are documented in the section “Machine-Dependent Constants” in the Reference Material.) Options can be set globally (ISCOPE = 1) or temporarily for the next call to a printing routine (ISCOPE = 0).
Comments
1. This program can be invoked repeatedly before using a WR*** routine to print a matrix. The matrix printing routines retrieve these settings to determine the printing options. It is not necessary to call WROPT if a default value of a printing option is desired. The defaults are as follows.
IOPT
Default Value for ISET
Meaning
1
0
Left justified
2
1000000
Number lines before wrapping
3
2
No paging
4
2
NaN is printed as “NaN,” negative machine infinity is printed as “- Inf” and positive machine infinity is printed as “Inf.”
5
0
Title only on first page.
6
3
Default format is Vn.4.
7
2
2 spaces between columns.
8
0
Maximum row label width MAXRLW = 2 * IPAGEW/3 if matrix has one column; MAXRLW = IPAGEW/4 otherwise.
9
3
3 character indentation of row labels continued beyond one line.
10
0
Width of row label hot zone is MAXRLW/3 characters.
11
0
Maximum column label width MAXCLW = min{max (NW + NW/2, 15), 40} for integer and real matrices, where NW is the field width for the format corresponding to the particular column. MAXCLW = min{max(NW + NW/2, 15), 83} for complex matrices, where NW is the sum of the two field widths for the formats corresponding to the particular column plus 3.
12
0
Width of column label hot zone is MAXCLW/3 characters.
13
10
Width of hot zone for titles is 10 characters.
14
0
There is no label in the upper left hand corner.
15
0
Blank line is printed.
16
0
The matrix values are aligned vertically with the last line of the associated row label.
For IOPT = 8, the default depends on the current value for the page width, IPAGEW (see PGOPT).
2. The V and W formats are special formats that can be used to select a D, E, F, or I format so that the decimal points will be aligned. The V and W formats are specified as Vn.d and Wn.d. Here, n is the field width and d is the number of significant digits generally printed. Valid values for n are 3, 4, , 40. Valid values for d are 1, 2, n  2. While the V format prints trailing zeroes and a trailing decimal point, the W format does not.
Example
The following example illustrates the effect of WROPT when printing a 3 × 4 real matrix A with WRRRN where aij = i + j/10. The first call to WROPT sets horizontal printing so that the matrix is first printed horizontally centered on the page. In the next invocation of WRRRN, the left-justification option has been set via routine WROPT so the matrix is left justified when printed. Finally, because the scope of left justification was only for the next call to a printing routine, the last call to WRRRN results in horizontally centered printing.
 
USE WROPT_INT
USE WRRRN_INT
 
IMPLICIT NONE
INTEGER ITRING, LDA, NCA, NRA
PARAMETER (ITRING=0, LDA=10, NCA=4, NRA=3)
!
INTEGER I, IOPT, ISCOPE, ISETNG, J
REAL A(LDA,NCA)
!
DO 20 I=1, NRA
DO 10 J=1, NCA
A(I,J) = I + J*0.1
10 CONTINUE
20 CONTINUE
! Activate centering option.
! Scope is global.
IOPT = -1
ISETNG = 1
ISCOPE = 1
!
CALL WROPT (IOPT, ISETNG, ISCOPE)
! Write A matrix.
CALL WRRRN ('A', A, NRA=NRA)
! Activate left justification.
! Scope is local.
IOPT = -1
ISETNG = 0
ISCOPE = 0
CALL WROPT (IOPT, ISETNG, ISCOPE)
CALL WRRRN ('A', A, NRA=NRA)
CALL WRRRN ('A', A, NRA=NRA)
END
Output
 
A
1 2 3 4
1 1.100 1.200 1.300 1.400
2 2.100 2.200 2.300 2.400
3 3.100 3.200 3.300 3.400
A
1 2 3 4
1 1.100 1.200 1.300 1.400
2 2.100 2.200 2.300 2.400
3 3.100 3.200 3.300 3.400
A
1 2 3 4
1 1.100 1.200 1.300 1.400
2 2.100 2.200 2.300 2.400
3 3.100 3.200 3.300 3.400
Published date: 03/19/2020
Last modified date: 03/19/2020