Changeset 2565
- Timestamp:
- 2015-06-19T17:23:55-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r2564 r2565 29 29 (proclaim '(optimize (speed 3) (space 0) (safety 0) (debug 0))) 30 30 31 #|32 ;;33 ;; BOA constructor, by default constructs zero polynomial34 (:constructor make-poly-from-termlist (termlist &optional (sugar (termlist-sugar termlist))))35 (:constructor make-poly-zero (&aux (termlist nil) (sugar -1)))36 ;; Constructor of polynomials representing a variable37 (:constructor make-poly-variable (ring nvars pos &optional (power 1)38 &aux39 (termlist (list40 (make-term-variable ring nvars pos power)))41 (sugar power)))42 (:constructor poly-unit (ring dimension43 &aux44 (termlist (termlist-unit ring dimension))45 (sugar 0))))46 47 |#48 49 31 (defclass poly () 50 32 ((termlist :initarg :termlist :accessor poly-termlist)) … … 111 93 (with-slots ((termlist2 termlist)) 112 94 other 113 (do ((p termlist1 (cdr p))95 (do ((p termlist1) 114 96 (q termlist2)) 115 ((endp p) 116 ;; Include remaining terms of termlist1 117 (setf termlist1 (nconc p q))) 97 ((endp q)) 118 98 ;; Copy all initial terms of q greater than (lt p) into p 119 (do ( (r q (cdr r)))99 (do () 120 100 ((cond 121 ((endp r))101 ((endp q)) 122 102 (t 123 103 (multiple-value-bind 124 104 (greater-p equal-p) 125 (lex> (lt r) (lt p))105 (lex> (lt q) (lt p)) 126 106 (cond 127 107 (greater-p 128 (push (pop r) p)) 108 (psetf (cdr q) p 109 q (cdr q) 110 (cdr p) p)) 129 111 (equal-p 130 (setf (lc p) (add-to (lc p) (lc q))))) 112 (setf (lc p) (add-to (lc p) (lc q)) 113 p (cdr p)))) 131 114 (not greater-p)))))))))) 132 115 self)
Note:
See TracChangeset
for help on using the changeset viewer.