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/gb-postprocessing.lisp@ 1261

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

Changed the first line to eliminate 'unsafe' Emacs variables

File size: 2.7 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;; Standard postprocessing of Grobner bases:
25;; - reduction
26;; - minimization
27;;
28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
30(defpackage "GB-POSTPROCESSING"
31 (:use :cl :monomial :division :polynomial)
32 (:export "REDUCTION" "MINIMIZATION"))
33
34(in-package :gb-postprocessing)
35
36(defun reduction (ring plist)
37 "Reduce a list of polynomials PLIST, so that non of the terms in any of
38the polynomials is divisible by a leading monomial of another
39polynomial. Return the reduced list."
40 (do ((q plist)
41 (found t))
42 ((not found)
43 (mapcar #'(lambda (x) (poly-primitive-part ring x)) q))
44 ;;Find p in Q such that p is reducible mod Q\{p}
45 (setf found nil)
46 (dolist (x q)
47 (let ((q1 (remove x q)))
48 (multiple-value-bind (h c div-count)
49 (normal-form ring x q1 nil #| not a top reduction! |# )
50 (declare (ignore c))
51 (unless (zerop div-count)
52 (setf found t q q1)
53 (unless (poly-zerop h)
54 (setf q (nconc q1 (list h))))
55 (return)))))))
56
57(defun minimization (p)
58 "Returns a sublist of the polynomial list P spanning the same
59monomial ideal as P but minimal, i.e. no leading monomial
60of a polynomial in the sublist divides the leading monomial
61of another polynomial."
62 (do ((q p)
63 (found t))
64 ((not found) q)
65 ;;Find p in Q such that lm(p) is in LM(Q\{p})
66 (setf found nil
67 q (dolist (x q q)
68 (let ((q1 (remove x q)))
69 (when (member-if #'(lambda (p) (monom-divides-p (poly-lm x) (poly-lm p))) q1)
70 (setf found t)
71 (return q1)))))))
Note: See TracBrowser for help on using the repository browser.