Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Matrix-multiplication/Fortran/matrix-multiplication-1.f
Normal file
25
Task/Matrix-multiplication/Fortran/matrix-multiplication-1.f
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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(size(a,1), 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 )
|
||||
|
||||
print *, 'A'
|
||||
do i = 1, n
|
||||
print *, a(i,:)
|
||||
end do
|
||||
|
||||
print *,
|
||||
print *, 'B'
|
||||
do i = 1, m
|
||||
print *, b(i,:)
|
||||
end do
|
||||
|
||||
print *,
|
||||
print *, 'C = AB'
|
||||
do i = 1, n
|
||||
print *, c(i,:)
|
||||
end do
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
program mm
|
||||
real , allocatable :: a(:,:),b(:,:)
|
||||
integer :: l=5,m=6,n=4
|
||||
a = reshape([1:l*m],[l,m])
|
||||
b = reshape([1:m*n],[m,n])
|
||||
print'(<n>f15.7)',transpose(matmul(a,b))
|
||||
end program
|
||||
Loading…
Add table
Add a link
Reference in a new issue