Re: matmul trouble



Wade Ward wrote:
I'm trying to decide from first principles how to represent the input when you read in a square matrix with a read (*,*).

First principles are that first index is incremented most rapidly -- what is there to decide? (Or again the question isn't one I follow, perhaps?)

program maine2
integer :: x(3,3), z(3,3)
write (*,'(a)',advance='no') 'Give me 9 ints: '
read(*,*) x

z=matmul(x,x)
write (*,*) x, z
end program maine2
I'm puzzled that this should turn into a runtime error with 123456789 as an input. You'd think the usual culprit would be inappropriately-sized arrays, but it's hard to go wrong on that count with square matrices. Ideas?

Well, since you didn't say what error was, ideas are rather scare on anything associated w/ it for me at least. :)

Nothing looks obviously wrong to me assuming you typed in 9 integers not all in a row the way you keep writing it as "123456789". If you did that, you only initialized the first entry in the array and the rest are uninitialized...

--

.