MRRRR

 


   more...

Multiplies two real rectangular matrices, AB.

Required Arguments

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

B — Real NRB by NCB matrix in full storage mode. (Input)

C — Real NRC by NCC matrix containing the product AB in full storage mode. (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)
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 NRA.
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 MRRRR (A, B, C [])

Specific: The specific interface names are S_MRRRR and D_MRRRR.

FORTRAN 77 Interface

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

Double: The double precision name is DMRRRR.

Description

Given the real rectangular matrices A and B, MRRRR computes the real rectangular matrix C = AB.

Example

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

 

USE MRRRR_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=4, NRC=3)

!

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 0.0 2.0 )

! ( 3.0 5.0 2.0 )

! ( 0.0 0.0 -1.0 )

! ( 2.0 -1.0 5.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, 2.0, -1.0, &

5.0/

! Compute C = A*B

CALL MRRRR (A, B, C)

! Print results

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

END

Output

 

C = A*B

1 2 3

1 -1.00 0.00 0.00

2 9.00 20.00 15.00

3 3.00 4.00 9.00