2 #include "lattice_point.h"
4 void counter::add_falling_powers(dpoly
& n
, Value degree
)
6 value_increment(n
.coeff
->p
[0], n
.coeff
->p
[0]);
7 if (n
.coeff
->Size
== 1)
10 int min
= n
.coeff
->Size
-1;
11 if (value_posz_p(degree
) && value_cmp_si(degree
, min
) < 0)
12 min
= VALUE_TO_INT(degree
);
16 value_assign(tmp
, degree
);
17 value_addto(n
.coeff
->p
[1], n
.coeff
->p
[1], tmp
);
18 for (int i
= 2; i
<= min
; ++i
) {
19 value_decrement(degree
, degree
);
20 value_multiply(tmp
, tmp
, degree
);
21 mpz_divexact_ui(tmp
, tmp
, i
);
22 value_addto(n
.coeff
->p
[i
], n
.coeff
->p
[i
], tmp
);
27 void counter::handle(const mat_ZZ
& rays
, Value
*V
, const QQ
& c
, unsigned long det
,
28 int *closed
, barvinok_options
*options
)
30 Matrix
* Rays
= zz2matrix(rays
);
31 for (int k
= 0; k
< dim
; ++k
) {
32 Inner_Product(lambda
->p
, Rays
->p
[k
], dim
, &tmp
);
33 if (value_zero_p(tmp
))
38 assert(c
.n
== 1 || c
.n
== -1);
41 Matrix_Vector_Product(Rays
, lambda
->p
, den
->p_Init
);
42 Inner_Product(lambda
->p
, V
, dim
, &tmp
);
43 lattice_points_fixed(V
, &tmp
, Rays
, den
, num
, det
, closed
);
51 for (int k
= 0; k
< num
->NbRows
; ++k
)
52 add_falling_powers(d
, num
->p_Init
[k
]);
53 dpoly
n(dim
, den
->p_Init
[0], 1);
54 for (int k
= 1; k
< dim
; ++k
) {
55 dpoly
fact(dim
, den
->p_Init
[k
], 1);
58 d
.div(n
, count
, sign
);