Re: matmul trouble




"dpb" <none@xxxxxxx> wrote in message news:f6rmk8$hc7$1@xxxxxxxxxxx
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...
It's difficult to show carriage return on a usenet message. I am hitting
carriage return after each int, with no spaces or any bonehead stuff like
that. The runtime error doesn't seem to say a lot. I can't paste it in.
It says "Access Violation" The instruction at address 00401756 attempted to
read from location 0562fe70 in file maine2.f95 at line 7. Details show more
addresses that I don't think inform. Line 7 is the write statement that
worked fine last night. I'm out of guesses.
--
Wade Ward


.