Introduction
Introduction Statistics Contact Development Disclaimer Help
tAdded FORTRAN 90 code, benchmark OK, but doesn't work with cmd line args - num…
git clone git://src.adamsgaard.dk/numeric
Log
Files
Refs
LICENSE
---
commit fd223ef5d4bd236655a1a2d1341ce2552aebfec4
parent aae8e123fc8478c2af55280b6c26695d9582cd8f
Author: Anders Damsgaard Christensen <[email protected]>
Date: Wed, 23 Jan 2013 09:38:19 +0100
Added FORTRAN 90 code, benchmark OK, but doesn't work with cmd line args
Diffstat:
M matrixmul/Makefile | 7 +++++++
A matrixmul/fortran90.f | 44 +++++++++++++++++++++++++++++…
2 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/matrixmul/Makefile b/matrixmul/Makefile
t@@ -155,6 +155,13 @@ octave.dat: octave.m
echo $$dims; \
done
+# Fortran 90
+fortran90.dat: fortran90
+ # fortran90.f
+
+fortran90: fortran90.f
+ gfortran -Wall -O3 $< -o $@
+
clean:
$(RM) *.o
$(RM) *.dat
diff --git a/matrixmul/fortran90.f b/matrixmul/fortran90.f
t@@ -0,0 +1,44 @@
+ PROGRAM fortranmatmul
+
+ IMPLICIT NONE
+ integer i, j
+ !integer nargs
+ !character arg*8
+ integer, parameter :: N = 2
+
+ !parameter nargs = iargs()
+ !do i = 0,nargs
+ ! call getarg(i, arg)
+ ! print '(a)', arg
+ !end do
+
+ !if (nargs == 2) then
+ ! call getarg(2, arg)
+ ! read(s,*) N
+ !end if
+
+ real :: a(N,N) = RESHAPE((/(2.0, i=0,N*N, 1)/),(/N,N/))
+ real :: b(N,N) = RESHAPE((/(i, i=0,N*N, 1)/),(/N,N/))
+ real :: c(N,N)
+
+ write(*,*) 'Matrix [a]'
+ do i=1,N
+ write(*,1000) (a(i,j),j=1,N)
+ enddo
+ write(*,*)
+
+ write(*,*) 'Matrix [b]'
+ do i=1,N
+ write(*,1000) (b(i,j),j=1,N)
+ enddo
+ write(*,*)
+
+ c = matmul(a, b)
+ write(*,*) 'Matrix [c] = [a] x [b]'
+ do i = 1,N
+ write(*,1000) (c(i,j),j=1,N)
+ enddo
+
+1000 FORMAT(1x,1P10E14.6)
+
+ END PROGRAM fortranmatmul
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.