close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Changeset 3520 for branches/f4grobner


Ignore:
Timestamp:
2015-09-05T14:12:09-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3519 r3520  
    3636           "POLY-TERM-ORDER"
    3737           "POLY-INSERT-TERM"
     38           "POLY-ADD-TO"
    3839           "CHANGE-TERM-ORDER"
    3940           "STANDARD-EXTENSION"
     
    225226                                   &optional
    226227                                     (doc-string nil doc-string-supplied-p))
    227   "This macro avoids code duplication for two similar operations: ADD-TO and SUBTRACT-FROM."
     228  "This macro avoids code duplication for two similar operations: POLY-ADD-TO and POLY-SUBTRACT-FROM."
    228229  `(defmethod ,add/subtract-method-name ((self poly) (other poly))
    229230     ,@(when doc-string-supplied-p `(,doc-string))
     
    239240(eval-when (:compile-toplevel :load-toplevel :execute)
    240241
    241   (def-add/subtract-method add-to nil
     242  (def-add/subtract-method poly-add-to nil
    242243    "Adds to polynomial SELF another polynomial OTHER.
    243244This operation destructively modifies both polynomials.
     
    245246no consing, entirely reusing the sells of SELF and OTHER.")
    246247
    247   (def-add/subtract-method subtract-from unary-minus
     248  (def-add/subtract-method poly-subtract-from unary-minus
    248249    "Subtracts from polynomial SELF another polynomial OTHER.
    249250This operation destructively modifies both polynomials.
     
    260261(defun add-termlists (p q order-fn)
    261262  "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))
    263264
    264265(defmacro multiply-term-by-termlist-dropping-zeros (term termlist
     
    309310(defmethod r+ ((poly1 poly) poly2)
    310311  "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)))
    312313
    313314(defmethod r- ((minuend poly) &rest subtrahends)
    314315  "Non-destructively subtract MINUEND and SUBTRAHENDS."
    315   (subtract-from (copy-instance minuend)
     316  (poly-subtract-from (copy-instance minuend)
    316317                 (change-class (reduce #'r+ subtrahends) 'poly)))
    317318
    318319(defmethod r+ ((poly1 monom) poly2)
    319320  "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)
    321322          (change-class (copy-instance poly2) 'poly)))
    322323
    323324(defmethod r- ((minuend monom) &rest subtrahends)
    324325  "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)
    326327                 (change-class (reduce #'r+ subtrahends) 'poly)))
    327328
Note: See TracChangeset for help on using the changeset viewer.