This is a programming issue, not a compiler issue, so I hope anyone who know Fortran well can help me.
Suppose that I have 3 matrices:
matA(N,N,N)
maB(N,N,N)
matC(N,N,N)
and a vector
vecD(N)
matC(i,j,k) returns an index in vecD.
I want to achieve this expression
DO i = 1, N
Do j = 1, N
DO k = 1, N
matA(i,j,k) = matB(i,j,k) - vecD(matC(i,j,k))
END
END
END
by using
matA = matB - vecD(matC)
but the compiler doesn’t accept this. Is there a solution?
Thanks,
Tuan