I am not sure I understand your question.
'matrix' can commonly refer to an array of rank 2. Array operations can also be applied to rank 2 arrays, which can give more options for array syntax, for example:
! snippets of fortran code
integer :: n1,n2,i,j,k
real, allocatable :: a(:,:), b(:,:), c(:,:)
n1 = ??
n2 = ??
allocate ( a(n1,n2), b(n1,n2), c(n1,n2) )
!
! define values of a(:,1) and b(:,1)
!
! DO loop approach
DO j = 1,k
DO i = 1,k
c(i,j) = a(i,j) + b(i,j)
END DO
END DO
!
! Fortran 90 array syntax
c(1:k,1:k) = a(1:k,1:k) + b(1:k,1:k)
!
! or if dimension 1&2 are 1:k, ie k=n1 and k=n2
c(:,:) = a(:,:) + b(:,:)
!
! or simply
c = a + b
I write matrix multiplication using a mixture of array syntax and DO loops:
subroutine stream_matmul_dp (a,b,c,nra,nca,ncb)
use precision
! matrix multiplication : single thread, array syntax
integer*4 nra,nca,ncb, j,k
real(dp) :: a(nra,nca), b(nca,ncb)
real(dp) :: c(nra,ncb)
!
do j = 1,ncb
c(:,j) = 0
do k = 1,nca
c(1:nra,j) = c(1:nra,j) + a(1:nra,k) * b(k,j)
end do
end do
!
end subroutine stream_matmul_dp
If you are concerned about the size of huge matrices, you should review recent posts that have referred to sparse matrices. However, there are many different ways of referencing non-zero terms in a matrix that utilise the non-zero patterns or groupings of the particular matrix structure.