README: update note on shared libraries and NTL
[barvinok.git] / NTL_QQ.cc
blobac1752c75e82302bb0b6d9d26ee7819340ce3260
1 #include <assert.h>
2 #include <stdio.h> // needed for EOF hidden in NTL_io_vector_impl
3 #include <stdlib.h> // needed for abort hidden in NTL_vector_impl
4 #include <barvinok/NTL_QQ.h>
6 #ifdef NTL_vector_impl
7 NTL_vector_impl(QQ,vec_QQ);
8 #endif
10 ZZ QQ::tmp;
12 vec_QQ& operator *= (vec_QQ& a, const ZZ& b)
14 for (int i = 0; i < a.length(); ++i)
15 a[i] *= b;
16 return a;
19 vec_QQ& operator *= (vec_QQ& a, const QQ& b)
21 for (int i = 0; i < a.length(); ++i)
22 a[i] *= b;
23 return a;
26 std::ostream& operator<< (std::ostream& os, const QQ& q)
28 os << q.n << "/" << q.d;
29 return os;
32 std::istream& operator>> (std::istream& is, QQ& q)
34 char slash;
35 is >> q.n >> slash >> q.d;
36 assert(slash == '/');
37 q.canonicalize();
38 return is;
41 #ifdef NTL_io_vector_impl
42 NTL_io_vector_impl(QQ,vec_QQ);
43 #endif