1 | proc generate_polys (int n, string ostring) |
---|
2 | { |
---|
3 | string ringstr = "ring r = 32003,x(1.." + string(n) + ")," + ostring + ";"; |
---|
4 | string polystr = "poly p = "; |
---|
5 | int i; |
---|
6 | |
---|
7 | for (i=1; i<=n; i++) |
---|
8 | { |
---|
9 | polystr = polystr + "x(" + string(i) + ") + "; |
---|
10 | } |
---|
11 | polystr = polystr + "1;"; |
---|
12 | ringstr; |
---|
13 | polystr; |
---|
14 | execute(ringstr); |
---|
15 | execute(polystr); |
---|
16 | p; |
---|
17 | p^2 + p; |
---|
18 | (p^2+p)*(gen(2) + gen(3)); |
---|
19 | (p^2+p)*(gen(2) + gen(3))+ p^2 + p; |
---|
20 | kill r; |
---|
21 | } |
---|
22 | |
---|
23 | proc check_ordering(int n, string ostring) |
---|
24 | { |
---|
25 | generate_polys(n, ostring); |
---|
26 | generate_polys(n, "(C," + ostring + ")"); |
---|
27 | generate_polys(n, "(c," + ostring + ")"); |
---|
28 | generate_polys(n, "(" + ostring + ",C)"); |
---|
29 | generate_polys(n, "(" + ostring + ",c)"); |
---|
30 | } |
---|
31 | |
---|
32 | list orderings = "lp", "dp", "Dp", "ls", "ds", "Ds"; |
---|
33 | |
---|
34 | list l = "dp"; |
---|
35 | |
---|
36 | proc check_comp(int n, list olist) |
---|
37 | { |
---|
38 | int i; |
---|
39 | int j; |
---|
40 | for (i=1; i<=size(olist); i++) |
---|
41 | { |
---|
42 | for (j=1; j<=n; j++) |
---|
43 | { |
---|
44 | check_ordering(j, olist[i]); |
---|
45 | } |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | check_comp(9, orderings); |
---|
50 | |
---|
51 | LIB "tst.lib";tst_status(1);$ |
---|
52 | |
---|
53 | |
---|
54 | |
---|