File: app_tropicalimage.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,348 kB
  • ctags: 5,683
  • sloc: cpp: 39,675; makefile: 454; sh: 1
file content (59 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (6)
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
55
56
57
58
59
#include "parser.h"
#include "printer.h"
#include "lp.h"
#include "gfanapplication.h"
#include "polyhedralcone.h"
#include "polyhedralfan.h"
#include "polymakefile.h"
#include "tropicalmap.h"

class TropicalImageApplication : public GFanApplication
{
  StringOption inputOption;
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  const char *helpText()
  {
    return "This program computes the image of the tropicalization of a polynomial map. The output is a polyhedral fan with support equal to the image. The input is the polynomial ring, followed by a list of coordinate polynomials. A domain different from $R^n$ can be chosen with the option -i.\n";
  }
  TropicalImageApplication():
    inputOption("-i","Specify the name of the file containing a polyhedral fan whose support is the domain of the function.",0)
  {
    registerOptions();
  }

  const char *name()
  {
    return "_tropicalimage";
  }

  int main()
  {
    PolynomialSet g=FileParser(Stdin).parsePolynomialSetWithRing();

    int n=g.getRing().getNumberOfVariables();



    PolyhedralFan domain=PolyhedralFan::fullSpace(n);

    if(inputOption.getValue())
      {
	domain=PolyhedralFan::readFan(inputOption.getValue());
      }

    PolyhedralFan f=imageOfTropicalMap(g,domain);

    AsciiPrinter P(Stdout);

    f.printWithIndices(&P,FPF_default|FPF_multiplicities/*|FPF_values*/);

    return 0;
  }
};

static TropicalImageApplication theApplication;