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


Ignore:
Timestamp:
2015-06-11T13:13:36-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/termlist.lisp

    r1201 r1227  
    122122(defun monom-times-termlist (m f)
    123123  (cond
    124    ((null f) nil)
    125    (t
    126     (mapcar #'(lambda (x) (monom-times-term m x)) f))))
     124    ((null f) nil)
     125    (t
     126     (mapcar #'(lambda (x) (monom-times-term m x)) f))))
    127127
    128128(defun termlist-uminus (ring f)
     
    212212                 ((null tail) head)
    213213                 (t (nconc head tail)))))))
    214                    
     214
    215215(defun termlist-unit (ring dim)
    216216  (declare (fixnum dim) (ring ring))
    217217  (list (make-term (make-monom :dimension dim) (funcall (ring-unit ring)))))
    218                    
     218
    219219
    220220(defun termlist-expt (ring-and-order poly n
     
    224224  (declare (type fixnum n dim) (ring-and-order ring-and-order))
    225225  (cond
    226    ((minusp n) (error "termlist-expt: Negative exponent."))
    227    ((endp poly) (if (zerop n) (termlist-unit ring dim) nil))
    228    (t
    229     (do ((k 1 (ash k 1))
    230          (q poly (termlist-mul ring-and-order q q)) ;keep squaring
    231          (p (termlist-unit ring dim) (if (not (zerop (logand k n))) (termlist-mul ring-and-order p q) p)))
    232         ((> k n) p)
    233       (declare (fixnum k))))))
     226    ((minusp n) (error "termlist-expt: Negative exponent."))
     227    ((endp poly) (if (zerop n) (termlist-unit ring dim) nil))
     228    (t
     229     (do ((k 1 (ash k 1))
     230          (q poly (termlist-mul ring-and-order q q)) ;keep squaring
     231          (p (termlist-unit ring dim) (if (not (zerop (logand k n))) (termlist-mul ring-and-order p q) p)))
     232         ((> k n) p)
     233       (declare (fixnum k))))))
Note: See TracChangeset for help on using the changeset viewer.