groebsea.red 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. module groebsea;
  2. % support of search for reduction polynomials
  3. fluid '(thirdvalue!* fourthvalue!* hcount!* !*groebWeak);
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. %
  6. % search for reduction candidates in a list
  7. symbolic procedure groebsearchinlist (vev,g);
  8. % search for a polynomial in the list G, such that the lcm divides
  9. % vev; G is expected to be sorted in descending sequence
  10. if null G then nil
  11. else if buch!-vevdivides!?(vdpevlmon car g, vev) then car g
  12. else groebsearchinlist (vev,cdr g);
  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  14. %
  15. % search tree for polynomials
  16. % simple variant: mapped to search list
  17. %
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  19. symbolic procedure groebstreeadd (poly,stru);
  20. % add one polynomial to the tree
  21. % if this is a simple polynomial (mono or bino), reform
  22. % the tree
  23. if hcount!* #< 5000 then vdplsortin(poly,stru)
  24. else vdplsortinreplacing(poly,stru);
  25. symbolic procedure groebsearchinstree (vev,stru);
  26. % search a polynomial corresponding to the exponent vector vev
  27. groebsearchinlist (vev,stru);
  28. symbolic procedure groebstreeextract stru;
  29. % gives a linear list of all polynomials in the tree
  30. stru;
  31. symbolic procedure groebstreereconstruct u;
  32. % reconstructs a tree from a linear list of polynomials
  33. vdplsort u;
  34. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  35. % reforming G, D and G99 when a very simple polynomial was
  36. % found (e.g. a monomial, a binomial)
  37. symbolic procedure groebsecondaryreduction(poly,g,g99,d,gc,mode);
  38. % if poly is a simple polynomial, the polynomials in G and G99
  39. % are reduced in a second pass. Result is G, secondvalue is G99.
  40. % mode says, that G99 has to be modified in place.
  41. begin scalar vev,p,pl,x,rep,first,rpoly,break;
  42. mode := nil;
  43. secondvalue!* := g99; thirdvalue!* := d; fourthvalue!* := gc;
  44. vev := vdpevlmon poly; rpoly := vdpred poly;
  45. % cancel redundant elements in G99
  46. for each p in g99 do if buch!-vevdivides!?(vev,vdpevlmon p)
  47. then g99:=delete(p,g99);
  48. if vdplength poly > 2 or vevzero!? vev then return g;
  49. if !*groebweak and not vdpzero!? rpoly
  50. and (groebweaktestbranch!=1(poly,g,d)) then return 'abort;
  51. !*trgroeb and groebmess50 g;
  52. pl := union(g,g99);
  53. first := t;
  54. while pl and not break do
  55. << p:= car pl; pl := cdr pl;
  56. if groebprofitsfromvev(p,vev) then
  57. % replace by simplified version
  58. <<x := groebnormalform1(p,poly);
  59. x := groebsimpcontnormalform x;
  60. x := vdpenumerate x;
  61. if first then !*trgroeb and groebmess20(poly);
  62. first := nil;
  63. !*trgroeb and groebmess21(p,x);
  64. rep := (p . x) . rep;
  65. if not vdpzero!? x and
  66. vevzero!? vdpevlmon x then break := t; % 1 found
  67. >> >>;
  68. if break then return 'abort;
  69. % reform G99
  70. g99 := for each p in g99 collect groebsecondaryreplace(p,rep);
  71. secondvalue!* := groebsecondaryremovemultiples g99;
  72. % reform D
  73. thirdvalue!* := d;
  74. % reform Gc
  75. fourthvalue!* :=
  76. groebsecondaryremovemultiples
  77. for each y in gc collect groebsecondaryreplace(y,rep);
  78. g:=for each y in g collect groebsecondaryreplace(y,rep);
  79. !*trgroeb and groebmess50 g;
  80. return groebsecondaryremovemultiples g;
  81. end;
  82. symbolic procedure groebsecondaryremovemultiples g;
  83. if null g then nil else
  84. if vdpzero!? car g or member(car g,cdr g) then
  85. groebsecondaryremovemultiples cdr g else
  86. car g . groebsecondaryremovemultiples cdr g;
  87. symbolic procedure groebsecondaryreplace(x,rep);
  88. (if y then cdr y else x) where y = atsoc(x,rep);
  89. endmodule;
  90. end;