No matching user defined OPERATOR with the given type and rank has been defined
program mainuse imsl
implicit none
real a(3,3),b(3,2),C(2,3)
b(:,1)=1
c(1,:)=2
a=b(:,1).x.c(1,:)
write(*,*) a
end
显示这样的问题:Error: No matching user defined OPERATOR with the given type and rank has been defined.
a=b(:,1).x.c(1,:) 为什么不能这样子写呢?下面的情况也是差不多的,
program main
use imsl
implicit none
real a(3,3),a1(3,3),a2(3,3),b(3,1),C(1,3),temp
b(:,1)=1
c(1,:)=2
a1=b.x.c
a2=b.x.c
a=a1+a2
a=b.x.c
write(*,*) a
temp=c.x.b
write(*,*) temp
end
Error: The shapes of the array expressions do not conform.
temp=c.x.b
改为:
a=b(:,1:1).x.c(1:1,:)
既可。
因为 .x. 是矩阵相乘,两边必须是二维数组(矩阵)
b(:,1) 是一维数组,大小是 3
b(:,1:1) 是二维数组,大小是 3*1
第二个 temp 的问题,请在第一个问题的基础上自行思考。(错误很相似哦~~)
祝,元旦好! 谢谢,明白了
页:
[1]