Changeset 56 for branches/f4grobner
- Timestamp:
- 2015-06-05T11:18:10-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/grobner.lisp
r54 r56 299 299 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 300 300 301 (defun spoly (ring f g)302 "It yields the S-polynomial of polynomials F and G."303 (declare (type poly f g))304 (let* ((lcm (monom-lcm (poly-lm f) (poly-lm g)))305 (mf (monom-div lcm (poly-lm f)))306 (mg (monom-div lcm (poly-lm g))))307 (declare (type monom mf mg))308 (multiple-value-bind (c cf cg)309 (funcall (ring-ezgcd ring) (poly-lc f) (poly-lc g))310 (declare (ignore c))311 (poly-sub312 ring313 (scalar-times-poly ring cg (monom-times-poly mf f))314 (scalar-times-poly ring cf (monom-times-poly mg g))))))315 316 317 (defun poly-primitive-part (ring p)318 "Divide polynomial P with integer coefficients by gcd of its319 coefficients and return the result."320 (declare (type poly p))321 (if (poly-zerop p)322 (values p 1)323 (let ((c (poly-content ring p)))324 (values (make-poly-from-termlist (mapcar325 #'(lambda (x)326 (make-term (term-monom x)327 (funcall (ring-div ring) (term-coeff x) c)))328 (poly-termlist p))329 (poly-sugar p))330 c))))331 332 (defun poly-content (ring p)333 "Greatest common divisor of the coefficients of the polynomial P. Use the RING structure334 to compute the greatest common divisor."335 (declare (type poly p))336 (reduce (ring-gcd ring) (mapcar #'term-coeff (rest (poly-termlist p))) :initial-value (poly-lc p)))337 301 338 302
Note:
See TracChangeset
for help on using the changeset viewer.