Question: loop assignment problem

I am doing an algorithm that include a " for " loop, inside that loop in the first statement I assigned a certain matrix to a variable G and then the algorthim changes some elements in G but when the algorithm repeat the second step of the loop it uses the last resulted matrix of the previous step NOT the one that is defined in the first statement of the loop. I want it to start each step of the loop with the same value of the matrix. what should I do?

for i to n do gn := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 1, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}); if nops(s[i]) >= 2 then a := SubMatrix(g, s[i], s[i]); u, v := Size(a); t := Matrix(u, shape = identity); v := Vector[column](u, 1); s[i]; if Determinant(t+delta.a) <> 0 then x := 1/(t+delta.a).v end if; for m to u do if x[m] < 0 then check1 := 0 end if end do; for j to k do for n to k do if `and`(member(j, s[i]) = true, member(n, s[i]) = true) then gn[j, n] := 0 end if; if `and`(member(j, s[i]) = false, member(n, s[i]) = false) then gn[j, n] := 0 end if end do end do end if end do

Please Wait...