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 2082 for branches


Ignore:
Timestamp:
2015-06-17T19:31:45-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r2081 r2082  
    232232(defmethod ring-lcm ((m1 monom) (m2 monom))
    233233  "Returns least common multiple of monomials M1 and M2."
    234   (let* ((exponents (copy-seq exponents1))
    235          (dim (reduce #'+ exponents)))
    236     (map-into exponents #'max exponents1 exponents2)
    237     (make-instance 'monom :dim dim :exponents exponents)))))
    238 
    239 
    240 (defun monom-gcd (m1 m2 &aux (result (copy-seq m1)))
     234  (with-slots (exponents1 exponents)
     235      m1
     236    (with-slots (exponents2 exponents)
     237        m2
     238      (let* ((exponents (copy-seq exponents1))
     239             (dim (reduce #'+ exponents)))
     240        (map-into exponents #'max exponents1 exponents2)
     241        (make-instance 'monom :dim dim :exponents exponents)))))
     242
     243
     244(defmethod ring-gcd ((m1 monom) (m2 monom))
    241245  "Returns greatest common divisor of monomials M1 and M2."
    242   (declare (type monom m1 m2 result))
    243   (map-into result #'min m1 m2))
     246  (with-slots (exponents1 exponents)
     247      m1
     248    (with-slots (exponents2 exponents)
     249        m2
     250      (let* ((exponents (copy-seq exponents1))
     251             (dim (reduce #'+ exponents)))
     252        (map-into exponents #'min exponents1 exponents2)
     253        (make-instance 'monom :dim dim :exponents exponents)))))
    244254
    245255(defun monom-depends-p (m k)
Note: See TracChangeset for help on using the changeset viewer.