3
#include "polynomial.h"
6
#include "gfanapplication.h"
7
#include "polyhedralcone.h"
9
#include "polymakefile.h"
10
#include "determinant.h"
12
#include "triangulation.h"
16
class CombineRaysApplication : public GFanApplication
18
StringOption inputOption;
19
StringOption sectionOption;
20
SimpleOption dumpOption;
21
IntegerOption dumpHeightOption;
22
IntegerOption dumpWidthOption;
24
const char *helpText()
26
return "This program combines rays from the specified polymake file by adding according to a list of vectors of indices given on the standard input.\n";
28
CombineRaysApplication():
29
inputOption("-i","Specify the name of the input file.","examples/grassmann3_7.out"),
30
sectionOption("--section","Specify a section of the polymake file to use as input, rather than standard input.",0),
31
dumpOption("--dump","Dump specified section as a matrix rather than combining the rays"),
32
dumpHeightOption("--dheight","Specify height of matrix to be dumped.",1),
33
dumpWidthOption("--dwidth","Specify width of matrix to be dumped.",1)
36
dumpHeightOption.hide();
37
dumpWidthOption.hide();
43
return "_combinerays";
49
inFile.open(inputOption.getValue());
51
if(dumpOption.getValue())
53
pout<<inFile.readMatrixProperty(sectionOption.getValue(),dumpHeightOption.getValue(),dumpWidthOption.getValue()).getRows();
57
int N=inFile.readCardinalProperty("AMBIENT_DIM");
59
int nRays=inFile.readCardinalProperty("N_RAYS");
60
IntegerMatrix rays=inFile.readMatrixProperty("RAYS",nRays,N);
65
IntegerVectorList comb;
66
if(sectionOption.getValue())
68
vector<list<int> > l=inFile.readMatrixIncidenceProperty(sectionOption.getValue());
69
for(vector<list<int> >::const_iterator i=l.begin();i!=l.end();i++)
71
IntegerVector temp(i->size());
73
for(list<int>::const_iterator j=i->begin();j!=i->end();j++,J++)temp[J]=*j;
78
comb=P.parseIntegerVectorList();
80
IntegerVectorList result;
81
for(IntegerVectorList::const_iterator j=comb.begin();j!=comb.end();j++)
83
IntegerVector interiorPoint(N);
84
for(int i=0;i<j->size();i++)
86
interiorPoint+=rays[(*j)[i]];
88
result.push_back(interiorPoint);
91
AsciiPrinter(Stdout).printVectorList(result);
98
static CombineRaysApplication theApplication;