Jump to content

Matrix multiplication: Difference between revisions

Line 262:
 
=={{header|Fortran}}==
In ISO Fortran 90 or later, use the SIZE and MATMUL intrinsic functionfunctions:
REAL, DIMENSION(N,M) :: A = RESHAPE( (/ (I, I=1, N*M) /), (/ N, M /) )
REAL, DIMENSION(M,K) :: B = RESHAPE( (/ (I, I=1, M*K) /), (/ M, K /) )
REAL, DIMENSION(NSIZE(A,K1), SIZE(B,2)) :: C ! C is an array whose first dimension (row) size is the same
! as A's first dimension size, and whose second dimension
! (column) size is the same as B's second dimension size.
C = MATMUL( A, B )
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.