I am trying to subtract matrix vectors. In other words, suppose I have a matrix A with elements
x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 z4
I want to subtract vectors
x1 y1 z1
and
x2 y2 z2
How can I do this? I tried to do
implict none real, dimension(3,4) :: A real,dimension(3) :: vector vector(1)=A(1,1)-A(1,2) vector(2)=A(2,1)-A(2,2) vector(3)=A(3,1)-A(3,2)
However, this is rather rude. Also, this method would be impractical if I need to calculate a few sums or balances, especially when the matrix is ββvery large. I want to make it more elegant. Is there a way to specify a vector inside a matrix? Or is there a workaround to do this?
source share