implement Bernoulli_sum as conversion from unweighted to weighted counting
[barvinok/uuh.git] / NTL_QQ.cc
blob5de8cf9a72ee73eaa45865e7c62a66b6e1ee4cd0
1 #include <assert.h>
2 #include <barvinok/NTL_QQ.h>
4 NTL_vector_impl(QQ,vec_QQ);
6 ZZ QQ::tmp;
8 vec_QQ& operator *= (vec_QQ& a, const ZZ& b)
10 for (int i = 0; i < a.length(); ++i)
11 a[i] *= b;
12 return a;
15 vec_QQ& operator *= (vec_QQ& a, const QQ& b)
17 for (int i = 0; i < a.length(); ++i)
18 a[i] *= b;
19 return a;
22 std::ostream& operator<< (std::ostream& os, const QQ& q)
24 os << q.n << "/" << q.d;
25 return os;
28 std::istream& operator>> (std::istream& is, QQ& q)
30 char slash;
31 is >> q.n >> slash >> q.d;
32 assert(slash == '/');
33 q.canonicalize();
34 return is;
37 NTL_io_vector_impl(QQ,vec_QQ);