TRNRR

Transposes a rectangular matrix.

Required Arguments

A — Real NRA by NCA matrix in full storage mode. (Input)

B — Real NRB by NCB matrix in full storage mode containing the transpose of A. (Output)

Optional Arguments

NRA — Number of rows of A. (Input)
Default: NRA = SIZE (A,1).

NCA — Number of columns of A. (Input)
Default: NCA = SIZE (A,2).

LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)
Default: LDA = SIZE (A,1).

NRB — Number of rows of B. (Input)
NRB must be equal to NCA.
Default: NRB = SIZE (B,1).

NCB — Number of columns of B. (Input)
NCB must be equal to NRA.
Default: NCB = SIZE (B,2).

LDB — Leading dimension of B exactly as specified in the dimension statement of the calling program. (Input)
Default: LDB = SIZE (B,1).

FORTRAN 90 Interface

Generic: CALL TRNRR (A, B [])

Specific: The specific interface names are S_TRNRR and D_TRNRR.

FORTRAN 77 Interface

Single: CALL TRNRR (NRA, NCA, A, LDA, NRB, NCB, B, LDB)

Double: The double precision name is DTRNRR.

Description

The routine TRNRR computes the transpose B = AT of a real rectangular matrix A.

Comments

If LDA = LDB and NRA = NCA, then A and B can occupy the same storage locations; otherwise, A and B must be stored separately.

Example

Transpose the 5 × 3 real rectangular matrix A into the 3 × 5 real rectangular matrix B.

 

USE TRNRR_INT

USE WRRRN_INT

 

IMPLICIT NONE

! Declare variables

INTEGER NCA, NCB, NRA, NRB

PARAMETER (NCA=3, NCB=5, NRA=5, NRB=3)

!

REAL A(NRA,NCA), B(NRB,NCB)

! Set values for A

! A = ( 11.0 12.0 13.0 )

! ( 21.0 22.0 23.0 )

! ( 31.0 32.0 33.0 )

! ( 41.0 42.0 43.0 )

! ( 51.0 52.0 53.0 )

!

DATA A/11.0, 21.0, 31.0, 41.0, 51.0, 12.0, 22.0, 32.0, 42.0,&

52.0, 13.0, 23.0, 33.0, 43.0, 53.0/

! B = transpose(A)

CALL TRNRR (A, B)

! Print results

CALL WRRRN ('B = trans(A)', B)

END

Output

 

B = trans(A)

1 2 3 4 5

1 11.00 21.00 31.00 41.00 51.00

2 12.00 22.00 32.00 42.00 52.00

3 13.00 23.00 33.00 43.00 53.00