| 1 |
|
|---|
| 2 | ;;; RING (+ - * / gcd lcm zerop unit length signum numerator [STRUCTURE]
|
|---|
| 3 | ;;; denominator)
|
|---|
| 4 | ;;; The structure whose slots are bound to functions
|
|---|
| 5 | ;;; performing usual ring operations. In addition to usual arithmetical
|
|---|
| 6 | ;;; operations, bindings for other common operations
|
|---|
| 7 | ;;; which increase efficiency of Grobner basis calculations are also
|
|---|
| 8 | ;;; included. They are as follows:
|
|---|
| 9 | ;;; GCD - greatest common divisor;
|
|---|
| 10 | ;;; LCM - least common multiple;
|
|---|
| 11 | ;;; ZEROP - test whether an element is zero;
|
|---|
| 12 | ;;; SIGNUM - the sign of a ring element (+1, -1 or zero);
|
|---|
| 13 | ;;; UNIT - the unit of the ring;
|
|---|
| 14 | ;;; NUMERATOR - the numerator, if a ring of fractions
|
|---|
| 15 | ;;; DENOMINATOR - the denominator, if a ring of fractions
|
|---|
| 16 | ;;; LENGTH - an integer giving the approximate length
|
|---|
| 17 | ;;; of the representation; for example, for integers
|
|---|
| 18 | ;;; its default binding is #'integer-length;
|
|---|
| 19 | ;;;
|
|---|
| 20 | ;;; *RING-OF-INTEGERS* ((make-ring :+ #'+ :- #'- :* #'* :/ #'floor [VARIABLE]
|
|---|
| 21 | ;;; :gcd #'gcd :lcm #'lcm :zerop #'zerop :signum
|
|---|
| 22 | ;;; #'signum :unit 1 :length #'integer-length
|
|---|
| 23 | ;;; :numerator #'numerator :denominator
|
|---|
| 24 | ;;; #'denominator))
|
|---|
| 25 | ;;; Operations in the ring of integers.
|
|---|
| 26 | ;;;
|
|---|
| 27 | ;;; *FIELD-OF-RATIONALS* ((make-ring :+ #'+ :- #'- :* #'* :/ #'/ [VARIABLE]
|
|---|
| 28 | ;;; :gcd #'
|
|---|
| 29 | ;;; (lambda (&rest r) (declare (ignore r)) 1)
|
|---|
| 30 | ;;; :lcm #'(lambda (&rest r) (apply #'* r))
|
|---|
| 31 | ;;; :zerop #'zerop :signum #'signum :unit 1
|
|---|
| 32 | ;;; :length #'
|
|---|
| 33 | ;;; (lambda (x)
|
|---|
| 34 | ;;; (+ (integer-length (numerator x))
|
|---|
| 35 | ;;; (integer-length (denominator x))))
|
|---|
| 36 | ;;; :numerator #'numerator :denominator
|
|---|
| 37 | ;;; #'denominator))
|
|---|
| 38 | ;;; Operations on the field of rational numbers.
|
|---|
| 39 | ;;;
|
|---|
| 40 | ;;; FIELD-MODULO-PRIME (modulus) [FUNCTION]
|
|---|
| 41 | ;;; Return a RING structure with operations bound
|
|---|
| 42 | ;;; to the arithmetical operations modulo MODULUS, which
|
|---|
| 43 | ;;; should be a prime.
|
|---|
| 44 | ;;;
|
|---|
| 45 | ;;; *COEFFICIENT-RING* (*ring-of-integers*) [VARIABLE]
|
|---|
| 46 | ;;; The default RING structure, used in most operations
|
|---|
| 47 | ;;; on the coefficients of polynomials. It should be carefully
|
|---|
| 48 | ;;; set if rings other than the default ring is used.
|
|---|
| 49 | ;;;
|
|---|