iscc: add lexicographic operators
[barvinok.git] / NTL_QQ.cc
blob13ce1c6d5665fb58753b72b821a43b51a8c36f14
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 NTL_vector_impl(QQ,vec_QQ);
8 ZZ QQ::tmp;
10 vec_QQ& operator *= (vec_QQ& a, const ZZ& b)
12 for (int i = 0; i < a.length(); ++i)
13 a[i] *= b;
14 return a;
17 vec_QQ& operator *= (vec_QQ& a, const QQ& b)
19 for (int i = 0; i < a.length(); ++i)
20 a[i] *= b;
21 return a;
24 std::ostream& operator<< (std::ostream& os, const QQ& q)
26 os << q.n << "/" << q.d;
27 return os;
30 std::istream& operator>> (std::istream& is, QQ& q)
32 char slash;
33 is >> q.n >> slash >> q.d;
34 assert(slash == '/');
35 q.canonicalize();
36 return is;
39 NTL_io_vector_impl(QQ,vec_QQ);