|
4.9.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, different length will be filled with 0 at th right)
- 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
|
|