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 1010


Ignore:
Timestamp:
2015-06-10T06:36:01-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/parse.lisp

    r1009 r1010  
    284284       (otherwise
    285285        (let ((r (mapcar
    286                   #'(lambda (e) (poly-eval-1 e vars order ring))
     286                  #'(lambda (e) (poly-eval-1 ring-and-order e vars))
    287287                  (cdr expr))))
    288288          (ecase (car expr)
    289             (+ (reduce #'(lambda (p q) ($poly+ p q n order ring)) r))
     289            (+ (reduce #'(lambda (p q) ($poly+ ring-and-order p q n)) r))
    290290            (-
    291291             (if (endp (cdr r))
    292                  ($minus-poly (car r) n ring)
    293                  ($poly- (car r)
    294                          (reduce #'(lambda (p q) ($poly+ p q n order ring)) (cdr r))
    295                          n
    296                          order ring)))
     292                 ($minus-poly ring (car r) n)
     293                 ($poly- ring-and-order
     294                         (car r)
     295                         (reduce #'(lambda (p q) ($poly+ ring-and-order p q n)) (cdr r))
     296                         n)))
    297297            (*
    298              (reduce #'(lambda (p q) ($poly* p q n order ring)) r))
     298             (reduce #'(lambda (p q) ($poly* ring-and-order p q n)) r))
    299299            )))))))
    300300
    301301             
    302 (defun poly-eval (expr vars &optional (order #'lex>) (ring *coefficient-ring*))
     302(defun poly-eval (expr vars
     303                  &optional (order #'lex>) (ring *coefficient-ring*)
     304                  &aux
     305                    (ring-and-order (make-ring-and-order ring order)))
    303306  "Evaluate an expression EXPR, which should be a polynomial
    304307expression or a list of polynomial expressions (a list of expressions
     
    312315   ((numberp expr)
    313316    (unless (zerop expr)
    314       (list (cons (make-list (length vars) :initial-element 0) expr))))
     317      (make-poly-from-termlist
     318       (list (make-term (make-monom :dimension (length vars)) expr)))))
    315319   ((or (symbolp expr) (not (eq (car expr) :[)))
    316     (poly-eval-1 expr vars order ring))
    317    (t (cons '[ (mapcar #'(lambda (p) (poly-eval-1 p vars order ring)) (rest expr))))))
     320    (poly-eval-1 ring-and-order expr vars))
     321   (t (cons '[ (mapcar #'(lambda (p) (poly-eval-1 ring-and-order p vars)) (rest expr))))))
    318322
    319323
Note: See TracChangeset for help on using the changeset viewer.