user3513335
user3513335

Reputation: 11

Valid DO loops with array matrix inside

Hey I'm new to this website so I'm probably doing a few things wrong, but this is my question:

Can you make a DO LOOP as the following (in Fortran90):

program help
implicit none

real, dimension (10,10) :: imarc
integer :: R , j , k

imarc (1:10,1:10) = 50
imarc (1:10,1) = 20
imarc (1,1:10) = 20
imarc (1:10,10) = 20
imarc (10,1:10) = 20
imarc (3,3) = 100


!!! HERE IS THE DO LOOP THAT GIVES A COMPILE ERROR

DO R = 1 , 1000
  DO j = 2 , 9
    DO k = 2 , 9

    imarc (j,k) = 0.25( imarc((j-1),k) + imarc((j+1),k) + imarc(j,(k-1)) + imarc(j,(k+1)) )
    imarc (3,3) = 100

    END DO
  END DO
END DO

WRITE (*,*) "Node (5,5) =", imarc(5,5)

end program help

I hope someone could help me out with my problem.

here is the error message i get:

     imarc(j,k) = 0.25( imarc((j-1),k) + imarc((j+1),k) + imarc(j,(k-1)) +
     1
Error: Unclassifiable statement at (1)

Well, i hope i did everything right, or atleast good enough for someone to be able to help me out.

Thanks a bunch!! -marc

Upvotes: 1

Views: 36

Answers (1)

M. S. B.
M. S. B.

Reputation: 29391

You are missing an arithmetic operator, I'll guess *, after 0.25. Multiplication isn't implied by adjacent quantities, as it is in algebra, you have to use an operator.

P.S. well asked question ... small, full program that exhibited the problem.

Upvotes: 1

Related Questions