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 774 for branches


Ignore:
Timestamp:
2015-06-08T22:14:12-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/term.lisp

    r773 r774  
    6060                                &optional
    6161                                (power 1)
    62                                 (coeff (funcall (ring-unit ring)))
    63                                 &aux
    64                                 (monom (make-monom nvars :initial-exponent 0)))
     62                                (coeff (funcall (ring-unit ring))))
    6563  "Construct a term in the polynomial ring RING[X[0],X[1],X[2],...X[NVARS-1]]
    6664over the ring RING which represents a single variable. It assumes
     
    7068defaults to the unit of the RING."
    7169  (declare (fixnum nvars pos power))
    72   (incf (monom-elt monom pos) power)
    73   (make-term monom coeff))
     70  (let ((result (make-term nvars)))
     71    (setf (monom-elt result pos) power)
     72    result))
    7473
    7574(defun term-mul (ring term1 term2)
     
    7978  (let ((c (funcall (ring-mul ring) (term-coeff term1) (term-coeff term2))))
    8079    (unless (funcall (ring-zerop ring) c)
    81       (make-term (monom-mul term1 term2) c))))
     80      (make-term (+ (monom-dimension term1) (monom-dimension term2))
     81                 :initial-exponents (monom-exponents (monom-mul term1 term2))
     82                 :coeff c))))
    8283
    8384(defun term-sugar (term)
Note: See TracChangeset for help on using the changeset viewer.