Changeset 3520
- Timestamp:
- 2015-09-05T14:12:09-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r3519 r3520 36 36 "POLY-TERM-ORDER" 37 37 "POLY-INSERT-TERM" 38 "POLY-ADD-TO" 38 39 "CHANGE-TERM-ORDER" 39 40 "STANDARD-EXTENSION" … … 225 226 &optional 226 227 (doc-string nil doc-string-supplied-p)) 227 "This macro avoids code duplication for two similar operations: ADD-TO andSUBTRACT-FROM."228 "This macro avoids code duplication for two similar operations: POLY-ADD-TO and POLY-SUBTRACT-FROM." 228 229 `(defmethod ,add/subtract-method-name ((self poly) (other poly)) 229 230 ,@(when doc-string-supplied-p `(,doc-string)) … … 239 240 (eval-when (:compile-toplevel :load-toplevel :execute) 240 241 241 (def-add/subtract-method add-to nil242 (def-add/subtract-method poly-add-to nil 242 243 "Adds to polynomial SELF another polynomial OTHER. 243 244 This operation destructively modifies both polynomials. … … 245 246 no consing, entirely reusing the sells of SELF and OTHER.") 246 247 247 (def-add/subtract-method subtract-from unary-minus248 (def-add/subtract-method poly-subtract-from unary-minus 248 249 "Subtracts from polynomial SELF another polynomial OTHER. 249 250 This operation destructively modifies both polynomials. … … 260 261 (defun add-termlists (p q order-fn) 261 262 "Destructively adds two termlists P and Q ordered according to ORDER-FN." 262 (fast-add/subtract p q order-fn #' add-to nil))263 (fast-add/subtract p q order-fn #'poly-add-to nil)) 263 264 264 265 (defmacro multiply-term-by-termlist-dropping-zeros (term termlist … … 309 310 (defmethod r+ ((poly1 poly) poly2) 310 311 "Non-destructively add POLY1 by POLY2." 311 ( add-to (copy-instance POLY1) (change-class (copy-instance POLY2) 'poly)))312 (poly-add-to (copy-instance POLY1) (change-class (copy-instance POLY2) 'poly))) 312 313 313 314 (defmethod r- ((minuend poly) &rest subtrahends) 314 315 "Non-destructively subtract MINUEND and SUBTRAHENDS." 315 ( subtract-from (copy-instance minuend)316 (poly-subtract-from (copy-instance minuend) 316 317 (change-class (reduce #'r+ subtrahends) 'poly))) 317 318 318 319 (defmethod r+ ((poly1 monom) poly2) 319 320 "Non-destructively add POLY1 by POLY2." 320 ( add-to (change-class (copy-instance poly1) 'poly)321 (poly-add-to (change-class (copy-instance poly1) 'poly) 321 322 (change-class (copy-instance poly2) 'poly))) 322 323 323 324 (defmethod r- ((minuend monom) &rest subtrahends) 324 325 "Non-destructively subtract MINUEND and SUBTRAHENDS." 325 ( subtract-from (change-class (copy-instance minuend) 'poly)326 (poly-subtract-from (change-class (copy-instance minuend) 'poly) 326 327 (change-class (reduce #'r+ subtrahends) 'poly))) 327 328
Note:
See TracChangeset
for help on using the changeset viewer.