up previous next
SetEntry    --    set an entry into a matrix


Syntax
SetEntry(ref M: MAT, i: INT, j: INT, val: RAT)
SetEntry(ref M: MAT, i: INT, j: INT, val: RINGELEM)

Description
This procedure sets the value val as i,j-entry in the matrix M; it returns nothing! It is equivalent to M[i,j] := val;, but is offered as the CoCoA-5 couterpart of the syntax needed in C++ for CoCoALib.

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

See Also