Frobby  0.9.5
AlexanderDualAction.cpp
Go to the documentation of this file.
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 "AlexanderDualAction.h"
19 
20 #include "BigIdeal.h"
21 #include "IOFacade.h"
22 #include "Scanner.h"
23 #include "SliceFacade.h"
24 #include "SliceParams.h"
25 #include "DataType.h"
26 #include "BigTermConsumer.h"
27 
29  Action
30 (staticGetName(),
31  "Compute the Alexander dual of the input ideal.",
32  "Compute the alexander dual of the input monomial ideal.\n\n"
33  "The computation is done using irreducible decomposition, which is why "
34  "there are\n"
35  "a number of options related to that. See the help topic on irrdecom for "
36  "details.",
37  false),
38 
39  _io(DataType::getMonomialIdealType(), DataType::getMonomialIdealType()) {
40 }
41 
42 void AlexanderDualAction::obtainParameters(vector<Parameter*>& parameters) {
43  Action::obtainParameters(parameters);
44  _sliceParams.obtainParameters(parameters);
45  _io.obtainParameters(parameters);
46 }
47 
49  SliceParams params(_params);
50  validateSplit(params, true, false);
51 
52  BigIdeal ideal;
53  vector<mpz_class> point;
54  bool pointSpecified;
55 
56  {
57  Scanner in(_io.getInputFormat(), stdin);
60 
61  IOFacade ioFacade(_printActions);
62  pointSpecified = ioFacade.readAlexanderDualInstance(in, ideal, point);
63  in.expectEOF();
64  }
65 
66  auto_ptr<BigTermConsumer> output =
67  _io.createOutputHandler()->createIdealWriter(stdout);
68  SliceFacade facade(params, ideal, *output);
69 
70  if (pointSpecified)
71  facade.computeAlexanderDual(point);
72  else
73  facade.computeAlexanderDual();
74 }
75 
77  return "alexdual";
78 }
void validateSplit(const SliceParams &params, bool allowLabel, bool allowDegree)
Definition: SliceParams.cpp:61
Definition: Action.h:25
CliParams _params
Definition: Action.h:59
BoolParameter _printActions
Definition: Action.h:68
virtual void obtainParameters(vector< Parameter * > &parameters)
Definition: Action.cpp:133
SliceParameters _sliceParams
static const char * staticGetName()
virtual void obtainParameters(vector< Parameter * > &parameters)
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
Definition: DataType.h:29
A facade for input and output of mathematical objects.
Definition: IOFacade.h:39
bool readAlexanderDualInstance(Scanner &in, BigIdeal &ideal, vector< mpz_class > &term)
Definition: IOFacade.cpp:230
void autoDetectInputFormat(Scanner &in)
If using the input format, this must be called before validating the ideals, since the auto detect fo...
auto_ptr< IOHandler > createOutputHandler() const
const string & getInputFormat() const
void validateFormats() const
void obtainParameters(vector< Parameter * > &parameters)
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition: Scanner.h:50
void expectEOF()
Require that there is no more input.
Definition: Scanner.cpp:77
A facade for operations on monomial ideals using the Slice Algorithm.
Definition: SliceFacade.h:44
void computeAlexanderDual(const vector< mpz_class > &point)
Compute the Alexander dual of the ideal.