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.

source: branches/f4grobner/grobner-wrap.lisp@ 1577

Last change on this file since 1577 was 1538, checked in by Marek Rychlik, 9 years ago

* empty log message *

File size: 2.9 KB
Line 
1;;; -*- Mode: Lisp -*-
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"
29 (:use :cl :buchberger :gebauer-moeller :gb-postprocessing :division :ring-and-order)
30 (:export "$POLY_GROBNER_ALGORITHM" "GROBNER" "REDUCED-GROBNER"))
31
32(in-package :grobner-wrap)
33
34(defvar $poly_grobner_algorithm '$buchberger
35 "The name of the algorithm used to find grobner bases.")
36
37(defun find-grobner-function (algorithm)
38 "Return a function which calculates Grobner basis, based on its
39names. Names currently used are either Lisp symbols, Maxima symbols or
40keywords."
41 (ecase algorithm
42 ((buchberger :buchberger $buchberger)
43 #'buchberger)
44 ((parallel-buchberger :parallel-buchberger $parallel_buchberger)
45 #'parallel-buchberger)
46 ((gebauer-moeller :gebauer-moeller :gebauer_moeller $gebauer_moeller)
47 #'gebauer-moeller)))
48
49(defun grobner (ring-and-order f
50 &optional
51 (start 0)
52 (top-reduction-only $poly_top_reduction_only))
53 "Compute the Groebner basis of an ideal generated by F. Optionally,
54assume that first START elements are already a grobner basis.
55If TOP-REDUCTION-ONLY is T then perform top reduction only."
56 (declare (type ring-and-order ring-and-order))
57 ;;(setf F (sort F #'< :key #'sugar))
58 (funcall
59 (find-grobner-function $poly_grobner_algorithm)
60 ring-and-order f start top-reduction-only))
61
62(defun reduced-grobner (ring-and-order f
63 &optional
64 (start 0)
65 (top-reduction-only $poly_top_reduction_only))
66 (declare (type ring-and-order ring-and-order))
67 (reduction ring-and-order
68 (minimization
69 (grobner ring-and-order
70 f
71 start
72 top-reduction-only))))
Note: See TracBrowser for help on using the repository browser.