Having a square matrix A , and I want to swap it for two lines, but with the restriction that this exchange will only affect elements that are under the diagonal in both rows.
Example -
1 2 3 4 3 6 7 8 6 5 4 2 9 4 6 7
swap betwen row1 and row2 will return the same matrix, because there are no elements that are below the diagonal in row 1.
but the exchange between row2 and row3 will give -
1 2 3 4 6 6 7 8 3 5 4 2 9 4 6 7
which actually exchanges only between 2 indices (3,1) and (2,1), because in line 2 there are no more elements under the diagonal.
How to get this function without an explicit loop, given the two required row indexes?
Here you can find a regular swap.
URL87 source share