swap_columns INDEX

SWAP_COLUMNS _ _ _ _ _ _ _ _ _ _ _ _ operator

Swap columns, swap rows:

syntax:

swap_columns(<matrix>,<c1>,<c2>)

<matrix> :- a matrix.

<c1>,<c1> :- positive integers.

swap_columnsswaps column <c1> of <matrix> with column <c2>.

swap_rowsperforms the same task on two rows of <matrix>.

examples:



swap_columns(A,2,3); 

  [1  3  2]
  [       ]
  [4  6  5]
  [       ]
  [7  9  8]



swap_rows(A,1,3); 

  [7  8  9]
  [       ]
  [4  5  6]
  [       ]
  [1  2  3]

Related functions: swap_entries.