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

4.8.2 intvec expressions

An intvec expression is:

  1. a range: int expression .. int expression
  2. a repeated entry: int expression : positive int expression
    (a:b generates an intvec of length b>0 with identical entries a)
  3. a function returning intvec
  4. an expression involving intvec operations with int (+, -, *, /, %)
  5. an expression of intvecs involving intvec operations (+, -)
  6. an expression involving an intvec operation with intmat (*)
  7. a type cast to intvec


Example:

 
  intvec v=-1,2;
  intvec w=v,v;         // concatenation
  w;
==> -1,2,-1,2
  w=2:3;                // repetition
  w;
==> 2,2,2
  int k = 3;
  v = 7:k;
  v;
==> 7,7,7
  v=-1,2;
  w=-2..2,v,1;
  w;
==> -2,-1,0,1,2,-1,2,1
  intmat m[3][2] = 0,1,2,-2,3,1;
  m*v;
==> 2,-6,-1
  typeof(_);
==> intvec
  v = intvec(m);
  v;
==> 0,1,2,-2,3,1
  ring r;
  poly f = x2z + 2xy-z;
  f;
==> x2z+2xy-z
  v = leadexp(f);
  v;
==> 2,0,1