2 #include <NTL/vec_ZZ.h>
3 #include <NTL/mat_ZZ.h>
6 int lex_cmp(const vec_ZZ
& a
, const vec_ZZ
& b
)
8 assert(a
.length() == b
.length());
10 for (int j
= 0; j
< a
.length(); ++j
)
12 return a
[j
] < b
[j
] ? -1 : 1;
16 void lex_order_rows(mat_ZZ
& mat
)
18 for (int i
= 0; i
< mat
.NumRows(); ++i
) {
20 for (int j
= i
+1; j
< mat
.NumRows(); ++j
)
21 if (lex_cmp(mat
[j
], mat
[m
]) < 0)
31 int lex_cmp(const mat_ZZ
& a
, const mat_ZZ
& b
)
33 assert(a
.NumCols() == b
.NumCols());
34 int alen
= a
.NumRows();
35 int blen
= b
.NumRows();
36 int len
= alen
< blen
? alen
: blen
;
38 for (int i
= 0; i
< len
; ++i
) {
39 int s
= lex_cmp(a
[i
], b
[i
]);