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


Ignore:
Timestamp:
2015-06-19T10:15:19-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r2447 r2448  
    134134  (length (poly-termlist self)))
    135135
    136 (defmethod multiply-by-scalar ((self poly) scalar)
    137   "The scalar product of a polynomial SELF by a scalar SCALAR."
    138   (mapc #'(lambda (term) (multiply-by-scalar term scalar)) (poly-termlist self))
    139   self)
    140 
    141 (defun multiply-by-monom ((self poly) (monom monom))
    142   (mapc #'(lambda (term) (r* term monom)) (poly-termlist self))
    143   self)
    144 
    145 
    146 (defun term-times-poly (ring term p)
    147   (declare (type ring ring) (type term term) (type poly p))
    148   (make-poly-from-termlist
    149    (term-times-termlist ring term (poly-termlist p))
    150    (+ (poly-sugar p) (term-sugar term))))
    151 
    152 (defun poly-add (ring-and-order p q)
    153   (declare (type ring-and-order ring-and-order) (type poly p q))
    154   (make-poly-from-termlist
    155    (termlist-add ring-and-order
    156                  (poly-termlist p)
    157                  (poly-termlist q))
    158    (max (poly-sugar p) (poly-sugar q))))
    159 
    160 (defun poly-sub (ring-and-order p q)
    161   (declare (type ring-and-order ring-and-order) (type poly p q))
    162   (make-poly-from-termlist
    163    (termlist-sub ring-and-order (poly-termlist p) (poly-termlist q))
    164    (max (poly-sugar p) (poly-sugar q))))
    165 
    166 (defun poly-uminus (ring p)
    167   (declare (type ring ring) (type poly p))
    168   (make-poly-from-termlist
    169    (termlist-uminus ring (poly-termlist p))
    170    (poly-sugar p)))
    171 
    172 (defun poly-mul (ring-and-order p q)
    173   (declare (type ring-and-order ring-and-order) (type poly p q))
    174   (make-poly-from-termlist
    175    (termlist-mul ring-and-order (poly-termlist p) (poly-termlist q))
    176    (+ (poly-sugar p) (poly-sugar q))))
    177 
    178 (defun poly-expt (ring-and-order p n)
    179   (declare (type ring-and-order ring-and-order) (type poly p))
    180   (make-poly-from-termlist (termlist-expt ring-and-order (poly-termlist p) n) (* n (poly-sugar p))))
     136(defgeneric multiply-by (self other)
     137  (:method ((self poly) (other scalar))
     138    (mapc #'(lambda (term) (multiply-by term other)) (poly-termlist self))
     139    self)
     140  (:method ((self poly) (other monom))
     141    (mapc #'(lambda (term) (multiply-by term monom)) (poly-termlist self))
     142    self))
     143
     144(defgeneric add-to (self other)
     145  (:method ((self poly) (other poly))))
     146
     147(defgeneric subtract-from (self other)
     148  (:method ((self poly) (other poly))))
     149
     150(defmethod unary-uminus (self))
    181151
    182152(defun poly-append (&rest plist)
Note: See TracChangeset for help on using the changeset viewer.