MCRCR
Multiplies two complex rectangular matrices, AB.
Required Arguments
A — Complex NRA by NCA rectangular matrix. (Input)
B — Complex NRB by NCB rectangular matrix. (Input)
C — Complex NRC by NCC rectangular matrix containing the product A * B. (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 MCRCR (A, B, C [, …])
Specific: The specific interface names are S_MCRCR and D_MCRCR.
FORTRAN 77 Interface
Single: CALL MCRCR (NRA, NCA, A, LDA, NRB, NCB, B, LDB, NRC, NCC, C, LDC)
Double: The double precision name is DMCRCR.
Description
Given the complex rectangular matrices A and B, MCRCR computes the complex rectangular matrix C = AB.
Example
Multiply a 3 × 4 complex matrix by a 4 × 3 complex matrix. The output matrix will be a 3 × 3 complex matrix.
USE MCRCR_INT
USE WRCRN_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)
!
COMPLEX A(NRA,NCA), B(NRB,NCB), C(NRC,NCC)
! Set values for A
! A = ( 1.0 + 1.0i -1.0+ 2.0i 0.0 + 1.0i 0.0 - 2.0i )
! ( 3.0 + 7.0i 6.0 - 4.0i 2.0 - 1.0i 0.0 + 1.0i )
! ( 1.0 + 0.0i 1.0 - 2.0i -2.0+ 0.0i 0.0 + 0.0i )
!
! Set values for B
! B = ( 2.0 + 1.0i 3.0 + 2.0i 3.0 + 1.0i )
! ( 2.0 - 1.0i 4.0 - 2.0i 5.0 - 3.0i )
! ( 1.0 + 0.0i 0.0 - 1.0i 0.0 + 1.0i )
! ( 2.0 + 1.0i 1.0 + 2.0i 0.0 - 1.0i )
!
DATA A/(1.0,1.0), (3.0,7.0), (1.0,0.0), (-1.0,2.0), (6.0,-4.0), &
(1.0,-2.0), (0.0,1.0), (2.0,-1.0), (-2.0,0.0), (0.0,-2.0), &
(0.0,1.0), (0.0,0.0)/
DATA B/(2.0,1.0), (2.0,-1.0), (1.0,0.0), (2.0,1.0), (3.0,2.0), &
(4.0,-2.0), (0.0,-1.0), (1.0,2.0), (3.0,1.0), (5.0,-3.0), &
(0.0,1.0), (0.0,-1.0)/
! Compute C = A*B
CALL MCRCR (A, B, C)
! Print results
CALL WRCRN ('C = A*B', C)
END
C = A*B
1 2 3
1 ( 3.00, 5.00) ( 6.00, 13.00) ( 0.00, 17.00)
2 ( 8.00, 4.00) ( 8.00, -2.00) ( 22.00,-12.00)
3 ( 0.00, -4.00) ( 3.00, -6.00) ( 2.00,-14.00)