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 4215 for branches


Ignore:
Timestamp:
2016-06-04T13:27:27-07:00 (8 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r4214 r4215  
    374374  (fast-add/subtract p q order-fn #'subtract-from #'unary-minus))
    375375
    376 (defmethod add-to ((self poly) (other poly)
    377                    &aux (other (copy-instance other)))
     376(defmethod add-to ((self poly) (other poly) &aux (other-copy (copy-instance other)))
    378377  "Adds to polynomial SELF another polynomial OTHER.
    379378This operation destructively modifies both polynomials.
    380379The result is stored in SELF. This implementation does
    381380no consing, entirely reusing the sells of SELF and OTHER."
    382   (change-term-order other self)
     381  (change-term-order other-copy self)
    383382  (setf (poly-termlist self) (add-termlists
    384                               (poly-termlist self) (poly-termlist other)
     383                              (poly-termlist self) (poly-termlist other-copy)
    385384                              (poly-term-order self)))
    386385  self)
    387386 
    388387
    389 (defmethod subtract-from ((self poly) (other poly)
    390                           &aux (other (copy-instance other))))
    391     "Subtracts from polynomial SELF another polynomial OTHER.
     388(defmethod subtract-from ((self poly) (other poly) &aux (other-copy (copy-instance other)))
     389  "Subtracts from polynomial SELF another polynomial OTHER.
    392390This operation destructively modifies both polynomials.
    393391The result is stored in SELF. This implementation does
    394392no consing, entirely reusing the sells of SELF and OTHER."
    395   (change-term-order other self)
     393  (change-term-order other-copy self)
    396394  (setf (poly-termlist self) (subtract-termlists
    397                               (poly-termlist self) (poly-termlist other)
     395                              (poly-termlist self) (poly-termlist other-copy)
    398396                              (poly-term-order self)))
    399397  self)
    400398
    401399
    402 (defmethod add-to ((self poly) (other term))
     400(defmethod add-to ((self poly) (other term) &aux (other-copy (copy-instance other)))
    403401  "Adds to a polynomial SELF a term OTHER. The term OTHER is not
    404402modified."
    405   (add-to self (change-class (copy-instance other) 'poly)))
     403  (add-to self (change-class other-copy 'poly)))
    406404
    407405(defmethod subtract-from ((self poly) (other term))
Note: See TracChangeset for help on using the changeset viewer.