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

4.6.2 intmat expressions

An intmat expression is:

  1. an identifier of type intmat
  2. a function returning intmat
  3. an intmat operation involving ints and int operations (+, -, *, div, %)
  4. an expression involving intmats and the operations (+, -, *)
  5. a type cast to intmat (see intmat type cast)


Example:

 
  intmat Idm[2][2];
  Idm +1;          // add the unit intmat
==> 1,0,
==> 0,1 
  intmat m1[3][2] = _,1,-2;  // take entries from the last result
  m1;
==> 1,0,
==> 0,1,
==> 1,-2 
  intmat m2[2][3]=1,0,2,4,5,1;
  transpose(m2);
==> 1,4,
==> 0,5,
==> 2,1 
  intvec v1=1,2,4;
  intvec v2=5,7,8;
  m1=v1,v2;         // fill m1 with v1 and v2
  m1;
==> 1,2,
==> 4,5,
==> 7,8 
  trace(m1*m2);
==> 56
See Type conversion and casting; number.