- Timestamp:
- 2015-06-19T17:31:46-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r2565 r2566 87 87 88 88 (defmethod add-to ((self poly) (other poly)) 89 "Adds to polynomial SELF another polynomial OTHER. 90 This operation destructively modifies both polynomials. 91 The result is stored in SELF. This implementation does 92 no consing, entirely reusing the sells of SELF and OTHER." 89 93 (macrolet ((lt (termlist) `(car ,termlist)) 90 94 (lc (termlist) `(r-coeff (car ,termlist)))) … … 96 100 (q termlist2)) 97 101 ((endp q)) 98 ;; Copy all initial terms of q greater than (lt p) into p 99 (do () 100 ((cond 101 ((endp q)) 102 (t 103 (multiple-value-bind 104 (greater-p equal-p) 105 (lex> (lt q) (lt p)) 106 (cond 107 (greater-p 108 (psetf (cdr q) p 109 q (cdr q) 110 (cdr p) p)) 111 (equal-p 112 (setf (lc p) (add-to (lc p) (lc q)) 113 p (cdr p)))) 114 (not greater-p)))))))))) 102 (multiple-value-bind 103 (greater-p equal-p) 104 (lex> (lt q) (lt p)) 105 (cond 106 (greater-p 107 (psetf (cdr q) p 108 q (cdr q) 109 (cdr p) p)) 110 (equal-p 111 (setf (lc p) (add-to (lc p) (lc q)) 112 p (cdr p) 113 q (cdr q)))) 114 (not greater-p)))))) 115 115 self) 116 116
Note:
See TracChangeset
for help on using the changeset viewer.