Changeset 4215
- Timestamp:
- 2016-06-04T13:27:27-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r4214 r4215 374 374 (fast-add/subtract p q order-fn #'subtract-from #'unary-minus)) 375 375 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))) 378 377 "Adds to polynomial SELF another polynomial OTHER. 379 378 This operation destructively modifies both polynomials. 380 379 The result is stored in SELF. This implementation does 381 380 no consing, entirely reusing the sells of SELF and OTHER." 382 (change-term-order other self)381 (change-term-order other-copy self) 383 382 (setf (poly-termlist self) (add-termlists 384 (poly-termlist self) (poly-termlist other )383 (poly-termlist self) (poly-termlist other-copy) 385 384 (poly-term-order self))) 386 385 self) 387 386 388 387 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. 392 390 This operation destructively modifies both polynomials. 393 391 The result is stored in SELF. This implementation does 394 392 no consing, entirely reusing the sells of SELF and OTHER." 395 (change-term-order other self)393 (change-term-order other-copy self) 396 394 (setf (poly-termlist self) (subtract-termlists 397 (poly-termlist self) (poly-termlist other )395 (poly-termlist self) (poly-termlist other-copy) 398 396 (poly-term-order self))) 399 397 self) 400 398 401 399 402 (defmethod add-to ((self poly) (other term) )400 (defmethod add-to ((self poly) (other term) &aux (other-copy (copy-instance other))) 403 401 "Adds to a polynomial SELF a term OTHER. The term OTHER is not 404 402 modified." 405 (add-to self (change-class (copy-instance other)'poly)))403 (add-to self (change-class other-copy 'poly))) 406 404 407 405 (defmethod subtract-from ((self poly) (other term))
Note:
See TracChangeset
for help on using the changeset viewer.