Dear Friends
I am translating MATLAB code into Fortran and I can't understand some particularities of the latter which makes me waste too much time. For example, matmul(x,y) provides absurds results without any warning if x and y are of differen type (while element by element multiplication works fine with mixed types). I suggest including (at least) some warning or runtime error.
Regards
program bug2 complex8 c(2,2) real8 b(2,2)
b=dble(reshape((/1.,2.,3.,4./),(/2,2/))) c=cmplx(reshape((/1.,2.,3.,4./),(/2,2/)))
write(,)'mixed type element by element multiplication works well:' write(,)'mixed types:',cb write(,)'same types:',ccmplx(b) write(,)
write(,)'mixed type matrix multiplication works awful:' write(,)'mixed types:',matmul(c,b) write(,)'same types:',matmul(c,cmplx(b))
end program