Top
Back: 4.5.2 intvec expressions
Forward: 4.5.4 intvec related functions
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.5 intvec
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.5.3 intvec operations

+

addition with intvec or int (component-wise)

-

negation or subtraction with intvec or int (component-wise)

*

multiplication with int (component-wise)

/, div

division by int (component-wise)

%, mod

modulo (component-wise)

<>, ==, <=, >=, >, <

comparison (done lexicographically)

intvec_expression [ int_expression ]

is an element of the intvec; the first element has index one.


Example:

 
  intvec iv =  1,3,5,7,8;
  iv+1;               // add 1 to each entry
→ 2,4,6,8,9
  iv*2;
→ 2,6,10,14,16
  iv;
→ 1,3,5,7,8
  iv-10;
→ -9,-7,-5,-3,-2
  iv=iv,0;
  iv;
→ 1,3,5,7,8,0
  iv div 2;
→ 0,1,2,3,4,0
  iv+iv;              // component-wise addition
→ 2,6,10,14,16,0
  iv[size(iv)-1];     // last-1 entry
→ 8
  intvec iw=2,3,4,0;
  iv==iw;             // lexicographic comparison
→ 0
  iv < iw;
→ 1
  iv != iw;
→ 1
  iv[2];
→ 3
  iw = 4,1,2;
  iv[iw];
→ 7 1 3

Top Back: 4.5.2 intvec expressions Forward: 4.5.4 intvec related functions FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.5 intvec Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.