Changeset 4447 for branches/f4grobner
- Timestamp:
- 2016-06-11T08:36:52-07:00 (9 years ago)
- Location:
- branches/f4grobner
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/5am-division.lisp
r4438 r4447 190 190 for j from (1+ i) below (length gb) 191 191 do 192 (is (universal-zerop (second (multiple-value-list (poly-pseudo-divide (s-polynomial (elt gb i) (elt gb j)) gb ))))192 (is (universal-zerop (second (multiple-value-list (poly-pseudo-divide (s-polynomial (elt gb i) (elt gb j)) gb-copy)))) 193 193 "Failed with I=~S, J=~S~%" I J))) 194 194 (is (universal-equalp fl fl-copy)) -
branches/f4grobner/fast-add.lisp
r4443 r4447 1 1 (in-package "POLYNOMIAL") 2 2 3 (defun fast-a dd (p q order-fn add-fn &aux result result-last)4 ( assert (not (eq p q)))3 (defun fast-and-risky-add (p q order-fn add-fn &aux result result-last) 4 (when (and p q (eq p q)) (warn "FAST-AND-RISKY-ADD: ~S is EQ to ~S" p q)) 5 5 (flet ((add-to-result (x) 6 6 (assert (consp x)) … … 44 44 (setf q tmp)) 45 45 )))))))) 46 47 (defun fast-add (p q order-fn add-fn) 48 (let ((r1 (slow-add p q order-fn add-fn)) 49 (r2 (fast-and-risky-add p q order-fn add-fn))) 50 (unless (every #'universal-equalp r1 r2) 51 (format t "~&Error in addition of ~%~A~% and~%~A~% should be:~%" (mapcar #'->list p) (mapcar #'->list q)) 52 (princ (mapcar #'->list r1)) 53 (format t "~&Actually is:~%") 54 (princ (mapcar #'->list r2)) 55 ) 56 r2)) 57 58 59 -
branches/f4grobner/polynomial.lisp
r4444 r4447 362 362 363 363 364 (defun fast-add (p q order-fn add-fn)364 (defun slow-add (p q order-fn add-fn) 365 365 (cond 366 366 ((endp p) q) … … 372 372 (cond 373 373 (greater-p ; (> (car p) (car q)) 374 (cons (car p) ( fast-add (cdr p) q order-fn add-fn))374 (cons (car p) (slow-add (cdr p) q order-fn add-fn)) 375 375 ) 376 376 (equal-p ; (= (car p)) (car q)) … … 378 378 (cond 379 379 ((universal-zerop s) 380 ( fast-add (cdr p) (cdr q) order-fn add-fn))380 (slow-add (cdr p) (cdr q) order-fn add-fn)) 381 381 (t 382 382 ;; Adjust the lc of p 383 383 (setf (lc p) s) 384 (cons (car p) ( fast-add (cdr p) (cdr q) order-fn add-fn))384 (cons (car p) (slow-add (cdr p) (cdr q) order-fn add-fn)) 385 385 )))) 386 386 (t ;(< (car p) (car q)) 387 (cons (car q) ( fast-add p (cdr q) order-fn add-fn))387 (cons (car q) (slow-add p (cdr q) order-fn add-fn)) 388 388 )))))) 389 389 390 391 (defun fast-add (p q order-fn add-fn) 392 "This version calls SLOW-ADD and is bullet-proof." 393 (slow-add p q order-fn add-fn)) 390 394 391 395 #| -
branches/f4grobner/ring.lisp
r4383 r4447 86 86 (defgeneric universal-equalp (self other) 87 87 (:documentation "Return T if objects SELF and OTHER are equal, NIL otherwise.") 88 (:method ((object1 null) (object2 null)) t) 88 89 (:method ((object1 cons) (object2 cons)) (every #'universal-equalp object1 object2)) 89 90 (:method ((self number) (other number)) (= self other)))
Note:
See TracChangeset
for help on using the changeset viewer.