Changeset 4514 for branches/f4grobner/polynomial-sugar.lisp
- Timestamp:
- 2016-06-17T12:18:47-07:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial-sugar.lisp
r4513 r4514 32 32 (setf (slot-value self 'value) (static-sugar self))) 33 33 34 (defmethod update-instance-for-different-class :after ((old monom) (new monom-with-sugar) &key) 35 "Add sugar to every term." 36 (reinitialize-instance new :value (static-sugar new))) 37 38 34 39 (defmethod multiply-by :after ((self sugar) (other sugar)) 35 40 (with-slots (value) … … 64 69 (setf (slot-value self 'value) (static-sugar self))) 65 70 71 (defmethod update-instance-for-different-class :after ((old poly) (new poly-with-sugar) &key) 72 "Add sugar to every term." 73 (reinitialize-instance new :termlist (mapc #'(lambda (trm) (change-class trm 'term-with-sugar)) (poly-termlist new)))) 74 75 (defmethod update-instance-for-different-class :after ((old poly-with-sugar) (new poly) &key) 76 "Drop sugar in every term." 77 (reinitialize-instance new :termlist (mapc #'(lambda (trm) (change-class trm 'term)) (poly-termlist new)))) 78 79 66 80 (defmethod add-to ((self poly-with-sugar) (other poly-with-sugar)) 67 81 "Sugar value of the sum of two polynomials, SELF and OTHER, is by definition 68 the maximum of the sugar values of the two polynomials."82 the maximum of the sugar values of the summands." 69 83 (with-accessors ((value sugar-value)) 70 84 self 71 85 (with-accessors ((other-value sugar-value)) 72 86 other 73 (setf value (max value other-value))))) 87 (setf value (max value other-value)))) 88 self) 89 90 (defmethod multiply-by ((self poly-with-sugar) (other poly-with-sugar)) 91 "Sugar value of the product of two polynomials, SELF and OTHER, is by definition 92 the sum of the sugar values of the factors." 93 (with-accessors ((value sugar-value)) 94 self 95 (with-accessors ((other-value sugar-value)) 96 other 97 (setf value (max value other-value)))) 98 self)
Note:
See TracChangeset
for help on using the changeset viewer.