Changeset 2145 for branches/f4grobner
- Timestamp:
- 2015-06-17T21:30:09-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/ring.lisp
r2141 r2145 34 34 (defpackage "RING" 35 35 (:use :cl) 36 (:shadow "GCD" "LCM" "ZEROP" "+" "-" "*" "/" "EXPT") 37 (:export "PARSE" 38 "UNIT-FOR" 39 "ZEROP" 40 "+" 41 "-" 42 "*" 43 "+" 44 "/" 45 "EXPT" 46 "LCM" 47 "EZGCD" 48 "GCD" 49 "TOTAL-DEGREE" 50 "DIMENSION" 51 "SUGAR" 52 "DIVIDES-P" 53 "DIVIDES-LCM-P" 54 "LCM-DIVIDES-LCM-P" 55 "LCM-EQUAL-LCM-P" 56 "DIVISIBLE-BY-P" 57 "REL-PRIME-P" 58 "EQUAL-P" 59 "DEPENDS-P" 60 "TENSOR-MUL" 61 "CONTRACT" 62 "ELT")) 36 (:export "R-PARSE" 37 "R-UNIT-FOR" 38 "R-ZEROP" 39 "R+" 40 "R-" 41 "R*" 42 "R+" 43 "R/" 44 "R-EXPT" 45 "R-LCM" 46 "R-EZGCD" 47 "R-GCD" 48 "R-TOTAL-DEGREE" 49 "R-DIMENSION" 50 "R-SUGAR" 51 "R-DIVIDES-P" 52 "R-DIVIDES-LCM-P" 53 "R-LCM-DIVIDES-LCM-P" 54 "R-LCM-EQUAL-LCM-P" 55 "R-DIVISIBLE-BY-P" 56 "R-REL-PRIME-P" 57 "R-EQUALP" 58 "R-DEPENDS-P" 59 "R-TENSOR-MUL" 60 "R-CONTRACT")) 63 61 64 62 (in-package :ring) 65 63 66 (defgeneric unit-for (object)64 (defgeneric r-unit-for (object) 67 65 (:method ((self number)) 1)) 68 66 69 (defgeneric zerop (object)67 (defgeneric r-zerop (object) 70 68 (:method ((self number)) (cl:zerop self))) 71 69 72 (defgeneric + (x y)70 (defgeneric r+ (x y) 73 71 (:method ((x number) (y number)) (cl:+ x y))) 74 72 75 (defgeneric - (x y)73 (defgeneric r- (x y) 76 74 (:method ((x number) (y number)) (cl:- x y))) 77 75 78 (defgeneric * (x y)76 (defgeneric r* (x y) 79 77 (:method ((x number) (y number)) (cl:* x y))) 80 78 81 (defgeneric tensor-times(x y))79 (defgeneric r-tensor-product (x y)) 82 80 83 (defgeneric / (x y)81 (defgeneric r/ (x y) 84 82 (:method ((x number) (y number)) (cl:/ x y))) 85 83 86 (defgeneric lcm (x y)84 (defgeneric r-lcm (x y) 87 85 (:method ((x integer) (y integer)) (cl:lcm x y))) 88 86 89 (defgeneric expt (x y)87 (defgeneric r-expt (x y) 90 88 (:method ((x integer) (y integer)) (cl:expt x y))) 91 89 92 (defgeneric ezgcd (x y)90 (defgeneric r-ezgcd (x y) 93 91 (:method ((x integer) (y integer) 94 &aux (c ( cl:gcd x y)))95 (values c ( cl:/ x c) (cl:/ y c))))92 &aux (c (gcd x y))) 93 (values c (/ x c) (/ y c)))) 96 94 97 (defgeneric gcd (x y)95 (defgeneric r-gcd (x y) 98 96 (:method ((x integer) (y integer)) 99 97 (cl:gcd x y))) 100 98 101 (defgeneric dimension (object))99 (defgeneric r-dimension (object)) 102 100 103 (defgeneric total-degree (object &optional start end))101 (defgeneric r-total-degree (object &optional start end)) 104 102 105 (defgeneric divides-p (object1 object2)103 (defgeneric r-divides-p (object1 object2) 106 104 (:method ((object1 integer) (object2 integer)) 107 105 (cl:zerop (rem object2 object1))) 108 106 (:documentation "Returns T if OBJECT1 divides OBJECT2")) 109 107 110 (defgeneric divides-lcm-p (object1 object2 object3)108 (defgeneric r-divides-lcm-p (object1 object2 object3) 111 109 (:documentation "Returns T if OBJECT divides LCM(OBJECT2, OBJECT3), NIL otherwise.")) 112 110 113 (defgeneric lcm-divides-lcm-p (object1 object2 object3 object4)111 (defgeneric r-lcm-divides-lcm-p (object1 object2 object3 object4) 114 112 (:documentation "Returns T if LCM(OBJECT1,OBJECT2) divides LCM(OBJECT3,OBJECT4), NIL otherwise.")) 115 113 116 (defgeneric lcm-equal-lcm-p (object1 object2 object3 object4)114 (defgeneric r-lcm-equal-lcm-p (object1 object2 object3 object4) 117 115 (:documentation "Returns T if object LCM(OBJECT1,OBJECT2) equals LCM(OBJECT3,OBJECT4), NIL otherwise.")) 118 116 119 (defgeneric equal-p (object1 object2)117 (defgeneric r-equalp (object1 object2) 120 118 (:method ((object1 t) (object2 t)) (equalp object1 object2)) 121 119 (:documentation "Equality using deep comparison of object slots.")) 122 120 123 (defgeneric elt (object index)) 121 (defgeneric r-elt (object index)) 122 (defgeneric (setf r-elt) (object index)) 124 123
Note:
See TracChangeset
for help on using the changeset viewer.