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


Ignore:
Timestamp:
2016-06-11T08:36:52-07:00 (9 years ago)
Author:
Marek Rychlik
Message:
 
Location:
branches/f4grobner
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/5am-division.lisp

    r4438 r4447  
    190190              for j from (1+ i) below (length gb)
    191191              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))))
    193193                    "Failed with I=~S, J=~S~%" I J)))
    194194      (is (universal-equalp fl fl-copy))
  • branches/f4grobner/fast-add.lisp

    r4443 r4447  
    11(in-package "POLYNOMIAL")
    22
    3 (defun fast-add (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))
    55  (flet ((add-to-result (x)
    66           (assert (consp x))
     
    4444                 (setf q tmp))
    4545               ))))))))
     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  
    362362
    363363
    364 (defun fast-add (p q order-fn add-fn)
     364(defun slow-add (p q order-fn add-fn)
    365365  (cond
    366366    ((endp p) q)
     
    372372       (cond
    373373         (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))
    375375          )
    376376         (equal-p                       ; (= (car p)) (car q))
     
    378378            (cond
    379379              ((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))
    381381              (t
    382382               ;; Adjust the lc of p
    383383               (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))
    385385               ))))
    386386         (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))
    388388          ))))))
    389389
     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))
    390394
    391395#|
  • branches/f4grobner/ring.lisp

    r4383 r4447  
    8686(defgeneric universal-equalp (self other)
    8787  (:documentation "Return T if objects SELF and OTHER are equal, NIL otherwise.")
     88  (:method ((object1 null) (object2 null)) t)
    8889  (:method ((object1 cons) (object2 cons)) (every #'universal-equalp object1 object2))
    8990  (:method ((self number) (other number)) (= self other)))
Note: See TracChangeset for help on using the changeset viewer.