- Timestamp:
- 2015-06-05T12:02:23-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/mx-grobner.lisp
r105 r106 76 76 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 77 77 ;; 78 ;; Macro facility for writing Maxima-level wrappers for79 ;; functions operating on internal representation80 ;;81 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;82 83 (defmacro with-parsed-polynomials (((maxima-vars &optional (maxima-new-vars nil new-vars-supplied-p))84 &key (polynomials nil)85 (poly-lists nil)86 (poly-list-lists nil)87 (value-type nil))88 &body body89 &aux (vars (gensym))90 (new-vars (gensym)))91 `(let ((,vars (coerce-maxima-list ,maxima-vars))92 ,@(when new-vars-supplied-p93 (list `(,new-vars (coerce-maxima-list ,maxima-new-vars)))))94 (coerce-to-maxima95 ,value-type96 (with-coefficient-ring ($poly_coefficient_ring)97 (with-monomial-order ($poly_monomial_order)98 (with-elimination-orders ($poly_primary_elimination_order99 $poly_secondary_elimination_order100 $poly_elimination_order)101 (let ,(let ((args nil))102 (dolist (p polynomials args)103 (setf args (cons `(,p (parse-poly ,p ,vars)) args)))104 (dolist (p poly-lists args)105 (setf args (cons `(,p (parse-poly-list ,p ,vars)) args)))106 (dolist (p poly-list-lists args)107 (setf args (cons `(,p (parse-poly-list-list ,p ,vars)) args))))108 . ,body))))109 ,(if new-vars-supplied-p110 `(append ,vars ,new-vars)111 vars))))112 113 (defmacro define-unop (maxima-name fun-name114 &optional (documentation nil documentation-supplied-p))115 "Define a MAXIMA-level unary operator MAXIMA-NAME corresponding to unary function FUN-NAME."116 `(defun ,maxima-name (p vars117 &aux118 (vars (coerce-maxima-list vars))119 (p (parse-poly p vars)))120 ,@(when documentation-supplied-p (list documentation))121 (coerce-to-maxima :polynomial (,fun-name *maxima-ring* p) vars)))122 123 (defmacro define-binop (maxima-name fun-name124 &optional (documentation nil documentation-supplied-p))125 "Define a MAXIMA-level binary operator MAXIMA-NAME corresponding to binary function FUN-NAME."126 `(defmfun ,maxima-name (p q vars127 &aux128 (vars (coerce-maxima-list vars))129 (p (parse-poly p vars))130 (q (parse-poly q vars)))131 ,@(when documentation-supplied-p (list documentation))132 (coerce-to-maxima :polynomial (,fun-name *maxima-ring* p q) vars)))133 134 135 136 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;137 ;;138 78 ;; Maxima-level interface functions 139 79 ;;
Note:
See TracChangeset
for help on using the changeset viewer.