[1201] | 1 | ;;; -*- Mode: Lisp -*-
|
---|
[511] | 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 3 | ;;;
|
---|
| 4 | ;;; Copyright (C) 1999, 2002, 2009, 2015 Marek Rychlik <rychlik@u.arizona.edu>
|
---|
| 5 | ;;;
|
---|
| 6 | ;;; This program is free software; you can redistribute it and/or modify
|
---|
| 7 | ;;; it under the terms of the GNU General Public License as published by
|
---|
| 8 | ;;; the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | ;;; (at your option) any later version.
|
---|
| 10 | ;;;
|
---|
| 11 | ;;; This program is distributed in the hope that it will be useful,
|
---|
| 12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | ;;; GNU General Public License for more details.
|
---|
| 15 | ;;;
|
---|
| 16 | ;;; You should have received a copy of the GNU General Public License
|
---|
| 17 | ;;; along with this program; if not, write to the Free Software
|
---|
| 18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
| 19 | ;;;
|
---|
| 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 21 |
|
---|
| 22 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 23 | ;;
|
---|
| 24 | ;; Selection of algorithm and pair heuristic
|
---|
| 25 | ;;
|
---|
| 26 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 27 |
|
---|
| 28 | (defpackage "GROBNER-WRAP"
|
---|
[1363] | 29 | (:use :cl :buchberger :gebauer-moeller :gb-postprocessing :division :ring-and-order)
|
---|
[514] | 30 | (:export "$POLY_GROBNER_ALGORITHM" "GROBNER" "REDUCED-GROBNER"))
|
---|
[511] | 31 |
|
---|
| 32 | (in-package :grobner-wrap)
|
---|
| 33 |
|
---|
[1625] | 34 | (defvar $poly_grobner_algorithm '$buchberger
|
---|
| 35 | "The name of the algorithm used to find grobner bases.")
|
---|
| 36 |
|
---|
[1622] | 37 | (defun choose-grobner-algorithm (algorithm)
|
---|
[1626] | 38 | "Translates symbol ALGORITHM, which names the algorithm, and should
|
---|
| 39 | be either a keyword, an uninterne symbol or symbol in package
|
---|
| 40 | GROBNER-WRAP, or a Maxima-style symbols starting with the dollar. It
|
---|
| 41 | returns a function which calculates Grobner basis."
|
---|
[511] | 42 | (ecase algorithm
|
---|
[1627] | 43 | ((buchberger :buchberger $buchberger #:buchberger)
|
---|
[1374] | 44 | #'buchberger)
|
---|
[1627] | 45 | ((parallel-buchberger :parallel-buchberger $parallel_buchberger #:parallel-buchberger)
|
---|
[1374] | 46 | #'parallel-buchberger)
|
---|
[1627] | 47 | ((gebauer-moeller :gebauer-moeller :gebauer_moeller $gebauer_moeller #:gebauer_moeller #:gebauer-moeller)
|
---|
| 48 | #'gebauer-moeller)))
|
---|
[511] | 49 |
|
---|
[1376] | 50 | (defun grobner (ring-and-order f
|
---|
| 51 | &optional
|
---|
| 52 | (start 0)
|
---|
[1377] | 53 | (top-reduction-only $poly_top_reduction_only))
|
---|
[1375] | 54 | "Compute the Groebner basis of an ideal generated by F. Optionally,
|
---|
| 55 | assume that first START elements are already a grobner basis.
|
---|
[1376] | 56 | If TOP-REDUCTION-ONLY is T then perform top reduction only."
|
---|
[1362] | 57 | (declare (type ring-and-order ring-and-order))
|
---|
[511] | 58 | ;;(setf F (sort F #'< :key #'sugar))
|
---|
[1623] | 59 | (funcall
|
---|
| 60 | (choose-grobner-function $poly_grobner_algorithm)
|
---|
[1360] | 61 | ring-and-order f start top-reduction-only))
|
---|
[511] | 62 |
|
---|
[1378] | 63 | (defun reduced-grobner (ring-and-order f
|
---|
| 64 | &optional
|
---|
| 65 | (start 0)
|
---|
| 66 | (top-reduction-only $poly_top_reduction_only))
|
---|
[1362] | 67 | (declare (type ring-and-order ring-and-order))
|
---|
[1538] | 68 | (reduction ring-and-order
|
---|
[1602] | 69 | (grobner ring-and-order
|
---|
[1538] | 70 | f
|
---|
| 71 | start
|
---|
[1602] | 72 | top-reduction-only)))
|
---|