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


Ignore:
Timestamp:
2015-06-10T18:08:43-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r1127 r1128  
    243243                           0))
    244244
     245(defun poly-eval-scalar (expr
     246                         &optional
     247                           (ring *ring-of-integers*)
     248                         &aux
     249                           (order #'lex>))
     250  "Evaluate a scalar expression EXPR in ring RING."
     251  (poly-lc (poly-eval expr nil ring order)))
     252
    245253(defun poly-eval (expr vars
    246254                  &optional
     
    251259                    (ring-and-order (make-ring-and-order :ring ring :order order)))
    252260  (labels ((p-eval (arg) (poly-eval arg vars ring order))
    253            (p-eval-scalar (arg) (poly-lc (poly-eval arg nil ring order)))
    254261           (p-eval-list (args) (mapcar #'p-eval args))
    255262           (p-add (x y) (poly-add ring-and-order x y)))
    256263    (cond
     264      ((null expr) (error "Empty expression"))
    257265      ((eql expr 0) (make-poly-zero))
    258266      ((member expr vars :test #'equalp)
     
    282290             ;; A special case (/ ?), the inverse
    283291             (coerce-coeff ring (apply (ring-div ring) (cdr expr)) vars))
    284             ((endp (cdddr expr))
     292            (t
    285293             (let ((num (p-eval (cadr expr)))
    286                    (denom-inverse (p-eval-scalar `(/ (ring-unit ring) @,(cddr expr)))))
    287                (scalar-times-poly ring denom-inverse num)))
    288             (t
    289              ;; TODO: Make this work
    290              (let ((num (p-eval (cadr expr)))
    291                    (denom-inverse (print (funcall (ring-div ring) (cons (ring-unit ring) (cddr expr))))))
     294                   (denom-inverse (poly-eval-scalar '(/ 1 2 3) ring))
     295                   ;;(denom-inverse (p-eval-scalar `(/ (ring-unit ring) @,(cddr expr))))
     296                   )
    292297               (scalar-times-poly ring denom-inverse num)))))
    293298         (expt
Note: See TracChangeset for help on using the changeset viewer.