1 | LIB "tst.lib"; tst_init(); |
---|
2 | LIB "general.lib"; |
---|
3 | ring r0 = 0,(x,y,z,t),lp; |
---|
4 | ideal i = x3,z3,xyz; |
---|
5 | sort(i); //sorts using lex ordering, smaller polys come first |
---|
6 | sort(i,3..1); |
---|
7 | sort(i,"ls")[1]; //sort w.r.t. negative lex ordering |
---|
8 | intvec v =1,10..5,2..4;v; |
---|
9 | sort(v)[1]; // sort v lexicographically |
---|
10 | sort(v,"Dp",1)[1]; // sort v w.r.t (total sum, reverse lex) |
---|
11 | // Note that in general: lead(sort(M)) != sort(lead(M)), e.g: |
---|
12 | module M = [0, 1, 1, 0], [1, 0, 0, 1]; M; |
---|
13 | sort(lead(M), "c, dp")[1]; |
---|
14 | lead(sort(M, "c, dp")[1]); |
---|
15 | // In order to sort M wrt a NEW ordering by considering OLD leading |
---|
16 | // terms use one of the following equivalent commands: |
---|
17 | module( M[ sort(lead(M), "c,dp")[2] ] ); |
---|
18 | sort( M, sort(lead(M), "c,dp")[2] )[1]; |
---|
19 | // BUG: Please, don't use this sort for integer vectors or lists |
---|
20 | // with them if there can be negative integers! |
---|
21 | // TODO: for some HiWi |
---|
22 | sort(3..-3)[1]; |
---|
23 | sort(list(-v, v))[1]; |
---|
24 | tst_status(1);$ |
---|