How do I get a two dimensional array of 1s?
Philipp Germann
phg@gmx.li
Thu Jan 17 03:36:00 GMT 2008
Hello everyone,
I need an array with two dimensions with all entries equal to one. I
tried the following wihtout success using gfortran 4.2 and Ubuntu:
PROGRAM test
A = 10
B = 10
REAL, DIMENSION(A,B) :: S
S = 1.0
WRITE(*,*) S(4,3)
END PROGRAM
When compiling I get the following error:
qiv@gEddy:/media/disk/Uni/06_Bachelorarbeit/2_mc_ising$ gfortran-4.2
runden-test.f95
runden-test.f95:5.25:
REAL, DIMENSION(A,B) :: S
1
Error: Unexpected data declaration statement at (1)
runden-test.f95:8.12:
write(*,*) S(4,3)
1
Error: Syntax error in WRITE statement at (1)
Can anybody tell me how to do this? I tried some other versions too,
filling the array with a do-loop, but did not work neither.
Thanks a lot,
Philipp
PS: I am new to gfortran and this list. I am an astronomy and physics
student, working on the bachelor thesis concerning Ising Model,
Metropolis and cluster algorithms :)
More information about the Fortran
mailing list