I want to perform an iterative operation on each element of a matrix according to this equation which is for a 3 x 3 matrix:
For example, by having this matrix:
a = [0 0.2 -0.6; -0.2 0 0.4; 0.6 -0.4 0]
a =
0 0.2000 -0.6000
-0.2000 0 0.4000
0.6000 -0.4000 0
I wrote the code for the first iteration for each element seperately but my original matrix is 1000 x 1000, so I need a code that can do this operation for the whole matrix. The code that I wrote for each element of the matrix is:
a_1(1,2) = a(1,2) + (0.25 * (a(1,3) + a(3,2)));
a_1(1,3) = a(1,3) + (0.25 * (a(1,2) + a(2,3)));
a_1(2,1) = a(2,1) + (0.25 * (a(2,3) + a(3,1)));
a_1(2,3) = a(2,3) + (0.25 * (a(2,1) + a(1,3)));
a_1(3,1) = a(3,1) + (0.25 * (a(3,2) + a(2,1)));
a_1(3,2) = a(3,2) + (0.25 * (a(3,1) + a(1,2)))
a_1 =
0 -0.0500 -0.4500
0.0500 0 0.2000
0.4500 -0.2000 0
Which will give the result as shown above. The term that starts with CF on the RH is essentially saying no index is chosen twice in the same place. I'd appreciate it if someone can please help me. Thank you!