Frobby  0.9.1
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 }
BigIdeal
Definition: BigIdeal.h:27
DataType.h
stdinc.h
Scanner::expectEOF
void expectEOF()
Require that there is no more input.
Definition: Scanner.cpp:77
BigTermConsumer.h
Scanner
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition: Scanner.h:50
AlexanderDualAction::staticGetName
static const char * staticGetName()
Definition: AlexanderDualAction.cpp:76
IOParameters::validateFormats
void validateFormats() const
Definition: IOParameters.cpp:154
AlexanderDualAction.h
Action::obtainParameters
virtual void obtainParameters(vector< Parameter * > &parameters)
Definition: Action.cpp:133
Action
Definition: Action.h:25
IOFacade::readAlexanderDualInstance
bool readAlexanderDualInstance(Scanner &in, BigIdeal &ideal, vector< mpz_class > &term)
Definition: IOFacade.cpp:230
IOParameters::autoDetectInputFormat
void autoDetectInputFormat(Scanner &in)
If using the input format, this must be called before validating the ideals, since the auto detect fo...
Definition: IOParameters.cpp:141
Scanner.h
AlexanderDualAction::perform
virtual void perform()
Definition: AlexanderDualAction.cpp:48
SliceParams
Definition: SliceParams.h:25
SliceFacade.h
Action::_params
CliParams _params
Definition: Action.h:59
AlexanderDualAction::obtainParameters
virtual void obtainParameters(vector< Parameter * > &parameters)
Definition: AlexanderDualAction.cpp:42
AlexanderDualAction::_io
IOParameters _io
Definition: AlexanderDualAction.h:36
SliceParams.h
IOFacade.h
AlexanderDualAction::_sliceParams
SliceParameters _sliceParams
Definition: AlexanderDualAction.h:35
Action::_printActions
BoolParameter _printActions
Definition: Action.h:68
AlexanderDualAction::AlexanderDualAction
AlexanderDualAction()
Definition: AlexanderDualAction.cpp:28
IOParameters::getInputFormat
const string & getInputFormat() const
Definition: IOParameters.cpp:108
validateSplit
void validateSplit(const SliceParams &params, bool allowLabel, bool allowDegree)
Definition: SliceParams.cpp:61
DataType
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
Definition: DataType.h:29
IOParameters::createOutputHandler
auto_ptr< IOHandler > createOutputHandler() const
Definition: IOParameters.cpp:135
SliceFacade
A facade for operations on monomial ideals using the Slice Algorithm.
Definition: SliceFacade.h:44
BigIdeal.h
SliceFacade::computeAlexanderDual
void computeAlexanderDual(const vector< mpz_class > &point)
Compute the Alexander dual of the ideal.
Definition: SliceFacade.cpp:250
ParameterGroup::obtainParameters
void obtainParameters(vector< Parameter * > &parameters)
Definition: ParameterGroup.cpp:37
IOFacade
A facade for input and output of mathematical objects.
Definition: IOFacade.h:39