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 3322


Ignore:
Timestamp:
2015-06-23T10:15:11-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r3321 r3322  
    136136
    137137(defmethod multiply-by ((self monom) (other monom))
    138   (with-slots ((exponents1 exponents) (dimension1 dimension))
    139       self
    140     (with-slots ((exponents2 exponents) (dimension2 dimension))
     138  (with-slots ((exponents1 exponents))
     139      self
     140    (with-slots ((exponents2 exponents))
    141141        other
    142       (unless (= dimension1 dimension2)
    143         (error "Incompatible dimensions: ~A and ~A.~%" dimension1 dimension2))
     142      (unless (= (length exponents1) (length exponents2))
     143        (error "Incompatible dimensions"))
    144144      (map-into exponents1 #'+ exponents1 exponents2)))
    145145  self)
    146146
    147147(defmethod divide-by ((self monom) (other monom))
    148   (with-slots ((exponents1 exponents) (dimension1 dimension))
    149       self
    150     (with-slots ((exponents2 exponents) (dimension2 dimension))
     148  (with-slots ((exponents1 exponents))
     149      self
     150    (with-slots ((exponents2 exponents))
    151151        other
    152       (unless (= dimension1 dimension2)
    153         (error "Incompatible dimensions: ~A and ~A.~%" dimension1 dimension2))
     152      (unless (= (length exponents1) (length exponents2))
     153        (error "Incompatible dimensions"))
    154154      (map-into exponents1 #'- exponents1 exponents2)))
    155155  self)
     
    226226(defmethod r-lcm ((m1 monom) (m2 monom))
    227227  "Returns least common multiple of monomials M1 and M2."
    228   (with-slots ((exponents1 exponents) (dimension1 dimension))
     228  (with-slots ((exponents1 exponents))
    229229      m1
    230230    (with-slots ((exponents2 exponents))
     
    233233             (dimension dimension1))
    234234        (map-into exponents #'max exponents1 exponents2)
    235         (make-instance 'monom :dimension dimension :exponents exponents)))))
     235        (make-instance 'monom :exponents exponents)))))
    236236
    237237
    238238(defmethod r-gcd ((m1 monom) (m2 monom))
    239239  "Returns greatest common divisor of monomials M1 and M2."
    240   (with-slots ((exponents1 exponents) (dimension1 dimension))
    241       m1
    242     (with-slots ((exponents2 exponents))
    243         m2
    244       (let* ((exponents (copy-seq exponents1))
    245              (dimension dimension1))
     240  (with-slots ((exponents1 exponents))
     241      m1
     242    (with-slots ((exponents2 exponents))
     243        m2
     244      (let* ((exponents (copy-seq exponents1)))
    246245        (map-into exponents #'min exponents1 exponents2)
    247         (make-instance 'monom :dimension dimension :exponents exponents)))))
     246        (make-instance 'monom :exponents exponents)))))
    248247
    249248(defmethod r-depends-p ((m monom) k)
Note: See TracChangeset for help on using the changeset viewer.