Changeset 2442
- Timestamp:
- 2015-06-19T09:52:11-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r1927 r2442 84 84 (proclaim '(optimize (speed 3) (space 0) (safety 0) (debug 0))) 85 85 86 (defstruct (poly 86 #| 87 87 ;; 88 88 ;; BOA constructor, by default constructs zero polynomial … … 99 99 (termlist (termlist-unit ring dimension)) 100 100 (sugar 0)))) 101 (termlist nil :type list) 102 (sugar -1 :type fixnum)) 101 102 |# 103 104 (defclass poly () 105 ((termlist :initarg :terms :accessor poly-termlist)) 106 (:default-initargs :termlist nil)) 103 107 104 108 ;; Leading term 105 (defmacro poly-lt (p) `(car (poly-termlist ,p))) 109 (defgeneric leading-term (object) 110 (:method ((self poly)) 111 (car (poly-termlist self)))) 106 112 107 113 ;; Second term 108 (defmacro poly-second-lt (p) `(cadar (poly-termlist ,p))) 109 110 ;; Leading monomial 111 (defun poly-lm (p) 112 (declare (type poly p)) 113 (term-monom (poly-lt p))) 114 115 ;; Second monomial 116 (defun poly-second-lm (p) 117 (declare (type poly p)) 118 (term-monom (poly-second-lt p))) 114 (defgeneric second-leading-term (object) 115 (:method ((self poly)) 116 (cadar (poly-termlist self)))) 119 117 120 118 ;; Leading coefficient 121 (def un poly-lc (p)122 ( declare (type poly p))123 (term-coeff (poly-lt p)))119 (defgeneric leading-coefficient (object) 120 (:method ((self poly)) 121 (r-coeff (leading-term self)))) 124 122 125 123 ;; Second coefficient 126 (def un poly-second-lc (p)127 ( declare (type poly p))128 (term-coeff (poly-second-lt p)))124 (defgeneric second-leading-coefficient (object) 125 (:method ((self poly)) 126 (term-coeff (second-leading-term self)))) 129 127 130 128 ;; Testing for a zero polynomial
Note:
See TracChangeset
for help on using the changeset viewer.