Line_Length: handle 0D polytope in 1D space
[barvinok.git] / NTL_QQ.cc
blob325508228312bccdc2fb6cd0eab3c9dbdcb132b2
1 #include <assert.h>
2 #include <stdlib.h> // needed for abort hidden in NTL_vector_impl
3 #include <barvinok/NTL_QQ.h>
5 NTL_vector_impl(QQ,vec_QQ);
7 ZZ QQ::tmp;
9 vec_QQ& operator *= (vec_QQ& a, const ZZ& b)
11 for (int i = 0; i < a.length(); ++i)
12 a[i] *= b;
13 return a;
16 vec_QQ& operator *= (vec_QQ& a, const QQ& b)
18 for (int i = 0; i < a.length(); ++i)
19 a[i] *= b;
20 return a;
23 std::ostream& operator<< (std::ostream& os, const QQ& q)
25 os << q.n << "/" << q.d;
26 return os;
29 std::istream& operator>> (std::istream& is, QQ& q)
31 char slash;
32 is >> q.n >> slash >> q.d;
33 assert(slash == '/');
34 q.canonicalize();
35 return is;
38 NTL_io_vector_impl(QQ,vec_QQ);