- Timestamp:
- 2015-09-05T11:24:49-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r3509 r3510 80 80 self)) 81 81 82 (defgeneric poly-insert-term (self monom coeff) 83 (:method ((self poly) (monom monom) coeff) 84 (cond ((null (poly-dimension self)) 85 (setf (poly-dimension self) (monom-dimension monom))) 86 (t (assert (= (poly-dimension self) (monom-dimension monom))))) 87 (push (cons monom coeff) (poly-termlist self)) 88 self)) 89 90 (defgeneric poly-append-term (self monom coeff) 91 (:method ((self poly) (monom monom) coeff) 92 (cond ((null (poly-dimension self)) 93 (setf (poly-dimension self) (monom-dimension monom))) 94 (t (assert (= (poly-dimension self) (monom-dimension monom))))) 95 (setf (cdr (last (poly-termlist self))) (list (cons monom coeff))) 96 self)) 97 82 98 (defun alist->poly (alist &aux (poly (make-instance 'poly))) 83 99 "It reads polynomial from an alist formatted as ( ... (exponents . coeff) ...). … … 106 122 (eq (poly-term-order self) (poly-term-order other)))) 107 123 108 (defgeneric poly-insert-term (self monom coeff)109 (:method ((self poly) (monom monom) coeff)110 (cond ((null (poly-dimension self))111 (setf (poly-dimension self) (monom-dimension monom)))112 (t (assert (= (poly-dimension self) (monom-dimension monom)))))113 (push (cons monom coeff) (poly-termlist self))114 self))115 116 (defgeneric poly-append-term (self monom coeff)117 (:method ((self poly) (monom monom) coeff)118 (cond ((null (poly-dimension self))119 (setf (poly-dimension self) (monom-dimension monom)))120 (t (assert (= (poly-dimension self) (monom-dimension monom)))))121 (setf (cdr (last (poly-termlist self))) (list (cons monom coeff)))122 self))123 124 124 125 ;; Leading term
Note:
See TracChangeset
for help on using the changeset viewer.