- Timestamp:
- 2015-06-17T15:34:57-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r1967 r2022 74 74 'fixnum) 75 75 76 (deftype monom (&optional dim) 77 "Type of monomial." 78 `(simple-array exponent (,dim))) 76 (defclass monom () 77 ((dim :initarg :dimension) 78 (exponents :initarg :exponents)) 79 (:default-initargs :dim 0 :exponents nil)) 79 80 80 81 ;; If a monomial is redefined as structure with slot EXPONENTS, the function … … 88 89 (initial-exponents-supplied-p (length initial-exponents)) 89 90 (t (error "You must provide DIMENSION nor INITIAL-EXPONENTS")))) 90 ( monom(cond91 92 93 94 :element-type 'exponent))95 96 97 98 :element-type 'exponent))99 100 101 91 (exponents (cond 92 ;; when exponents are supplied 93 (initial-exponents-supplied-p 94 (make-array (list dim) :initial-contents initial-exponents 95 :element-type 'exponent)) 96 ;; when all exponents are to be identical 97 (initial-exponent-supplied-p 98 (make-array (list dim) :initial-element initial-exponent 99 :element-type 'exponent)) 100 ;; otherwise, all exponents are zero 101 (t 102 (make-array (list dim) :element-type 'exponent :initial-element 0))))) 102 103 "A constructor (factory) of monomials. If DIMENSION is given, a sequence of 103 104 DIMENSION elements of type EXPONENT is constructed, where individual … … 105 106 Alternatively, all elements may be specified as a list 106 107 INITIAL-EXPONENTS." 107 monom)108 (make-instance 'monom :dim dim :exponents exponents)) 108 109 109 110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note:
See TracChangeset
for help on using the changeset viewer.