File: app_latticeideal.cpp

package info (click to toggle)
gfan 0.3dfsg-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 2,012 kB
  • ctags: 1,935
  • sloc: cpp: 17,728; makefile: 251
file content (54 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "vektor.h"
#include "printer.h"
#include "parser.h"
#include "gfanapplication.h"
#include "binomial.h"
#include "latticeideal.h"
#include "field_rationals.h"
#include "lll.h"

class LatticeIdealApplication : public GFanApplication
{
  SimpleOption toricOption;
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  LatticeIdealApplication():
    toricOption("-t","Compute the toric ideal of the matrix whose rows are given on the input instead.")
  {
    registerOptions();
  }
  char *name()
  {
    return "_latticeideal";
  }
  int main()
  {
    FileParser P(Stdin);

    IntegerVectorList ivl=P.parseIntegerVectorList();
    IntegerMatrix A=rowsToIntegerMatrix(ivl).transposed();

    if(toricOption.getValue())
      A=latticeKernelOfTransposed(A).transposed();

    IntegerVectorList b=latticeIdealRevLex(A);

    PolynomialRing theRing(Q,A.getHeight());
    PolynomialSet g(theRing);
    for(IntegerVectorList::const_iterator i=b.begin();i!=b.end();i++)
      g.push_back(integerVectorToBinomial(*i,theRing));

    AsciiPrinter(Stdout).printPolynomialRing(g.getRing());
    AsciiPrinter(Stdout).printPolynomialSet(g);
    return 0;
  }
  const char *helpText()
  {
    return "This program computes the lattice ideal of the lattice. The input is a list of generators for the lattice.\n";
  }
};

static LatticeIdealApplication theApplication;