I have a Fortran 90array (matrix) like:
REAL(8),DIMENSION(Xmax, Ymax, Zmax, Xmax, Ymax, Zmax) :: Mat
I read through my matrix in this way:
DO X1=1,Xmax
Do Y1=1,Ymax
DO Z1=1,Zmax
DO Xv=1,Xmax
Do Yv=1,Ymax
DO Zv=1,Zmax
Mat(X1, Y1, Z1, Xv, Yv, Zv)
END DO
END DO
END DO
END DO
END DO
END DO
I would like to create a new matrix NewMat
(dimension(Xmax, Ymax, Zmax) only) which will contain for each (Xv, Yv, Zv)
the sum of all respectively (X1, Y1, Z1)
from my initial matrix.
My question is: Do I need to iterate to sum? Or is there a way to use some function? what would be more efficient?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…