File: gfanapplication.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 (73 lines) | stat: -rw-r--r-- 1,872 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
62
63
64
65
66
67
68
69
70
71
72
73
#include "gfanapplication.h"
#include "field.h"
#include "field_rationals.h"
#include "field_zmodpz.h"
#include "division.h"
#include "printer.h"
#include "symmetry.h"
#include "log.h"

GFanApplication::FieldOption::FieldOption():
  IntegerOption("--mod","Set the field to Z / pZ. The value must be a prime number p between 2 and 32749.\n")
{
}


void GFanApplication::FieldOption::onOptionsParsed()
{
  if(getValue())
    {
      fprintf(Stderr,"CANNOT CHANGE FIELD\n");
      assert(0);
      //      Field::setField(new FieldZModPZ(getValue()));
      //      Field::setField(Field::find("Zmod2Z"));
    }
}


GFanApplication::LogLevelOption::LogLevelOption():
  IntegerOption("--log","Set the logging level.\n")
{
  hide();
}


void GFanApplication::LogLevelOption::onOptionsParsed()
{
  if(getValue())
    {
      setLogLevel(getValue());
    }
}


void GFanApplication::assertSymmetriesMatch(IntegerVectorList const &g, PolynomialSet &markedGroebnerBasis)
{
  int n=markedGroebnerBasis.numberOfVariablesInRing();
  for(IntegerVectorList::const_iterator i=g.begin();i!=g.end();i++)
    {
      if(i->size()!=n)
	{
	  fprintf(Stderr,"PERMUTATION ");
	  AsciiPrinter(Stderr).printVector(*i);
	  fprintf(Stderr," HAS WRONG LENGTH.\n");
	  assert(0);
	}
      if(!areIdealsEqual(markedGroebnerBasis,SymmetryGroup::permutePolynomialSet(markedGroebnerBasis,*i)))
	{
	  fprintf(Stderr,"PERMUTATION ");
	  AsciiPrinter(Stderr).printVector(*i);
	  fprintf(Stderr," DOES NOT KEEP THE IDEAL FIXED.\n");
	  assert(0);
	}
    }  
}

void GFanApplication::onExit()
{
  log1
    {
      fprintf(Stderr,"Number of living FieldImplementation objects:%i\n",FieldImplementation::getNumberOfLivingFieldImplementations());
      fprintf(Stderr,"Number of living FieldElementImplementation objects:%i\n",FieldElementImplementation::getNumberOfLivingFieldElementImplementations());
    }
}