Top
Back: intmat type cast
Forward: intmat related functions
FastBack: int
FastForward: intvec
Up: intmat
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.6.4 intmat operations

+
addition with intmat or int; the int is converted into a diagonal intmat

-
negation or subtraction with intmat or int; the int is converted into a diagonal intmat

*
multiplication with intmat, intvec, or int; the int is converted into a diagonal intmat

div,/
division of entries in the integers (omitting the remainder)
%, mod
entries modulo int (remainder of the division)
<>, ==
comparators

intmat_expression [ intvec_expression, intvec_expression ]
is an intmat entry, where the first index indicates the row and the second the column


Example:
 
  intmat m[2][4] = 1,0,2,4,0,1,-1,0,3,2,1,-2;
  m;
==> 1,0,2,4,
==> 0,1,-1,0 
  m[2,3];          // entry at row 2, col 3
==> -1
  size(m);         // number of entries
==> 8
  intvec v = 1,0,-1,2;
  m * v;
==> 7,1
  typeof(_);
==> intvec
  intmat m1[4][3] = 0,1,2,3,v,1;
  intmat m2 = m * m1;
  m2;             //  2 x 3 intmat
==> -2,5,4,
==> 4,-1,-1 
  m2*10;           // multiply each entry of m with 10;
==> -20,50,40,
==> 40,-10,-10 
  -m2;
==> 2,-5,-4,
==> -4,1,1 
  m2 % 2;
==> 0,1,0,
==> 0,1,1 
  m2 div 2;
==> -1,2,2,
==> 2,-1,-1 
  m2[2,1];          // entry at row 2, col 1
==> 4
  m1[2..3,2..3];   // submatrix
==> 1 0 2 1
  m2[nrows(m2),ncols(m2)];      // the last entry of intmat m2
==> -1


Top Back: intmat type cast Forward: intmat related functions FastBack: int FastForward: intvec Up: intmat Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4-0-3, 2016, generated by texi2html.