- Timestamp:
- 2015-06-20T20:50:24-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r2786 r2787 192 192 193 193 194 (defmethod multiply-by ((self poly) (other poly)) 195 (cond ((or (endp p) (endp q)) nil) ;p or q is 0 (represented by NIL) 196 ;; If p=p0+p1 and q=q0+q1 then p*q=p0*q0+p0*q1+p1*q 197 ((endp (cdr p)) 198 (term-times-termlist ring (car p) q)) 199 ((endp (cdr q)) 200 (termlist-times-term ring p (car q))) 201 (t 202 (let ((head (term-mul-lst ring (termlist-lt p) (termlist-lt q))) 203 (tail (termlist-add ring-and-order 204 (term-times-termlist ring (car p) (cdr q)) 205 (termlist-mul ring-and-order (cdr p) q)))) 206 (cond ((null head) tail) 207 ((null tail) head) 208 (t (nconc head tail))))))) 209 210 194 (defun fast-multiply (p q) 195 (cond 196 ((or (endp p) (endp q)) nil) ;p or q is 0 (represented by NIL) 197 ;; If p=p0+p1 and q=q0+q1 then p*q=p0*q0+p0*q1+p1*q 198 ((endp (cdr p)) 199 (term-times-termlist (car p) q)) 200 ((endp (cdr q)) 201 (termlist-times-term p (car q))) 202 (t 203 (let ((head (term-mul-lst (termlist-lt p) (termlist-lt q))) 204 (tail (termlist-add (term-times-termlist (car p) (cdr q)) 205 (termlist-mul (cdr p) q)))) 206 (cond ((null head) tail) 207 ((null tail) head) 208 (t (nconc head tail))))))) 211 209 212 210 #|
Note:
See TracChangeset
for help on using the changeset viewer.