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 3510 for branches/f4grobner


Ignore:
Timestamp:
2015-09-05T11:24:49-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3509 r3510  
    8080    self))
    8181
     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
    8298(defun alist->poly (alist &aux (poly (make-instance 'poly)))
    8399  "It reads polynomial from an alist formatted as ( ... (exponents . coeff) ...).
     
    106122       (eq (poly-term-order self) (poly-term-order other))))
    107123
    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))
    123124
    124125;; Leading term
Note: See TracChangeset for help on using the changeset viewer.