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


Ignore:
Timestamp:
2015-06-22T07:48:57-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r3106 r3107  
    337337  plist)
    338338
    339 #|
    340 
    341 (defun standard-sum (F plist
    342                                  &aux
    343                                    (k (length plist))
    344                                    (d (+ k (monom-dimension (poly-lt (car plist)))))
    345                                    ;; Add k variables to f
    346                                    (f (poly-list-add-variables f k))
    347                                    ;; Set PLIST to [U1*P1,U2*P2,...,UK*PK]
    348                                    (plist (apply #'nconc (poly-standard-extension plist))))
     339
     340(defun standard-sum (plist
     341                     &aux
     342                       (plist (standard-extension plist))
     343                       (nvars (poly-dimension (car plist))))
    349344  "Calculate the polynomial U1*P1+U2*P2+...+UK*PK-1, where PLIST=[P1,P2,...,PK].
    350345Firstly, new K variables, U1, U2, ..., UK, are inserted into each
     
    354349which is equivalent to using a lexicographic order on the first K
    355350variables."
    356   (setf (cdr (last (poly-termlist plist)))
    357         ;; Add -1 as the last term
    358         (list (make-term :monom (make-monom :dimension d)
    359                          :coeff (funcall (ring-uminus ring) (funcall (ring-unit ring))))))
    360   (append f (list plist)))
    361 
     351  (flet ((subtract-1 (p)
     352           (append-item p (make-instance 'term :coeff -1 :dimension nvars))))
     353    (make-instance
     354     'poly
     355     :termlist (mapcon #'poly-termlist plist))
     356    (setf plist (mapc #'subtract-1 plist)))
     357)
     358
     359
     360#|
    362361
    363362
Note: See TracChangeset for help on using the changeset viewer.