ezgcd.red 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. module ezgcd; % Header module for ezgcd package.
  2. % Authors: A. C. Norman and P. M. A. Moore.
  3. create!-package('(ezgcd alphas coeffts ezgcdf facmisc facstr interfac
  4. linmodp mhensfns modpoly multihen unihens),
  5. '(factor));
  6. fluid '(!*trallfac !*trfac factor!-level factor!-trace!-list);
  7. factor!-level:=0; % start with a numeric value.
  8. symbolic procedure !*d2n a; if null a then 0 else a;
  9. symbolic procedure adjoin!-term (p,c,r);
  10. if null c then r else (p .* c) .+ r;
  11. symbolic smacro procedure ttab n; spaces(n-posn());
  12. symbolic smacro procedure polyzerop u; null u;
  13. symbolic smacro procedure didntgo q; null q;
  14. symbolic smacro procedure depends!-on!-var(a,v);
  15. (lambda !#!#a; (not domainp !#!#a) and (mvar !#!#a=v)) a;
  16. symbolic procedure errorf u;
  17. rerror(ezgcd,1,list("Factorizer error:",u));
  18. smacro procedure printstr l; << prin2!* l; terpri!*(nil) >>;
  19. smacro procedure printvar v; printstr v;
  20. smacro procedure prinvar v; prin2!* v;
  21. symbolic smacro procedure factor!-trace action;
  22. begin scalar stream;
  23. if !*trallfac or (!*trfac and factor!-level = 1)
  24. then stream := nil . nil
  25. else stream := assoc(factor!-level,factor!-trace!-list);
  26. if stream then <<stream := wrs cdr stream; action; wrs stream>>
  27. end;
  28. symbolic smacro procedure getm2(a,i,j);
  29. % Store by rows, to ease pivoting process.
  30. getv(getv(a,i),j);
  31. symbolic smacro procedure putm2(a,i,j,v);
  32. putv(getv(a,i),j,v);
  33. symbolic smacro procedure !*f2mod u; u;
  34. symbolic smacro procedure !*mod2f u; u;
  35. % A load of access smacros for image sets follow:
  36. symbolic smacro procedure get!-image!-set s; car s;
  37. symbolic smacro procedure get!-chosen!-prime s; cadr s;
  38. symbolic smacro procedure get!-image!-lc s; caddr s;
  39. symbolic smacro procedure get!-image!-mod!-p s; cadr cddr s;
  40. symbolic smacro procedure get!-image!-content s; cadr cdr cddr s;
  41. symbolic smacro procedure get!-image!-poly s; cadr cddr cddr s;
  42. symbolic smacro procedure get!-f!-numvec s; cadr cddr cdddr s;
  43. symbolic smacro procedure put!-image!-poly!-and!-content
  44. (s,imcont,impol);
  45. list(get!-image!-set s,
  46. get!-chosen!-prime s,
  47. get!-image!-lc s,
  48. get!-image!-mod!-p s,
  49. imcont,
  50. impol,
  51. get!-f!-numvec s);
  52. symbolic procedure printvec(str1,n,str2,v);
  53. << for i:=1:n do <<
  54. prin2!* str1;
  55. prin2!* i;
  56. prin2!* str2;
  57. printsf getv(v,i) >>;
  58. terpri!*(nil) >>;
  59. endmodule;
  60. end;