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 3533


Ignore:
Timestamp:
2015-09-05T15:58:06-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/monom.lisp

    r3532 r3533  
    477477                   (values primary nil))))))))
    478478
    479 
    480479(defclass term (monom)
    481480  ((coeff :initarg :coeff :accessor term-coeff))
     
    492491              exponents coeff))))
    493492
    494 
    495 (defmethod r-equalp ((term1 term) (term2 term))
    496   (when (r-equalp (scalar-coeff term1) (scalar-coeff term2))
     493(defmethod monom-equalp ((term1 term) (term2 term))
     494  (when (equalp (term-coeff term1) (term-coeff term2))
    497495    (call-next-method)))
    498496
    499 (defmethod update-instance-for-different-class :after ((old monom) (new  scalar) &key)
    500   (setf (scalar-coeff new) 1))
    501 
    502 (defmethod multiply-by :before ((self term) (other term))
     497(defmethod update-instance-for-different-class :after ((old monom) (new term) &key)
     498  (setf (term-coeff new) 1))
     499
     500(defmethod monom-multiply-by ((self term) (other term))
    503501  "Destructively multiply terms SELF and OTHER and store the result into SELF.
    504502It returns SELF."
    505503  (setf (scalar-coeff self) (multiply-by (scalar-coeff self) (scalar-coeff other))))
    506504
    507 (defmethod left-tensor-product-by ((self term) (other term))
    508   (setf (scalar-coeff self) (multiply-by (scalar-coeff self) (scalar-coeff other)))
     505(defmethod monom-left-tensor-product-by ((self term) (other term))
     506  (setf (term-coeff self) (multiply-by (term-coeff self) (term-coeff other)))
    509507  (call-next-method))
    510508
    511 (defmethod right-tensor-product-by ((self term) (other term))
    512   (setf (scalar-coeff self) (multiply-by (scalar-coeff self) (scalar-coeff other)))
     509(defmethod monom-right-tensor-product-by ((self term) (other term))
     510  (setf (term-coeff self) (multiply-by (term-coeff self) (term-coeff other)))
    513511  (call-next-method))
    514512
    515 (defmethod left-tensor-product-by ((self term) (other monom))
    516   (call-next-method))
    517 
    518 (defmethod right-tensor-product-by ((self term) (other monom))
    519   (call-next-method))
    520 
    521 (defmethod divide-by ((self term) (other term))
     513(defmethod monom-divide-by ((self term) (other term))
    522514  "Destructively divide term SELF by OTHER and store the result into SELF.
    523515It returns SELF."
    524   (setf (scalar-coeff self) (divide-by (scalar-coeff self) (scalar-coeff other)))
     516  (setf (term-coeff self) (divide-by (term-coeff self) (term-coeff other)))
    525517  (call-next-method))
    526518
    527 (defmethod unary-minus ((self term))
    528   (setf (scalar-coeff self) (unary-minus (scalar-coeff self)))
     519(defmethod monom-unary-minus ((self term))
     520  (setf (term-coeff self) (monom-unary-minus (term-coeff self)))
    529521  self)
    530522
    531 (defmethod r* ((term1 term) (term2 term))
     523(defmethod monom-multiply ((term1 term) (term2 term))
    532524  "Non-destructively multiply TERM1 by TERM2."
    533   (multiply-by (copy-instance term1) (copy-instance term2)))
    534 
    535 (defmethod r* ((term1 number) (term2 monom))
     525  (monom-multiply-by (copy-instance term1) (copy-instance term2)))
     526
     527(defmethod monom-multiply ((term1 number) (term2 monom))
    536528  "Non-destructively multiply TERM1 by TERM2."
    537   (r* term1 (change-class (copy-instance term2) 'term)))
    538 
    539 (defmethod r* ((term1 number) (term2 term))
    540   "Non-destructively multiply TERM1 by TERM2."
    541   (setf (scalar-coeff term2)
    542         (r* term1 (scalar-coeff term2)))
    543   term2)
    544 
    545 (defmethod r-zerop ((self term))
    546   (r-zerop (scalar-coeff self)))
     529  (monom-multiply term1 (change-class (copy-instance term2) 'term)))
     530
     531(defmethod monom-zerop ((self term))
     532  (zerop (term-coeff self)))
Note: See TracChangeset for help on using the changeset viewer.