Changeset 2023 for branches/f4grobner
- Timestamp:
- 2015-06-17T15:43:01-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r2022 r2023 114 114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 115 115 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) 121 120 "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))) 125 132 "Return the todal degree of a monomoal M. Optinally, a range 126 133 of 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))) 129 138 130 139 (defun monom-sugar (m &aux (start 0) (end (monom-dimension m)))
Note:
See TracChangeset
for help on using the changeset viewer.