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


Ignore:
Timestamp:
2015-09-05T21:16:21-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3649 r3651  
    393393      :termlist (apply #'nconc (mapcar #'poly-termlist plist))))))
    394394
     395(defgeneric spoly (object1 object2)
     396  (:documentation "Yields the S-polynomial of OBJECT1 and OBJECT2.")
     397  (:method ((f poly) (g poly))
     398    (let* ((lcm (universal-lcm (leading-monomial f) (leading-monomial g)))
     399           (mf (divide lcm (leading-monomial f)))
     400           (mg (divide lcm (leading-monomial g))))
     401      (multiple-value-bind (c cf cg)
     402          (funcall (ring-ezgcd ring) (poly-lc f) (poly-lc g))
     403        (declare (ignore c))
     404        (subtract
     405         (multiply cg (multiply mf f))
     406         (multiply cf (multiply mg g)))))))
     407
     408
    395409#|
    396410
     
    403417
    404418
    405 (defun spoly (ring-and-order f g
    406               &aux
    407                 (ring (ro-ring ring-and-order)))
    408   "It yields the S-polynomial of polynomials F and G."
    409   (declare (type ring-and-order ring-and-order) (type poly f g))
    410   (let* ((lcm (monom-lcm (poly-lm f) (poly-lm g)))
    411          (mf (monom-div lcm (poly-lm f)))
    412          (mg (monom-div lcm (poly-lm g))))
    413     (declare (type monom mf mg))
    414     (multiple-value-bind (c cf cg)
    415         (funcall (ring-ezgcd ring) (poly-lc f) (poly-lc g))
    416       (declare (ignore c))
    417       (poly-sub
    418        ring-and-order
    419        (scalar-times-poly ring cg (monom-times-poly mf f))
    420        (scalar-times-poly ring cf (monom-times-poly mg g))))))
    421419
    422420
Note: See TracChangeset for help on using the changeset viewer.