up previous next
SwapRows

swap two rows in a matrix

Syntax
SwapRows(ref M: MAT, i: INT, j: INT)

Description
This procedure swaps the i -th and j -th rows in the matrix M ; it returns nothing!

Example
/**/  M := IdentityMat(QQ, 5);
/**/  SwapRows(ref M, 2,5);
/**/  M;
matrix(QQ,
 [[1, 0, 0, 0, 0],
  [0, 0, 0, 0, 1],
  [0, 0, 1, 0, 0],
  [0, 0, 0, 1, 0],
  [0, 1, 0, 0, 0]])

See Also