MRRRR/DMRRRR (Single/Double precision)
Multiply two real rectangular matrices, AB.
Usage
CALL MRRRR (NRA, NCA, A, LDA, NRB, NCB, B, LDB, NRC, NCC,
C, LDC)
Arguments
NR4 - Number of rows of A. (Input)
NCA - Number of columns of A. (Input)
A - ReaI NRA by NCA matrix in full storage mode. (Input)
LDA - Leading dimension of A cxactly as specified in the dimension statement
of the calling program. (Input)
NRB - Number of rows of B. (Input)
NRB must be equal to NCA.
NCB - Number of columns of B. (Input)
B - Real NRB by NCB matrix in full storage mode. (Input)
LDB - Leading dimension of B exactly as specified in the dimension statement
of the calling program. (Input)
NRC - Number of rows of C. (Input)
NRC must be equal to NRA.
NCC - Number of columns of C. (Input)
Ncc must be equal to NCB.
C ― Real NRC by NCC matrix containing the product AB in full storage mode.
(Output)
LDC ― Leading dimension of C exactly as specified in the dimension statement
of the calling program. (Input)
Algorithm
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.
C Declare variables
INTEGER LDA, LDB, LDC, NCA, NCB, NCC, NRA, NRB, NRC
PARAMETER (LDA=3, LDB=4, LDC=3, NCA=4, NCB=3, NCC=3,NRA=3,
& NRB=4, NRC=3)
C
REAL A(LDA, NCA), B(LDB,NCB), C(LDC,NCC)
EXTERNAL MRRRR, WRRRN
C Set values for A
C A = (1.0 0.0 2.0 0.0)
C (3.0 4.0 -1.0 0.0)
C (2.0 1.0 2.0 1.0)
C
C Set values for B
C B = (-1.0 0.0 2.0)
C ( 3.0 5.0 2.0)
C ( 0.0 0.0 -1.0)
C ( 2.0 -1.0 5.0)
C
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/
C Compute C = A * B
CALL MRRRR (NRA, NCA, A, LDA, NRB, B, LDB, NRC, NCC, C, LDC)
C Print results
CALL WRRRN (' C = A * B', NRC, NCC, C, LDC, 0)
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
[IMSLのマニュアルより]