Re: matmul trouble




"Louis Krupp" <lkrupp@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1393o4dgjvt5a7d@xxxxxxxxxxxxxxxxxxxxx
Wade Ward wrote:
"Louis Krupp" <lkrupp@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1393jba9n530lfd@xxxxxxxxxxxxxxxxxxxxx


Along those lines, I would try initializing x within the program and
then calling matmul and printing the result; it gets the read statement
out of the picture.
I find no example of this in MR&C. This initialization fails:
program maine4
integer :: x(2,2), z(2,2)
OPEN(11, File="output4.txt",STATUS='REPLACE')
write (*,'(a)') 'Give me ints: '
x = (/1,2,3,4/)
z =x
!z = matmul(x,x)
write (11,'(i4)') z
close(11)
end program maine4
--

You said you "uncommented the matmul," but your example shows it commented
out.
I always try to post working source if it masquerades as a program. The
above is an exception not because of the statemnent with matmul, but an
incorrect initialization. All I need to do is uncomment the matmul to hit
that runtime error.

When you say the example fails, what message do you get?
My syntax is wrong on the initialization of x. The only examp[les I saw in
MRC were arrays of rank one or zero. The statement is:
x = (/1,2,3,4/)

I would also stick with "write(*, ...)" instead of opening a disk file. It
eliminates some variables.
When I write to an external file, then I don't have to redirect output from
a lousy dos window. Big labor saver.

If a simple initialization followed by a call to matmul fails, it might be
worth checking that you're linking against the correct library. Do other
intrinsics work?
The initialization doesn't work yet, but I'm sure that's a quick fix for
tomorrow. The last intrinsic I used gave me an inexplicable runtime error.
It was sum. Since I was in a rush, I used a do loop instead and essentially
avoided the intrinsic. Maybe I should pluck a couple out and test them.
--
Wade Ward


.



Relevant Pages

  • Re: matmul trouble
    ... Probably the first pointless fiddle I'd do would be to take the matmul ... end program maine4 ... If a simple initialization followed by a call to matmul fails, it might be worth checking that you're linking against the correct library. ...
    (comp.lang.fortran)
  • Re: problems converting Fortran 77 code to Fortran 90
    ... Using f90 intrinsics isn't a magic bullet that ... > the original post vs. 8 million calls to the MATMUL intrinsic. ... According to a trivial benchmark I made, ... larger matrices beating an optimized BLAS is _very_ hard. ...
    (comp.lang.fortran)