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 2023


Ignore:
Timestamp:
2015-06-17T15:43:01-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r2022 r2023  
    114114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    115115
    116 (defun monom-dimension (m)
    117   (declare (type monom m))
    118   (length m))
    119 
    120 (defmacro monom-elt (m index)
     116(defmethod dimension ((m monom))
     117  (slot-value m 'dim)))
     118
     119(defmethod ring-elt ((m monom) index)
    121120  "Return the power in the monomial M of variable number INDEX."
    122   `(elt ,m ,index))
    123 
    124 (defun monom-total-degree (m &optional (start 0) (end (monom-dimension m)))
     121  (with-slots (exponents)
     122      m
     123    (elt exponents index)))
     124
     125(defmethod (setf ring-elt) (new-value (m monom) index)
     126  "Return the power in the monomial M of variable number INDEX."
     127  (with-slots (exponents)
     128      m
     129    (elt exponents index)))
     130
     131(defmethod ring-total-degree ((m monom) &optional (start 0) (end (dimension m)))
    125132  "Return the todal degree of a monomoal M. Optinally, a range
    126133of variables may be specified with arguments START and END."
    127   (declare (type monom m) (type fixnum start end))
    128   (reduce #'+ m :start start :end end))
     134  (declare (type fixnum start end))
     135  (with-slots (exponents)
     136      m
     137    (reduce #'+ exponents :start start :end end)))
    129138
    130139(defun monom-sugar (m &aux (start 0) (end (monom-dimension m)))
Note: See TracChangeset for help on using the changeset viewer.