File: app_evaluate.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 (72 lines) | stat: -rw-r--r-- 1,454 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
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "parser.h"
#include "printer.h"
#include "polynomial.h"
#include "buchberger.h"
#include "wallideal.h"
#include "termorder.h"
#include "gfanapplication.h"
#include "tropical2.h"
#include "matrix.h"
#include <iostream>

class EvaluationApplication : public GFanApplication
{
	SimpleOption optionComplex;
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  const char *helpText()
  {
    return "This program evaluates a list of polynomials in a point.\n";
  }
  EvaluationApplication():
	  optionComplex("--complex","Read and evaluate using complex numbers rather than real numbers.")
  {
    registerOptions();
  }

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

  int main()
  {
    FileParser P(Stdin);

    PolynomialSet g=P.parsePolynomialSetWithRing();


    if(0){
    	for(int i1=1;i1<20;i1++)
        	for(int i2=1;i2<20;i2++)
            	for(int i3=1;i3<20;i3++)
            	{
					FloatVector v(4);
					v[0]=i1/20.0;
					v[1]=i2/20.0;
					v[2]=i3/20.0;
					v[3]=1-v[1]-v[2]-v[0];
                	pout.printFloatVector(g.evaluateFloat(v));
            	}
    }

    if(optionComplex.getValue())
    {
    	ComplexVector x=P.parseComplexVector();
    	pout.printComplexVector(g.evaluateComplex(x));
    }
    else
    {
    	FloatVector x=P.parseFloatVector();
    	pout.printFloatVector(g.evaluateFloat(x));
    }

    pout<<"\n";
    return 0;
  }
};

static EvaluationApplication theApplication;