- Timestamp:
- 2015-06-23T10:15:11-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r3321 r3322 136 136 137 137 (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)) 141 141 other 142 (unless (= dimension1 dimension2)143 (error "Incompatible dimensions : ~A and ~A.~%" dimension1 dimension2))142 (unless (= (length exponents1) (length exponents2)) 143 (error "Incompatible dimensions")) 144 144 (map-into exponents1 #'+ exponents1 exponents2))) 145 145 self) 146 146 147 147 (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)) 151 151 other 152 (unless (= dimension1 dimension2)153 (error "Incompatible dimensions : ~A and ~A.~%" dimension1 dimension2))152 (unless (= (length exponents1) (length exponents2)) 153 (error "Incompatible dimensions")) 154 154 (map-into exponents1 #'- exponents1 exponents2))) 155 155 self) … … 226 226 (defmethod r-lcm ((m1 monom) (m2 monom)) 227 227 "Returns least common multiple of monomials M1 and M2." 228 (with-slots ((exponents1 exponents) (dimension1 dimension))228 (with-slots ((exponents1 exponents)) 229 229 m1 230 230 (with-slots ((exponents2 exponents)) … … 233 233 (dimension dimension1)) 234 234 (map-into exponents #'max exponents1 exponents2) 235 (make-instance 'monom : dimension dimension :exponents exponents)))))235 (make-instance 'monom :exponents exponents))))) 236 236 237 237 238 238 (defmethod r-gcd ((m1 monom) (m2 monom)) 239 239 "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))) 246 245 (map-into exponents #'min exponents1 exponents2) 247 (make-instance 'monom : dimension dimension :exponents exponents)))))246 (make-instance 'monom :exponents exponents))))) 248 247 249 248 (defmethod r-depends-p ((m monom) k)
Note:
See TracChangeset
for help on using the changeset viewer.