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 3682 for branches/f4grobner


Ignore:
Timestamp:
2015-09-06T05:42:59-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3679 r3682  
    444444            :initial-value (leading-coefficient self))))
    445445
     446(defgeneric poly-primitive-part (self)
     447  (:documentation "Divide polynomial SELF by gcd of its
     448coefficients. Return SELF.")
     449  (:method ((self poly))
     450    (if (universal-zerop object)
     451        (values object 1)
     452        (let ((c (poly-content object)))
     453          (mapc #'(lambda (x)
     454                    (setf (term-coeff x) (divide (term-coeff x) c)))
     455                (poly-termlist p))))
     456    self))
     457
     458
    446459#|
    447460
     
    451464  (polysaturation-extension ring f (list p)))
    452465
    453 (defun poly-primitive-part (ring p)
    454   "Divide polynomial P with integer coefficients by gcd of its
    455 coefficients and return the result."
    456   (declare (type ring ring) (type poly p))
    457   (if (poly-zerop p)
    458       (values p 1)
    459       (let ((c (poly-content ring p)))
    460         (values (make-poly-from-termlist
    461                  (mapcar
    462                   #'(lambda (x)
    463                       (make-term :monom (term-monom x)
    464                                  :coeff (funcall (ring-div ring) (term-coeff x) c)))
    465                   (poly-termlist p))
    466                  (poly-sugar p))
    467                 c))))
    468466
    469467
Note: See TracChangeset for help on using the changeset viewer.