- Timestamp:
- 2015-08-27T08:39:42-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/ring.lisp
r3275 r3383 126 126 (defgeneric r-expt (x y) 127 127 (:method ((x integer) (y integer)) (expt x y)) 128 (:method (x (y integer)) 129 &aux 130 (declare (type fixnum n)) 131 (cond 132 ((minusp n) (error "r-expt: Negative exponent.")) 133 ((endp poly) (if (zerop n) 1)) 134 (t 135 (do ((k 1 (ash k 1)) 136 (q poly (r* q q)) ;keep squaring 137 (p 1 (if (not (zerop (logand k n))) (r* (r* p q) p)))) 138 ((> k n) p) 139 (declare (fixnum k)))))) 128 140 (:documentation "Raises X to power Y.")) 129 141
Note:
See TracChangeset
for help on using the changeset viewer.