- Timestamp:
- 2015-06-19T08:07:07-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/order.lisp
r2431 r2432 41 41 (proclaim '(optimize (speed 3) (space 0) (safety 0) (debug 0))) 42 42 43 (defgeneric order (p q &optional start end))44 45 43 ;; pure lexicographic 46 (defmethod lex> ((p monom) (q monom) &optional (start 0) (end (monom-dimension p))) 47 "Return T if P>Q with respect to lexicographic order, otherwise NIL. 44 (defgeneric lex> (p q &optional start end) 45 (:method ((p monom) (q monom) &optional (start 0) (end (monom-dimension p))) 46 "Return T if P>Q with respect to lexicographic order, otherwise NIL. 48 47 The second returned value is T if P=Q, otherwise it is NIL." 49 (declare (type fixnum start end))50 (do ((i start (1+ i)))51 52 (cond53 54 55 56 (return-from lex> (values nil nil))))))48 (declare (type fixnum start end)) 49 (do ((i start (1+ i))) 50 ((>= i end) (values nil t)) 51 (cond 52 ((> (r-elt p i) (r-elt q i)) 53 (return-from lex> (values t nil))) 54 ((< (r-elt p i) (r-elt q i)) 55 (return-from lex> (values nil nil))))))) 57 56 58 57 ;; total degree order , ties broken by lexicographic 59 (defmethod grlex> ((p monom) (q monom) &optional (start 0) (end (monom-dimension p))) 60 "Return T if P>Q with respect to graded lexicographic order, otherwise NIL. 58 (defgeneric grlex> (p q &optional start end) 59 (:method ((p monom) (q monom) &optional (start 0) (end (monom-dimension p))) 60 "Return T if P>Q with respect to graded lexicographic order, otherwise NIL. 61 61 The second returned value is T if P=Q, otherwise it is NIL." 62 (declare (type monom p q) (type fixnum start end))63 (let ((d1 (r-total-degree p start end))64 (d2 (r-total-degree q start end)))65 (declare (type fixnum d1 d2))66 (cond67 68 69 70 (lex> p q start end)))))62 (declare (type monom p q) (type fixnum start end)) 63 (let ((d1 (r-total-degree p start end)) 64 (d2 (r-total-degree q start end))) 65 (declare (type fixnum d1 d2)) 66 (cond 67 ((> d1 d2) (values t nil)) 68 ((< d1 d2) (values nil nil)) 69 (t 70 (lex> p q start end)))))) 71 71 72 72
Note:
See TracChangeset
for help on using the changeset viewer.