File: app_tropicalfunction.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,296 kB
  • ctags: 5,612
  • sloc: cpp: 39,675; makefile: 453; sh: 1
file content (57 lines) | stat: -rw-r--r-- 1,441 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
55
56
57
#include "parser.h"
#include "printer.h"
#include "polynomial.h"
#include "division.h"
#include "buchberger.h"
#include "wallideal.h"
#include "lp.h"
#include "reversesearch.h"
#include "termorder.h"
#include "ep_standard.h"
#include "ep_xfig.h"
#include "gfanapplication.h"
#include "polyhedralcone.h"
#include "polyhedralfan.h"
#include "tropical.h"
#include "tropical2.h"
#include "symmetry.h"
#include "halfopencone.h"
#include "log.h"


class TropicalFunctionApplication : public GFanApplication
{

public:
  const char *helpText()
  {
    return "This program takes a polynomial and tropicalizes it. The output is piecewise linear function represented by a fan whose cones are the linear regions. Each ray of the fan gets the value of the tropical function assigned to it. In other words this program computes the normal fan of the Newton polytope of the input polynomial with additional information.";
  }
  TropicalFunctionApplication()
  {
    registerOptions();
  }
  const char *name()
  {
    return "_tropicalfunction";
  }
  int main()
  {
    FileParser P(Stdin);

    PolynomialSet f=P.parsePolynomialSetWithRing();
    int n=f.numberOfVariablesInRing();

    PolyhedralFan F=PolyhedralFan::normalFanOfNewtonPolytope(*f.begin());

    {
      AsciiPrinter p(Stdout);
      PolyhedralFan a=F;
      a.printWithIndices(&p,FPF_default|FPF_values);
    }

    return 0;
  }
};

static TropicalFunctionApplication theApplication;