source: git/Singular/LIB/modwalk.lib @ f5d2647

spielwiese
Last change on this file since f5d2647 was 3686937, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Added '$Id$' as a comment to all libs (LIB/*.lib)
  • Property mode set to 100644
File size: 19.4 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="version modwalk.lib 4.0.0.0 Jun_2013 "; // $Id$
3category = "Commutative Algebra";
4info="
5LIBRARY:  modwalk.lib      Groebner basis convertion
6
7AUTHORS:  S. Oberfranz    oberfran@mathematik.uni-kl.de
8
9OVERVIEW:
10
11  A library for converting Groebner bases of an ideal in the polynomial
12  ring over the rational numbers using modular methods. The procedures are
13  inspired by the following paper:
14  Elizabeth A. Arnold: Modular algorithms for computing Groebner bases.
15  Journal of Symbolic Computation 35, 403-419 (2003).
16
17PROCEDURES:
18 modWalk(I);        standard basis conversion of I using modular methods (chinese remainder)
19";
20
21LIB "poly.lib";
22LIB "ring.lib";
23LIB "parallel.lib";
24LIB "rwalk.lib";
25LIB "grwalk.lib";
26LIB "modstd.lib";
27
28
29////////////////////////////////////////////////////////////////////////////////
30
31proc modpWalk(def II, int p, int variant, list #)
32"USAGE:  modpWalk(I,p,#); I ideal, p integer, variant integer
33ASSUME:  If size(#) > 0, then
34           #[1] is an intvec describing the current weight vector
35           #[2] is an intvec describing the target weight vector
36RETURN:  ideal - a standard basis of I mod p, integer - p
37NOTE:    The procedure computes a standard basis of the ideal I modulo p and
38         fetches the result to the basering.
39EXAMPLE: example modpWalk; shows an example
40"
41{
42  option(redSB);
43  int k,nvar@r;
44  def R0 = basering;
45  string ordstr_R0 = ordstr(R0);
46  list rl = ringlist(R0);
47  int sizerl = size(rl);
48  int neg = 1 - attrib(R0,"global");
49  if(typeof(II) == "ideal")
50  {
51    ideal I = II;
52    int radius = 2;
53    int pert_deg = 2;
54  }
55  if(typeof(II) == "list" && typeof(II[1]) == "ideal")
56  {
57    ideal I = II[1];
58    if(size(II) == 2)
59    {
60      int radius = II[2];
61      int pert_deg = 2;
62    }
63    if(size(II) == 3)
64    {
65      int radius = II[2];
66      int pert_deg = II[3];
67    }
68  }
69  rl[1] = p;
70  int h = homog(I);
71  def @r = ring(rl);
72  setring @r;
73  ideal i = fetch(R0,I);
74  string order;
75  if(system("nblocks") <= 2)
76  {
77    if(find(ordstr_R0, "M") + find(ordstr_R0, "lp") + find(ordstr_R0, "rp") <= 0)
78    {
79      order = "simple";
80    }
81  }
82
83//-------------------------  make i homogeneous  -----------------------------
84
85  if(!mixedTest() && !h)
86  {
87    if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
88    {
89      if(!((order == "simple") || (sizerl > 4)))
90      {
91        list rl@r = ringlist(@r);
92        nvar@r = nvars(@r);     
93        intvec w;
94        for(k = 1; k <= nvar@r; k++)
95        {
96          w[k] = deg(var(k));
97        }
98        w[nvar@r + 1] = 1;
99        rl@r[2][nvar@r + 1] = "homvar";
100        rl@r[3][2][2] = w;
101        def HomR = ring(rl@r);
102        setring HomR;
103        ideal i = imap(@r, i);
104        i = homog(i, homvar);
105      }
106    }
107  }
108
109//-------------------------  compute a standard basis mod p  -----------------------------
110
111  if(variant == 1)
112  {
113    if(size(#)>0)
114    {
115      i = rwalk(i,radius,pert_deg,#);
116     // rwalk(i,radius,pert_deg,#); std(i);
117    }
118    else
119    {
120      i = rwalk(i,radius,pert_deg);
121    }
122  }
123  if(variant == 2)
124  {
125    if(size(#) == 2)
126    {
127      i = gwalk(i,#);
128    }
129    else
130    {
131      i = gwalk(i);
132    }
133  }
134  if(variant == 3)
135  {
136    if(size(#) == 2)
137    {
138      i = frandwalk(i,radius,#);
139    }
140    else
141    {
142      i = frandwalk(i,radius);
143    }
144  }
145  if(variant == 4)
146  {
147    if(size(#) == 2)
148    {
149      trwalk(i,radius,pert_deg,#);
150    }
151    else
152    {
153      trwalk(i,radius,pert_deg);
154    }
155  }
156  if(!mixedTest() && !h)
157  {
158    if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
159    {
160      if(!((order == "simple") || (sizerl > 4)))
161      {
162        i = subst(i, homvar, 1);
163        i = simplify(i, 34);
164        setring @r;
165        i = imap(HomR, i);
166        i = interred(i);
167        kill HomR;
168      }
169    }
170  }
171  setring R0;
172  return(list(fetch(@r,i),p));
173}
174example
175{
176  "EXAMPLE:"; echo = 2;
177  option(redSB);
178
179  int p = 181;
180  intvec a = 2,1,3,4;
181  intvec b = 1,9,1,1;
182  ring ra = 0,(w,x,y,z),(a(a),lp);
183  ideal I = std(cyclic(4));
184  ring rb = 0,(w,x,y,z),(a(b),lp);
185  ideal I = imap(ra,I);
186  modpWalk(I,p,1,a,b);
187  std(I);
188/*  ~
189  list P = modpWalk(I,p,2,a,b);
190  P;
191  list P1 = modpWalk(I,p,1,a,b);
192  P1;
193  ring R =181,(w,x,y,z),(a(b),lp);
194  std(cyclic(4));
195  ~
196  a = 1,3,5,7,9;
197  b = 5,2,7,2,6;
198  ring raa = 0,(v,w,x,y,z),(a(a),lp);
199  ideal I = std(cyclic(5));
200  ring rbb =0,(v,w,x,y,z),(a(b),lp);
201  ideal I = imap(raa,I);
202  int q = 32003;
203  list Q = modpWalk(I,q,1,a,b);
204  ideal J = rwalk(I,2,3,a,b);
205  J;
206  std(I);
207  Q;
208  ring r = 32003,(v,w,x,y,z),(a(b),lp);
209  std(cyclic(5));*/
210}
211
212////////////////////////////////////////////////////////////////////////////////
213
214proc modWalk(def II, int variant, list #)
215"USAGE:  modWalk(II); II ideal or list(ideal,int)
216ASSUME:  If variant = 1 the random walk algorithm with radius II[2] is applied
217         to II[1] if II = list(ideal, int). It is applied to II with radius 2
218         if II is an ideal. If variant = 2, the Groebner walk algorithm is
219         applied to II[1] or to II, respectively.
220         If size(#) > 0, then # contains either 1, 2 or 4 integers such that
221@*       - #[1] is the number of available processors for the computation,
222@*       - #[2] is an optional parameter for the exactness of the computation,
223                if #[2] = 1, the procedure computes a standard basis for sure,
224@*       - #[3] is the number of primes until the first lifting,
225@*       - #[4] is the constant number of primes between two liftings until
226           the computation stops.
227RETURN:  a standard basis of I if no warning appears.
228NOTE:    The procedure converts a standard basis of I (over the rational
229         numbers) from the ordering \"a(v),lp\", "dp\" or \"Dp\" to the ordering
230         \"(a(w),lp\" or \"a(1,0,...,0),lp\" by using modular methods.
231         By default the procedure computes a standard basis of I for sure, but
232         if the optional parameter #[2] = 0, it computes a standard basis of I
233         with high probability.
234EXAMPLE: example modWalk; shows an example
235"
236{
237  int TT = timer;
238  int RT = rtimer;
239  int i,j,pTest,sizeTest,weighted,n1;
240  bigint N;
241
242  def R0 = basering;
243  list rl = ringlist(R0);
244  if((npars(R0) > 0) || (rl[1] > 0))
245  {
246    ERROR("Characteristic of basering should be zero, basering should have no parameters.");
247  }
248
249  if(typeof(II) == "ideal")
250  {
251    ideal I = II;
252    kill II;
253    list II;
254    II[1] = I;
255    II[2] = 2;
256    II[3] = 2;
257  }
258  else
259  {
260    if(typeof(II) == "list" && typeof(II[1]) == "ideal")
261    {
262      ideal I = II[1];
263      if(size(II) == 1)
264      {
265        II[2] = 2;
266        II[3] = 2;
267      }
268      if(size(II) == 2)
269      {
270        II[3] = 2;
271      }
272   
273    }
274    else
275    {
276      ERROR("Unexpected type of input.");
277    }
278  }
279
280//--------------------  Initialize optional parameters  ------------------------
281  n1 = system("cpu");
282  if(size(#) == 0)
283  {
284    int exactness = 1;
285    int n2 = 10;
286    int n3 = 10;
287  }
288  else
289  {
290    if(size(#) == 1)
291    {
292      if(typeof(#[1]) == "int")
293      {
294        if(#[1] < n1)
295        {
296          n1 = #[1];
297        }
298        int exactness = 1;
299        if(n1 >= 10)
300        {
301          int n2 = n1 + 1;
302          int n3 = n1;
303        }
304        else
305        {
306          int n2 = 10;
307          int n3 = 10;
308        }
309      }
310      else
311      {
312        ERROR("Unexpected type of input.");
313      }
314    }
315    if(size(#) == 2)
316    {
317      if(typeof(#[1]) == "int" && typeof(#[2]) == "int")
318      {
319        if(#[1] < n1)
320        {
321          n1 = #[1];
322        }
323        int exactness = #[2];
324        if(n1 >= 10)
325        {
326          int n2 = n1 + 1;
327          int n3 = n1;
328        }
329        else
330        {
331          int n2 = 10;
332          int n3 = 10;
333        }
334      }
335      else
336      {
337        if(typeof(#[1]) == "intvec" && typeof(#[2]) == "intvec")
338        {
339          intvec curr_weight = #[1];
340          intvec target_weight = #[2];
341          weighted = 1;
342          int n2 = 10;
343          int n3 = 10;
344          int exactness = 1;
345        }
346        else
347        {
348          ERROR("Unexpected type of input.");
349        }
350      } 
351    }
352    if(size(#) == 3)
353    {
354      if(typeof(#[1]) == "intvec" && typeof(#[2]) == "intvec" && typeof(#[3]) == "int")
355      {
356        intvec curr_weight = #[1];
357        intvec target_weight = #[2];
358        weighted = 1;
359        n1 = #[3];
360        int n2 = 10;
361        int n3 = 10;
362        int exactness = 1;
363      }
364      else
365      {
366        ERROR("Unexpected type of input.");
367      }
368    }
369    if(size(#) == 4)
370    {
371      if(typeof(#[1]) == "intvec" && typeof(#[2]) == "intvec" && typeof(#[3]) == "int" && typeof(#[4]) == "int")
372      {
373        intvec curr_weight = #[1];
374        intvec target_weight = #[2];
375        weighted = 1;
376        if(#[1] < n1)
377        {
378          n1 = #[3];
379        }
380        int exactness = #[4];
381        if(n1 >= 10)
382        {
383          int n2 = n1 + 1;
384          int n3 = n1;
385        }
386        else
387        {
388          int n2 = 10;
389          int n3 = 10;
390        }
391      }
392      else
393      {
394        if(typeof(#[1]) == "int" && typeof(#[2]) == "int" && typeof(#[3]) == "int" && typeof(#[4]) == "int")
395        {
396          if(#[1] < n1)
397          {
398            n1 = #[1];
399          }
400          int exactness = #[2];
401          if(n1 >= #[3])
402          {
403            int n2 = n1 + 1;
404          }
405          else
406          {
407            int n2 = #[3];
408          }
409          if(n1 >= #[4])
410          {
411            int n3 = n1;
412          }
413          else
414          {
415            int n3 = #[4];
416          }
417        }
418        else
419        {
420          ERROR("Unexpected type of input.");
421        }
422      }
423    }
424    if(size(#) == 6)
425    {
426      if(typeof(#[1]) == "intvec" && typeof(#[2]) == "intvec" && typeof(#[3]) == "int" && typeof(#[4]) == "int" && typeof(#[5]) == "int" && typeof(#[6]) == "int")
427      {
428        intvec curr_weight = #[1];
429        intvec target_weight = #[2];
430        weighted = 1;
431        if(#[3] < n1)
432        {
433          n1 = #[3];
434        }
435        int exactness = #[4];
436        if(n1 >= #[5])
437        {
438          int n2 = n1 + 1;
439        }
440        else
441        {
442          int n2 = #[5];
443        }
444        if(n1 >= #[6])
445        {
446          int n3 = n1;
447        }
448        else
449        {
450          int n3 = #[6];
451        }
452      }
453      else
454      {
455        ERROR("Expected list(intvec,intvec,int,int,int,int) as optional parameter list.");
456      }
457    }
458    if(size(#) == 1 || size(#) == 5 || size(#) > 6)
459    {
460      ERROR("Expected 0,2,3,4 or 5 optional arguments.");
461    }
462  }
463  if(printlevel >= 10)
464  {
465  "n1 = "+string(n1)+", n2 = "+string(n2)+", n3 = "+string(n3)+", exactness = "+string(exactness);
466  }
467
468//-------------------------  Save current options  -----------------------------
469  intvec opt = option(get);
470  option(redSB);
471
472//--------------------  Initialize the list of primes  -------------------------
473  int tt = timer;
474  int rt = rtimer;
475  int en = 2134567879;
476  int an = 1000000000;
477  intvec L = primeList(I,n2);
478  if(n2 > 4)
479  {
480  //  L[5] = prime(random(an,en));
481  }
482  if(printlevel >= 10)
483  {
484    "CPU-time for primeList: "+string(timer-tt)+" seconds.";
485    "Real-time for primeList: "+string(rtimer-rt)+" seconds.";
486  }
487  int h = homog(I);
488  list P,T1,T2,LL,Arguments,PP;
489  ideal J,K,H;
490
491//-------------------  parallelized Groebner Walk in positive characteristic  --------------------
492
493  if(weighted)
494  {
495    for(i=1; i<=size(L); i++)
496    {
497      Arguments[i] = list(II,L[i],variant,list(curr_weight,target_weight));
498    }
499  }
500  else
501  {
502    for(i=1; i<=size(L); i++)
503    {
504      Arguments[i] = list(II,L[i],variant);
505    }
506  }
507  P = parallelWaitAll("modpWalk",Arguments);
508  for(i=1; i<=size(P); i++)
509  {
510    T1[i] = P[i][1];
511    T2[i] = bigint(P[i][2]);
512  }
513
514  while(1)
515  {
516    LL = deleteUnluckyPrimes(T1,T2,h);
517    T1 = LL[1];
518    T2 = LL[2];
519//-------------------  Now all leading ideals are the same  --------------------
520//-------------------  Lift results to basering via farey  ---------------------
521
522    tt = timer; rt = rtimer;
523    N = T2[1];
524    for(i=2; i<=size(T2); i++)
525    {
526      N = N*T2[i];
527    }
528    H = chinrem(T1,T2);
529    //J = parallelFarey(H,N,n1);
530    J=farey(H,N);
531    if(printlevel >= 10)
532    {
533      "CPU-time for lifting-process is "+string(timer - tt)+" seconds.";
534      "Real-time for lifting-process is "+string(rtimer - rt)+" seconds.";
535    }
536
537//----------------  Test if we already have a standard basis of I --------------
538
539    tt = timer; rt = rtimer;
540    //pTest = pTestSB(I,J,L,variant);
541    pTest = primeTestSB(I,J,L,variant);
542    if(printlevel >= 10)
543    {
544      "CPU-time for pTest is "+string(timer - tt)+" seconds.";
545      "Real-time for pTest is "+string(rtimer - rt)+" seconds.";
546    }
547    if(pTest)
548    {
549      if(printlevel >= 10)
550      {
551        "CPU-time for computation without final tests is "+string(timer - TT)+" seconds.";
552        "Real-time for computation without final tests is "+string(rtimer - RT)+" seconds.";
553      }
554      attrib(J,"isSB",1);
555      if(exactness == 0)
556      {
557        option(set, opt);
558        return(J);
559      }
560      else
561      {
562        tt = timer;
563        rt = rtimer;
564        sizeTest = 1 - isIdealIncluded(I,J,n1);
565        if(printlevel >= 10)
566        {
567          "CPU-time for checking if I subset <G> is "+string(timer - tt)+" seconds.";
568          "Real-time for checking if I subset <G> is "+string(rtimer - rt)+" seconds.";
569        }
570        if(sizeTest == 0)
571        {
572          tt = timer;
573          rt = rtimer;
574          K = std(J);
575          if(printlevel >= 10)
576          {
577            "CPU-time for last std-computation is "+string(timer - tt)+" seconds.";
578            "Real-time for last std-computation is "+string(rtimer - rt)+" seconds.";
579          }
580          if(size(reduce(K,J)) == 0)
581          {
582            option(set, opt);
583            return(J);
584          }
585        }
586      }
587    }
588//--------------  We do not already have a standard basis of I, therefore do the main computation for more primes  --------------
589
590    T1 = H;
591    T2 = N;
592    j = size(L)+1;
593    tt = timer; rt = rtimer;
594    L = primeList(I,n3,L,n1);
595L;
596    if(printlevel >= 10)
597    {
598      "CPU-time for primeList: "+string(timer-tt)+" seconds.";
599      "Real-time for primeList: "+string(rtimer-rt)+" seconds.";
600    }
601    Arguments = list();
602    PP = list();
603    if(weighted)
604    {
605      for(i=j; i<=size(L); i++)
606      {
607        //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight));
608        Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight));
609      }
610    }
611    else
612    {
613      for(i=j; i<=size(L); i++)
614      {
615        //Arguments[i-j+1] = list(II,L[i],variant);
616        Arguments[size(Arguments)+1] = list(II,L[i],variant);
617      }
618    }
619    PP = parallelWaitAll("modpWalk",Arguments);
620    if(printlevel >= 10)
621    {
622      "parallel modpWalk";
623     // ~
624    }
625    for(i=1; i<=size(PP); i++)
626    {
627      //P[size(P) + 1] = PP[i];
628      T1[size(T1) + 1] = PP[i][1];
629      T2[size(T2) + 1] = bigint(PP[i][2]);
630    }
631  }
632  if(printlevel >= 10)
633  {
634    "CPU-time for computation with final tests is "+string(timer - TT)+" seconds.";
635    "Real-time for computation with final tests is "+string(rtimer - RT)+" seconds.";
636  }
637}
638
639example
640{
641  "EXAMPLE:";
642  echo = 2;
643  ring R=0,(x,y,z),lp;
644  ideal I=-x+y2z-z,xz+1,x2+y2-1;
645  // I is a standard basis in dp
646  modWalk(I,1);
647  modWalk(I,2,2,0);
648  modWalk(I,3,system("cpu"),0);
649  std(I);
650
651  ring r0=0,x(1..6),dp;
652  ideal i0=std(cyclic(6));
653  ring r=0,x(1..6),lp;
654  ideal i=fetch(r0,i0);
655  modWalk(i,1,system("cpu"),0);
656  modWalk(i,3);
657}
658
659////////////////////////////////////////////////////////////////////////////////
660proc isIdealIncluded(ideal I, ideal J, int n1)
661"USAGE:  isIdealIncluded(I,J,int n1); I ideal, J ideal, n1 integer
662"
663{
664  if(n1 > 1)
665  {
666    int k;
667    list args,results;
668    for(k=1; k<=size(I); k++)
669    {
670      args[k] = list(ideal(I[k]),J,1);
671    }
672    results = parallelWaitAll("reduce",args);
673    for(k=1; k<=size(results); k++)
674    {
675      if(results[k] == 0)
676      {
677        return(1);
678      }
679    }
680    return(0);
681  }
682  else
683  {
684    if(reduce(I,J,1) == 0)
685    {
686      return(1);
687    }
688    else
689    {
690      return(0);
691    }
692  }
693}
694
695////////////////////////////////////////////////////////////////////////////////
696proc parallelChinrem(list T1, list T2, int n1)
697"USAGE:  parallelChinrem(T1,T2); T1 list of ideals, T2 list of primes, n1 integer"
698{
699  int i,j,k;
700
701  ideal H,J;
702
703  list arguments_chinrem,results_chinrem;
704  for(i=1; i<=size(T1); i++)
705  {
706    J = ideal(T1[i]);
707    attrib(J,"isSB",1);
708    arguments_chinrem[size(arguments_chinrem)+1] = list(list(J),T2);
709  }
710  results_chinrem = parallelWaitAll("chinrem",arguments_chinrem);
711    for(j=1; j <= size(results_chinrem); j++) 
712    {
713      J = results_chinrem[j];
714      attrib(J,"isSB",1);
715      if(isIdealIncluded(J,H,n1) == 0)
716      {
717        if(H == 0)
718        {
719          H = J;
720        }
721        else
722        {
723          H = H,J;
724        }
725      }
726    }
727  return(H);
728}
729
730////////////////////////////////////////////////////////////////////////////////
731proc parallelFarey(ideal H, bigint N, int n1)
732"USAGE:  parallelFarey(H,N,n1); H ideal, N bigint, n1 integer
733"
734{
735  int i,j;
736  int ii = 1;
737  list arguments_farey,results_farey;
738  for(i=1; i<=size(H); i++)
739  {
740    for(j=1; j<=size(H[i]); j++)
741    {
742      arguments_farey[size(arguments_farey)+1] = list(H[i][j],N);
743    }
744  }
745  results_farey = parallelWaitAll("farey",arguments_farey);
746  ideal J,K;
747  poly f_farey;
748  while(ii<=size(results_farey))
749  {
750    for(i=1; i<=size(H); i++)
751    {
752      f_farey = 0;
753      for(j=1; j<=size(H[i]); j++)
754      {
755        f_farey = f_farey + results_farey[ii][1];
756        ii++;
757      }
758      K = ideal(f_farey);
759      attrib(K,"isSB",1);
760      attrib(J,"isSB",1);
761      if(isIdealIncluded(K,J,n1) == 0)
762      {
763        if(J == 0)
764        {
765          J = K;
766        }
767        else
768        {
769          J = J,K;
770        }
771      }
772    }
773  }
774  return(J);
775}
776
777proc primeTestSB(def II, ideal J, list L, int variant, list #)
778"USAGE:  primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int
779RETURN:  1 (resp. 0) if for a randomly chosen prime p that is not in L
780         J mod p is (resp. is not) a standard basis of I mod p
781EXAMPLE: example primeTestSB; shows an example
782"
783{
784if(typeof(II) == "ideal")
785  {
786  ideal I = II;
787  int radius = 2;
788  }
789if(typeof(II) == "list")
790  {
791  ideal I = II[1];
792  int radius = II[2];
793  }
794
795int i,j,k,p;
796def R = basering;
797list r = ringlist(R);
798
799while(!j)
800  {
801  j = 1;
802  p = prime(random(1000000000,2134567879));
803  for(i = 1; i <= size(L); i++)
804    {
805    if(p == L[i])
806      {
807      j = 0;
808      break;
809      }
810    }
811  if(j)
812    {
813    for(i = 1; i <= ncols(I); i++)
814      {
815      for(k = 2; k <= size(I[i]); k++)
816        {
817        if((denominator(leadcoef(I[i][k])) mod p) == 0)
818          {
819          j = 0;
820          break;
821          }
822        }
823      if(!j)
824        {
825        break;
826        }
827      }
828    }
829  if(j)
830    {
831    if(!primeTest(I,p))
832      {
833      j = 0;
834      }
835    }
836  }
837r[1] = p;
838def @R = ring(r);
839setring @R;
840ideal I = imap(R,I);
841ideal J = imap(R,J);
842attrib(J,"isSB",1);
843
844int t = timer;
845j = 1;
846if(isIncluded(I,J) == 0)
847  {
848  j = 0;
849  }
850if(printlevel >= 11)
851  {
852  "isIncluded(I,J) takes "+string(timer - t)+" seconds";
853  "j = "+string(j);
854  }
855t = timer;
856if(j)
857  {
858  if(size(#) > 0)
859    {
860    ideal K = modpWalk(I,p,variant,#)[1];
861    }
862  else
863    {
864    ideal K = modpWalk(I,p,variant)[1];
865    }
866  t = timer;
867  if(isIncluded(J,K) == 0)
868    {
869    j = 0;
870    }
871  if(printlevel >= 11)
872    {
873    "isIncluded(K,J) takes "+string(timer - t)+" seconds";
874    "j = "+string(j);
875    }
876  }
877setring R;
878
879return(j);
880}
881example
882{ "EXAMPLE:"; echo = 2;
883   intvec L = 2,3,5;
884   ring r = 0,(x,y,z),lp;
885   ideal I = x+1,x+y+1;
886   ideal J = x+1,y;
887   primeTestSB(I,I,L,1);
888   primeTestSB(I,J,L,1);
889}
Note: See TracBrowser for help on using the repository browser.