2 つのベクトルの外積を計算するプログラムを作成しようとしています (入力は「実数」型なので、[1.3 3.4 1,5] など)。しかし、私は多くのエラーを受け取り続けています:
program Q3CW
implicit none
REAL :: matA(3), matB(3)
REAL :: A11, A12, A13
REAL :: B11, B12, B13
real :: productc(3), answer(3)
read*,A11, A12, A13
read*,B11, B12, B13
matA = (/A11, A12, A13/)
matB = (/B11, B12, B13/)
answer = productc(matA, matB)
print*,'Answer = ', answer(1), answer(2), answer(3)
end program
real function productc(matIn1, matIn2)
real, dimension(3) :: matIn1, matIn2
productc(1)=(/matIn1(2)*matIn2(3)-matIn1(3)*matIn2(2)/)
productc(2)=(/matIn1(3)*matIn2(1)-matIn1(1)*matIn2(3)/)
productc(3)=(/matIn1(1)*matIn2(2)-matIn1(2)*matIn2(1)/)
end function
これは私が得るエラーです:
Error: Q33333.f95(20) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@=
Error: Q33333.f95(21) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@=
Error: Q33333.f95(22) : Statement function definition for pre-existing procedure PRODUCTC; detected at )@=
Warning: Q33333.f95(23) : Function PRODUCTC has not been assigned a value; detected at FUNCTION@<end-of-statement>
Build Result Error(3) Warning(1) Extension(0)
問題が何である可能性がありますか?