File: app_substitute.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 (42 lines) | stat: -rw-r--r-- 1,184 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
#include "vektor.h"
#include "printer.h"
#include "parser.h"
#include "gfanapplication.h"

typedef list<string> StringList;

class SubstituteApplication : public GFanApplication
{
public:
  const char *helpText()
  {
    return "This program changes the variable names of a polynomial ring. The input is a polynomial ring, a polynomial set in the ring and a new polynomial ring with the same coefficient field but different variable names. The output is the polynomial set written with the variable names of the second polynomial ring.\n"
      "Example:\n"
      "Input:\n"
      "Q[a,b,c,d]{2a-3b,c+d}Q[b,a,c,x]\n"
      "Output:\n"
      "Q[b,a,c,x]{2*b-3*a,c+x}\n";
  }
  SubstituteApplication()
  {
    registerOptions();
  }
  char *name()
  {
    return "_substitute";
  }
  int main()
  {
    FileParser P(Stdin);
    PolynomialRing r=P.parsePolynomialRing();
    PolynomialSet s=P.parsePolynomialSet(r);
    PolynomialRing r2=P.parsePolynomialRing();
    AsciiPrinter(Stdout).printPolynomialRing(r2);
    AsciiPrinter(Stdout).printNewLine();
    AsciiPrinter(Stdout).printPolynomialSet(s.embeddedInto(r2));

    return 0;
  }
};

static SubstituteApplication theApplication;