WRIRN

Prints an integer rectangular matrix with integer row and column labels.

Required Arguments

TITLE — Character string specifying the title. (Input)
TITLE set equal to a blank character(s) suppresses printing of the title. Use “% /” within the title to create a new line. Long titles are automatically wrapped.

MATNRMAT by NCMAT matrix to be printed. (Input)

Optional Arguments

NRMAT — Number of rows. (Input)
Default: NRMAT = size (MAT,1).

NCMAT — Number of columns. (Input)
Default: NCMAT = size (MAT,2).

LDMAT — Leading dimension of MAT exactly as specified in the dimension statement in the calling program. (Input)
Default: LDMAT = size (MAT,1).

ITRING — Triangle option. (Input)
Default: ITRING = 0.

 

ITRING

Action

0

Full matrix is printed.

1

Upper triangle of MAT is printed, including the diagonal.

2

Upper triangle of MAT excluding the diagonal of MAT is printed.

1

Lower triangle of MAT is printed, including the diagonal.

2

Lower triangle of MAT excluding the diagonal of MAT is printed.

FORTRAN 90 Interface

Generic: CALL WRIRN (TITLE, MAT [])

Specific: The specific interface name is S_WRIRN.

FORTRAN 77 Interface

Single: CALL WRIRN (TITLE, NRMAT, NCMAT, MAT, LDMAT, ITRING).

Description

Routine WRIRN prints an integer rectangular matrix with the rows and columns labeled 1, 2, 3, and so on. WRIRN can restrict printing to elements of the upper and lower triangles of matrices via the ITRING option. Generally, ITRING  0 is used with symmetric matrices.

In addition, one‑dimensional arrays can be printed as column or row vectors. For a column vector, set NRMAT to the length of the array and set NCMAT = 1. For a row vector, set NRMAT = 1 and set NCMAT to the length of the array. In both cases, set LDMAT = NRMAT and set ITRING = 0.

Comments

1. All the entries in MAT are printed using a single I format. The field width is determined by the largest absolute entry.

2. Horizontal centering, a method for printing large matrices, paging, printing a title on each page, and many other options can be selected by invoking WROPT.

3. A page width of 78 characters is used. Page width and page length can be reset by invoking PGOPT.

4. Output is written to the unit specified by UMACH (see the Reference Material).

Example

The following example prints all of a 3 × 4 matrix A = MAT where aij = 10i + j.

 

USE WRIRN_INT

 

IMPLICIT NONE

INTEGER ITRING, LDMAT, NCMAT, NRMAT

PARAMETER (ITRING=0, LDMAT=10, NCMAT=4, NRMAT=3)

!

INTEGER I, J, MAT(LDMAT,NCMAT)

!

DO 20 I=1, NRMAT

DO 10 J=1, NCMAT

MAT(I,J) = I*10 + J

10 CONTINUE

20 CONTINUE

! Write MAT matrix.

CALL WRIRN ('MAT', MAT, NRMAT=NRMAT)

END

Output

 

MAT

1 2 3 4

1 11 12 13 14

2 21 22 23 24

3 31 32 33 34