File: app_idealproduct.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 (61 lines) | stat: -rw-r--r-- 1,311 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
58
59
60
61
#include "parser.h"
#include "printer.h"
#include "saturation.h"
#include "gfanapplication.h"
#include "lp.h"

class IdealProductApplication : public GFanApplication
{
  FieldOption theFieldOption;
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  const char *helpText()
  {
    return "This program computes the product IJ of ideals generated by sets of polynomials given in the input.\n";
  }
  IdealProductApplication()
  {
    registerOptions();
  }
  
  char *name()
  {
    return "_idealproduct";
  }

  int main()
  {
    LpSolver::printList(Stderr);
    lpSetSolver("cddgmp");

    FileParser P(Stdin);

    PolynomialRing theRing=P.parsePolynomialRing();
    PolynomialSet a=P.parsePolynomialSet(theRing);
    PolynomialSet b=P.parsePolynomialSet(theRing);

    /*    int n1=a.numberOfVariablesInRing();
    int n2=b.numberOfVariablesInRing();

    int n=n1;
    if(n2>n1)n=n2;
    a.changeNumberOfVariables(n);
    b.changeNumberOfVariables(n);
    */

    PolynomialSet ret(theRing);
    for(PolynomialSet::const_iterator i=a.begin();i!=a.end();i++)
      for(PolynomialSet::const_iterator j=b.begin();j!=b.end();j++)
	{
	  ret.push_back(*i * *j);
	}
    AsciiPrinter(Stdout).printPolynomialSet(ret);
    
    return 0;
  }
};

static IdealProductApplication theApplication;