Having square matrix A
and I want to swap between 2 row on it , but with constraint that this swap would take effect only on the elements which are under the diagonal in both row .
Example -
1 2 3 4
3 6 7 8
6 5 4 2
9 4 6 7
swap betwen row1 and row2 would return same matrix because there is no elements which are under the diagonal in row 1 .
but swap between row2 and row3 would give -
1 2 3 4
6 6 7 8
3 5 4 2
9 4 6 7
which actually swapped just between 2 element index (3,1) and (2,1) because there is no more elements in row2 which are under to diagonal .
How to obtain this function with no explicit loop by given the two required row indexes ?
Regular swap could be found here .