1 | ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*-
|
---|
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 |
|
---|
29 | (defpackage "GROBNER-WRAP"
|
---|
30 | (:use :cl :buchberger :gebauer-moeller :gb-postprocessing :division)
|
---|
31 | (:export "$POLY_GROBNER_ALGORITHM" "GROBNER" "REDUCED-GROBNER"))
|
---|
32 |
|
---|
33 | (in-package :grobner-wrap)
|
---|
34 |
|
---|
35 | (defvar $poly_grobner_algorithm '$buchberger
|
---|
36 | "The name of the algorithm used to find grobner bases.")
|
---|
37 |
|
---|
38 | (defun find-grobner-function (algorithm)
|
---|
39 | "Return a function which calculates Grobner basis, based on its
|
---|
40 | names. Names currently used are either Lisp symbols, Maxima symbols or
|
---|
41 | keywords."
|
---|
42 | (ecase algorithm
|
---|
43 | ((buchberger :buchberger $buchberger) #'buchberger)
|
---|
44 | ((parallel-buchberger :parallel-buchberger $parallel_buchberger) #'parallel-buchberger)
|
---|
45 | ((gebauer-moeller :gebauer_moeller $gebauer_moeller) #'gebauer-moeller)))
|
---|
46 |
|
---|
47 | (defun grobner (ring f &optional (start 0) (top-reduction-only nil))
|
---|
48 | ;;(setf F (sort F #'< :key #'sugar))
|
---|
49 | (funcall
|
---|
50 | (find-grobner-function $poly_grobner_algorithm)
|
---|
51 | ring f start top-reduction-only))
|
---|
52 |
|
---|
53 | (defun reduced-grobner (ring f &optional (start 0) (top-reduction-only $poly_top_reduction_only))
|
---|
54 | (reduction ring (grobner ring f start top-reduction-only)))
|
---|