[863cf1] | 1 | LIB "tst.lib"; |
---|
| 2 | tst_init(); |
---|
| 3 | |
---|
| 4 | LIB"primdec.lib"; |
---|
[b2d5b9] | 5 | proc sortMinAss(list l) |
---|
| 6 | { |
---|
| 7 | int i,j,notReady; |
---|
| 8 | ideal K; |
---|
[8d7d31] | 9 | intvec save=option(get);option(redSB); |
---|
[b2d5b9] | 10 | for(i=1;i<=size(l);i++){"start interrred";l[i]=interred(l[i]);"end interred";} |
---|
[8d7d31] | 11 | |
---|
[b2d5b9] | 12 | |
---|
| 13 | notReady=1; |
---|
| 14 | while(notReady) |
---|
| 15 | { |
---|
| 16 | notReady=0; |
---|
| 17 | i=0; |
---|
| 18 | while(i<size(l)-1) |
---|
| 19 | { |
---|
| 20 | i++; |
---|
| 21 | j=i; |
---|
| 22 | while(j<size(l)) |
---|
| 23 | { |
---|
| 24 | j++; |
---|
| 25 | if(compareI(l[i],l[j])) |
---|
| 26 | { |
---|
| 27 | notReady=1; |
---|
| 28 | K=l[i]; |
---|
| 29 | l[i]=l[j]; |
---|
| 30 | l[j]=K; |
---|
| 31 | i--; |
---|
| 32 | break; |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | } |
---|
| 36 | } |
---|
[8d7d31] | 37 | option(set,save); |
---|
[b2d5b9] | 38 | return(l); |
---|
| 39 | } |
---|
| 40 | proc sortGTZ(list l) |
---|
| 41 | { |
---|
| 42 | int i,j,notReady; |
---|
| 43 | list K; |
---|
| 44 | intvec save_opt=option(get); |
---|
| 45 | option(redSB,redTail); |
---|
| 46 | for(i=1;i<=size(l);i++){"start";l[i][1]=std(l[i][1]);l[i][2]=std(l[i][2]);"end";} |
---|
| 47 | option(set,save_opt); |
---|
| 48 | notReady=1; |
---|
| 49 | while(notReady) |
---|
| 50 | { |
---|
| 51 | notReady=0; |
---|
| 52 | i=0; |
---|
| 53 | while(i<size(l)-1) |
---|
| 54 | { |
---|
| 55 | i++; |
---|
| 56 | j=i; |
---|
| 57 | while(j<size(l)) |
---|
| 58 | { |
---|
| 59 | j++; |
---|
| 60 | if(compareI(l[i][2],l[j][2])) |
---|
| 61 | { |
---|
| 62 | notReady=1; |
---|
| 63 | K=l[i]; |
---|
| 64 | l[i]=l[j]; |
---|
| 65 | l[j]=K; |
---|
| 66 | i--; |
---|
| 67 | break; |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | } |
---|
| 72 | return(l); |
---|
| 73 | } |
---|
| 74 | proc compareI(ideal I, ideal J) |
---|
| 75 | { |
---|
| 76 | return(string(I)>string(J)); |
---|
| 77 | } |
---|
| 78 | |
---|
[863cf1] | 79 | |
---|
[c999184] | 80 | printlevel =0; |
---|
[863cf1] | 81 | |
---|
| 82 | // 1. Beispiel |
---|
| 83 | example zerodec; |
---|
| 84 | |
---|
| 85 | //2. Beispiel (2sec) |
---|
| 86 | ring r1= 0,(a,b,c),dp; |
---|
| 87 | poly f1= a^2*b*c + a*b^2*c + a*b*c^2 + a*b*c + a*b + a*c + b*c; |
---|
| 88 | poly f2= a^2*b^2*c + a*b^2*c^2 + a^2*b*c + a*b*c + b*c + a + c; |
---|
| 89 | poly f3= a^2*b^2*c^2 + a^2*b^2*c + a*b^2*c + a*b*c + a*c + c + 1; |
---|
| 90 | ideal gls=f1,f2,f3; |
---|
[b2d5b9] | 91 | sortMinAss(zerodec(gls)); |
---|
| 92 | sortGTZ(primdecGTZ(gls)); |
---|
[863cf1] | 93 | |
---|
| 94 | //3. Beispiel (5sec) |
---|
| 95 | ring rs=0,(x1,x2,x3,x4),dp; |
---|
| 96 | poly f1=16*x1^2 + 3*x2^2 + 5*x3^4 - 1 - 4*x4 + x4^3; |
---|
| 97 | poly f2=5*x1^3 + 3*x2^2 + 4*x3^2*x4 + 2*x1*x4 - 1 + x4 + 4*x1 + x2 + x3 + x4; |
---|
| 98 | poly f3=-4*x1^2 + x2^2 + x3^2 - 3 + x4^2 + 4*x1 + x2 + x3 + x4; |
---|
| 99 | poly f4=-4*x1 + x2 + x3 + x4; |
---|
| 100 | ideal gls=f1,f2,f3,f4; |
---|
[b2d5b9] | 101 | sortMinAss(zerodec(gls)); |
---|
| 102 | sortGTZ(primdecGTZ(gls)); |
---|
[863cf1] | 103 | |
---|
| 104 | //4. Beispiel (23sec) |
---|
| 105 | ring r2= 0,(y,z,x,t),dp; |
---|
| 106 | ideal gls=y^2*z+2*y*x*t-z-2*x, |
---|
| 107 | 4*y^2*z*x-z*x^3+2*y^3*t+4*y*x^2*t-10*y^2+4*z*x+4*x^2-10*y*t+2, |
---|
| 108 | 2*y*z*t+x*t^2-2*z-x, |
---|
| 109 | -z^3*x+4*y*z^2*t+4*z*x*t^2+2*y*t^3+4*z^2+4*z*x-10*y*t-10*t^2+2; |
---|
[b2d5b9] | 110 | sortMinAss(zerodec(gls)); |
---|
| 111 | sortGTZ(primdecGTZ(gls)); |
---|
[863cf1] | 112 | |
---|
| 113 | //5. cyclic5 vdim=70, |
---|
| 114 | //zerodec-time:49 (matrix:0 charpoly:25 factor:23) |
---|
| 115 | //primdecGTZ-time: 28 |
---|
| 116 | ring rs= 0,(a,b,c,d,e),dp; |
---|
| 117 | poly f0= a + b + c + d + e + 1; |
---|
| 118 | poly f1= a + b + c + d + e; |
---|
| 119 | poly f2= a*b + b*c + c*d + a*e + d*e; |
---|
| 120 | poly f3= a*b*c + b*c*d + a*b*e + a*d*e + c*d*e; |
---|
| 121 | poly f4= a*b*c*d + a*b*c*e + a*b*d*e + a*c*d*e + b*c*d*e; |
---|
| 122 | poly f5= a*b*c*d*e - 1; |
---|
| 123 | ideal gls= f1,f2,f3,f4,f5; |
---|
[b2d5b9] | 124 | sortMinAss(zerodec(gls)); |
---|
| 125 | sortGTZ(primdecGTZ(gls)); |
---|
[863cf1] | 126 | |
---|
| 127 | tst_status(1);$ |
---|