- Timestamp:
- 2015-09-05T15:58:06-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/monom.lisp
r3532 r3533 477 477 (values primary nil)))))))) 478 478 479 480 479 (defclass term (monom) 481 480 ((coeff :initarg :coeff :accessor term-coeff)) … … 492 491 exponents coeff)))) 493 492 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)) 497 495 (call-next-method))) 498 496 499 (defmethod update-instance-for-different-class :after ((old monom) (new scalar) &key)500 (setf ( scalar-coeff new) 1))501 502 (defmethod m ultiply-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)) 503 501 "Destructively multiply terms SELF and OTHER and store the result into SELF. 504 502 It returns SELF." 505 503 (setf (scalar-coeff self) (multiply-by (scalar-coeff self) (scalar-coeff other)))) 506 504 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))) 509 507 (call-next-method)) 510 508 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))) 513 511 (call-next-method)) 514 512 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)) 522 514 "Destructively divide term SELF by OTHER and store the result into SELF. 523 515 It 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))) 525 517 (call-next-method)) 526 518 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))) 529 521 self) 530 522 531 (defmethod r*((term1 term) (term2 term))523 (defmethod monom-multiply ((term1 term) (term2 term)) 532 524 "Non-destructively multiply TERM1 by TERM2." 533 (m ultiply-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)) 536 528 "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.