MXTYF

 


   more...

Multiplies the transpose of matrix A by matrix B, ATB.

Required Arguments

A — Real NRA by NCA matrix. (Input)

B — Real NRB by NCB matrix. (Input)

C — Real NCA by NCB matrix containing the transpose product ATB. (Output)

Optional Arguments

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

NCA — Number of columns in 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 in B. (Input)
NRB must be the same as NRA.
Default: NRB = SIZE (B,1).

NCB — Number of columns in B. (Input)
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).

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

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

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

FORTRAN 90 Interface

Generic: CALL MXTYF (A, B, C [])

Specific: The specific interface names are S_MXTYF and D_MXTYF.

FORTRAN 77 Interface

Single: CALL MXTYF (NRA, NCA, A, LDA, NRB, NCB, B, LDB, NRC, NCC, C, LDC)

Double: The double precision name is DMXTYF.

Description

The routine MXTYF computes the real general matrix C = ATB given the real rectangular matrices A and B.

Example

Multiply the transpose of a 3 × 4 real matrix by a 3 × 3 real matrix. The output matrix will be a 4 × 3 real matrix.

 

USE MXTYF_INT

USE WRRRN_INT

 

IMPLICIT NONE

! Declare variables

INTEGER NCA, NCB, NCC, NRA, NRB, NRC

PARAMETER (NCA=4, NCB=3, NCC=3, NRA=3, NRB=3, NRC=4)

!

REAL A(NRA,NCA), B(NRB,NCB), C(NRC,NCC)

! Set values for A

! A = ( 1.0 0.0 2.0 0.0 )

! ( 3.0 4.0 -1.0 0.0 )

! ( 2.0 1.0 2.0 1.0 )

!

! Set values for B

! B = ( -1.0 2.0 0.0 )

! ( 3.0 0.0 -1.0 )

! ( 0.0 5.0 2.0 )

!

DATA A/1.0, 3.0, 2.0, 0.0, 4.0, 1.0, 2.0, -1.0, 2.0, 0.0, 0.0, &

1.0/

DATA B/-1.0, 3.0, 0.0, 2.0, 0.0, 5.0, 0.0, -1.0, 2.0/

! Compute C = trans(A)*B

CALL MXTYF (A, B, C)

! Print results

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

END

Output

 

C = trans(A)*B

1 2 3

1 8.00 12.00 1.00

2 12.00 5.00 -2.00

3 -5.00 14.00 5.00

4 0.00 5.00 2.00