1 /* Frobby: Software for monomial ideal computations.
2    Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see http://www.gnu.org/licenses/.
16 */
17 #include "stdinc.h"
18 #include "MaximalStandardAction.h"
19 
20 #include "SliceFacade.h"
21 #include "SliceParams.h"
22 #include "DataType.h"
23 
MaximalStandardAction()24 MaximalStandardAction::MaximalStandardAction():
25   Action
26 (staticGetName(),
27  "Compute the maximal standard monomials of the input ideal.",
28  "Compute the maximal standard monomials of the input ideal. A standard "
29  "monomial\nis a monomial that does not lie in the ideal, while a "
30  "maximal\nstandard monomial m is a standard monomial such that m * v does "
31  "lie in the\nideal for every variable v in the ambient polynomial ring of I.",
32  false),
33 
34   _io(DataType::getMonomialIdealType(), DataType::getMonomialIdealType()),
35 
36   _increment
37   ("increment",
38    "Increase each entry of the output by 1 to compute maximal staircase\n"
39    "monomials in place of maximal standard monomials.",
40    false) {
41 }
42 
staticGetName()43 const char* MaximalStandardAction::staticGetName() {
44   return "maxstandard";
45 }
46 
obtainParameters(vector<Parameter * > & parameters)47 void MaximalStandardAction::obtainParameters(vector<Parameter*>& parameters) {
48   _io.obtainParameters(parameters);
49   _sliceParams.obtainParameters(parameters);
50   parameters.push_back(&_increment);
51   Action::obtainParameters(parameters);
52 }
53 
perform()54 void MaximalStandardAction::perform() {
55   SliceParams params(_params);
56   validateSplit(params, true, false);
57   SliceFacade facade(params, DataType::getMonomialIdealListType());
58   if (_increment)
59     facade.computeMaximalStaircaseMonomials();
60   else
61     facade.computeMaximalStandardMonomials();
62 }
63