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 2787


Ignore:
Timestamp:
2015-06-20T20:50:24-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r2786 r2787  
    192192
    193193
    194 (defmethod multiply-by ((self poly) (other poly))
    195   (cond ((or (endp p) (endp q)) nil)    ;p or q is 0 (represented by NIL)
    196         ;; If p=p0+p1 and q=q0+q1 then p*q=p0*q0+p0*q1+p1*q
    197         ((endp (cdr p))
    198          (term-times-termlist ring (car p) q))
    199         ((endp (cdr q))
    200          (termlist-times-term ring p (car q)))
    201         (t
    202          (let ((head (term-mul-lst ring (termlist-lt p) (termlist-lt q)))
    203                (tail (termlist-add ring-and-order
    204                                    (term-times-termlist ring (car p) (cdr q))
    205                                    (termlist-mul ring-and-order (cdr p) q))))
    206            (cond ((null head) tail)
    207                  ((null tail) head)
    208                  (t (nconc head tail)))))))
    209 
    210 
     194(defun fast-multiply (p q)
     195  (cond
     196    ((or (endp p) (endp q)) nil)        ;p or q is 0 (represented by NIL)
     197    ;; If p=p0+p1 and q=q0+q1 then p*q=p0*q0+p0*q1+p1*q
     198    ((endp (cdr p))
     199     (term-times-termlist (car p) q))
     200    ((endp (cdr q))
     201     (termlist-times-term p (car q)))
     202    (t
     203     (let ((head (term-mul-lst (termlist-lt p) (termlist-lt q)))
     204           (tail (termlist-add (term-times-termlist (car p) (cdr q))
     205                               (termlist-mul (cdr p) q))))
     206       (cond ((null head) tail)
     207             ((null tail) head)
     208             (t (nconc head tail)))))))
    211209
    212210#|
Note: See TracChangeset for help on using the changeset viewer.