Changeset 1128 for branches/f4grobner
- Timestamp:
- 2015-06-10T18:08:43-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r1127 r1128 243 243 0)) 244 244 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 245 253 (defun poly-eval (expr vars 246 254 &optional … … 251 259 (ring-and-order (make-ring-and-order :ring ring :order order))) 252 260 (labels ((p-eval (arg) (poly-eval arg vars ring order)) 253 (p-eval-scalar (arg) (poly-lc (poly-eval arg nil ring order)))254 261 (p-eval-list (args) (mapcar #'p-eval args)) 255 262 (p-add (x y) (poly-add ring-and-order x y))) 256 263 (cond 264 ((null expr) (error "Empty expression")) 257 265 ((eql expr 0) (make-poly-zero)) 258 266 ((member expr vars :test #'equalp) … … 282 290 ;; A special case (/ ?), the inverse 283 291 (coerce-coeff ring (apply (ring-div ring) (cdr expr)) vars)) 284 ( (endp (cdddr expr))292 (t 285 293 (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 ) 292 297 (scalar-times-poly ring denom-inverse num))))) 293 298 (expt
Note:
See TracChangeset
for help on using the changeset viewer.