drop collect_nonsimple.c
[barvinok.git] / power.h
blobe90927bf3d95a0030050e31d708ad614543cf0ca
1 struct power {
2 int n;
3 Vector *powers;
5 power(Value v, int max) {
6 powers = Vector_Alloc(max+1);
7 assert(powers);
8 value_set_si(powers->p[0], 1);
9 if (max >= 1)
10 value_assign(powers->p[1], v);
11 n = 2;
13 ~power() {
14 Vector_Free(powers);
16 Value *operator[](int exp) {
17 assert(exp >= 0);
18 assert(exp < powers->Size);
19 for (; n <= exp; ++n)
20 value_multiply(powers->p[n], powers->p[n-1], powers->p[1]);
21 return &powers->p[exp];