My Project  debian-1:4.1.2-p1+ds-2
Static Public Member Functions | Static Private Attributes
CFFactory Class Reference

#include <cf_factory.h>

Static Public Member Functions

static int gettype ()
 
static void settype (int type)
 
static InternalCFbasic (long value)
 
static InternalCFbasic (int type, long value)
 
static InternalCFbasic (const char *str)
 
static InternalCFbasic (const char *str, int base)
 
static InternalCFbasic (int type, const char *const str)
 
static InternalCFbasic (int type, long value, bool nonimm)
 
static InternalCFbasic (const mpz_ptr num)
 
static InternalCFrational (long num, long den)
 
static InternalCFrational (const mpz_ptr num, const mpz_ptr den, bool normalize)
 
static InternalCFpoly (const Variable &v, int exp, const CanonicalForm &c)
 
static InternalCFpoly (const Variable &v, int exp=1)
 

Static Private Attributes

static int currenttype = IntegerDomain
 

Detailed Description

Definition at line 23 of file cf_factory.h.

Member Function Documentation

◆ basic() [1/7]

InternalCF * CFFactory::basic ( const char *  str)
static

Definition at line 79 of file cf_factory.cc.

80 {
81  if ( currenttype == IntegerDomain ) {
82  InternalInteger * dummy = new InternalInteger( str );
83  if ( dummy->is_imm() ) {
84  InternalCF * res = int2imm( dummy->intval() );
85  delete dummy;
86  return res;
87  }
88  else
89  return dummy;
90  }
91 // else if ( currenttype == RationalDomain ) {
92 // InternalRational * dummy = new InternalRational( str );
93 // if ( dummy->is_imm() ) {
94 // InternalCF * res = int2imm( dummy->intval() );
95 // delete dummy;
96 // return res;
97 // }
98 // else
99 // return dummy;
100 // }
101  else if ( currenttype == FiniteFieldDomain ) {
102  InternalInteger * dummy = new InternalInteger( str );
103  InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
104  delete dummy;
105  return res;
106  }
107  else if ( currenttype == GaloisFieldDomain ) {
108  InternalInteger * dummy = new InternalInteger( str );
109  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
110  delete dummy;
111  return res;
112  }
113  else {
114  ASSERT( 0, "illegal basic domain!" );
115  return 0;
116  }
117 }
#define ASSERT(expression, message)
Definition: cf_assert.h:99
#define FiniteFieldDomain
Definition: cf_defs.h:24
#define IntegerDomain
Definition: cf_defs.h:26
#define GaloisFieldDomain
Definition: cf_defs.h:23
static int currenttype
Definition: cf_factory.h:26
virtual class for internal CanonicalForm's
Definition: int_cf.h:47
factory's class for integers
Definition: int_int.h:41
long intval() const
Definition: int_int.cc:506
bool is_imm() const
Definition: int_int.cc:41
int intmod(int p) const
Definition: int_int.cc:511
CanonicalForm res
Definition: facAbsFact.cc:64
VAR int ff_prime
Definition: ffops.cc:14
int gf_int2gf(int i)
Definition: gfops.h:65
InternalCF * int2imm_p(long i)
Definition: imm.h:101
static InternalCF * int2imm(long i)
Definition: imm.h:75
InternalCF * int2imm_gf(long i)
Definition: imm.h:106

◆ basic() [2/7]

InternalCF * CFFactory::basic ( const char *  str,
int  base 
)
static

Definition at line 120 of file cf_factory.cc.

121 {
122  if ( currenttype == IntegerDomain ) {
123  InternalInteger * dummy = new InternalInteger( str, base );
124  if ( dummy->is_imm() ) {
125  InternalCF * res = int2imm( dummy->intval() );
126  delete dummy;
127  return res;
128  }
129  else
130  return dummy;
131  }
132 // else if ( currenttype == RationalDomain ) {
133 // InternalRational * dummy = new InternalRational( str );
134 // if ( dummy->is_imm() ) {
135 // InternalCF * res = int2imm( dummy->intval() );
136 // delete dummy;
137 // return res;
138 // }
139 // else
140 // return dummy;
141 // }
142  else if ( currenttype == FiniteFieldDomain ) {
143  InternalInteger * dummy = new InternalInteger( str, base );
144  InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
145  delete dummy;
146  return res;
147  }
148  else if ( currenttype == GaloisFieldDomain ) {
149  InternalInteger * dummy = new InternalInteger( str, base );
150  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
151  delete dummy;
152  return res;
153  }
154  else {
155  ASSERT( 0, "illegal basic domain!" );
156  return 0;
157  }
158 }
char N base
Definition: ValueTraits.h:144

◆ basic() [3/7]

InternalCF * CFFactory::basic ( const mpz_ptr  num)
static

Definition at line 218 of file cf_factory.cc.

219 {
220  ASSERT (currenttype == IntegerDomain, "Integer domain expected");
221  return new InternalInteger( num );
222 }
CanonicalForm num(const CanonicalForm &f)

◆ basic() [4/7]

InternalCF * CFFactory::basic ( int  type,
const char *const  str 
)
static

Definition at line 161 of file cf_factory.cc.

162 {
163  if ( type == IntegerDomain ) {
164  InternalInteger * dummy = new InternalInteger( str );
165  if ( dummy->is_imm() ) {
166  InternalCF * res = int2imm( dummy->intval() );
167  delete dummy;
168  return res;
169  }
170  else
171  return dummy;
172  }
173 // else if ( type == RationalDomain ) {
174 // InternalRational * dummy = new InternalRational( str );
175 // if ( dummy->is_imm() ) {
176 // InternalCF * res = int2imm( dummy->intval() );
177 // delete dummy;
178 // return res;
179 // }
180 // else
181 // return dummy;
182 // }
183  else if ( type == FiniteFieldDomain ) {
184  InternalInteger * dummy = new InternalInteger( str );
185  InternalCF * res = int2imm( dummy->intmod( ff_prime ) );
186  delete dummy;
187  return res;
188  }
189  else if ( type == GaloisFieldDomain ) {
190  InternalInteger * dummy = new InternalInteger( str );
191  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
192  delete dummy;
193  return res;
194  }
195  else {
196  ASSERT( 0, "illegal basic domain!" );
197  return 0;
198  }
199 }

◆ basic() [5/7]

InternalCF * CFFactory::basic ( int  type,
long  value 
)
static

Definition at line 56 of file cf_factory.cc.

57 {
58  if ( type == IntegerDomain )
59  if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
60  return int2imm( value );
61  else
62  return new InternalInteger( value );
63 // else if ( type == RationalDomain )
64 // if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
65 // return int2imm( value );
66 // else
67 // return new InternalRational( value );
68  else if ( type == FiniteFieldDomain )
69  return int2imm_p( ff_norm( value ) );
70  else if ( type == GaloisFieldDomain )
71  return int2imm_gf( gf_int2gf( value ) );
72  else {
73  ASSERT1( 0, "illegal basic domain (type = %d)!", type );
74  return 0;
75  }
76 }
#define ASSERT1(expression, message, parameter1)
Definition: cf_assert.h:101
#define LIKELY(expression)
For optimizing if-branches.
Definition: cf_factory.cc:23
int ff_norm(const int a)
Definition: ffops.h:39
const long MAXIMMEDIATE
Definition: imm.h:55
const long MINIMMEDIATE
Definition: imm.h:54

◆ basic() [6/7]

InternalCF * CFFactory::basic ( int  type,
long  value,
bool  nonimm 
)
static

Definition at line 202 of file cf_factory.cc.

203 {
204  if ( nonimm )
205  if ( type == IntegerDomain )
206  return new InternalInteger( value );
207  else if ( type == RationalDomain )
208  return new InternalRational( value );
209  else {
210  ASSERT( 0, "illegal basic domain!" );
211  return 0;
212  }
213  else
214  return CFFactory::basic( type, value );
215 }
#define RationalDomain
Definition: cf_defs.h:25
static InternalCF * basic(long value)
Definition: cf_factory.cc:30
factory's class for rationals
Definition: int_rat.h:39

◆ basic() [7/7]

InternalCF * CFFactory::basic ( long  value)
static

Definition at line 30 of file cf_factory.cc.

31 {
32  switch(currenttype)
33  {
34  case IntegerDomain:
35  if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
36  return int2imm( value );
37  else
38  return new InternalInteger( value );
39 // else if ( currenttype == RationalDomain )
40 // if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
41 // return int2imm( value );
42 // else
43 // return new InternalRational( value );
44  case FiniteFieldDomain:
45  return int2imm_p( ff_norm( value ) );
46  case GaloisFieldDomain:
47  return int2imm_gf( gf_int2gf( value ) );
48  default: {
49  ASSERT( 0, "illegal basic domain!" );
50  return 0;
51  }
52  }
53 }

◆ gettype()

static int CFFactory::gettype ( )
inlinestatic

Definition at line 28 of file cf_factory.h.

28 { return currenttype; }

◆ poly() [1/2]

InternalCF * CFFactory::poly ( const Variable v,
int  exp,
const CanonicalForm c 
)
static

Definition at line 243 of file cf_factory.cc.

244 {
245  if ( v.level() == LEVELBASE )
246  return c.getval();
247  else
248  return new InternalPoly( v, exp, c );
249 }
#define LEVELBASE
Definition: cf_defs.h:17
InternalCF * getval() const
factory's class for polynomials
Definition: int_poly.h:71
int level() const
Definition: factory.h:134
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357

◆ poly() [2/2]

InternalCF * CFFactory::poly ( const Variable v,
int  exp = 1 
)
static

Definition at line 252 of file cf_factory.cc.

253 {
254  if ( v.level() == LEVELBASE )
255  return CFFactory::basic( 1L );
256  else
257  return new InternalPoly( v, exp, 1 );
258 }

◆ rational() [1/2]

InternalCF * CFFactory::rational ( const mpz_ptr  num,
const mpz_ptr  den,
bool  normalize 
)
static

Definition at line 232 of file cf_factory.cc.

233 {
234  if ( normalize ) {
236  return result->normalize_myself();
237  }
238  else
239  return new InternalRational( num, den );
240 }
CanonicalForm den(const CanonicalForm &f)
return result
Definition: facAbsBiFact.cc:76
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026

◆ rational() [2/2]

InternalCF * CFFactory::rational ( long  num,
long  den 
)
static

Definition at line 225 of file cf_factory.cc.

226 {
228  return res->normalize_myself();
229 }

◆ settype()

static void CFFactory::settype ( int  type)
inlinestatic

Definition at line 29 of file cf_factory.h.

30  {
31  ASSERT( type==FiniteFieldDomain || type==GaloisFieldDomain || type==IntegerDomain || type==RationalDomain, "illegal basic domain!" );
32  currenttype = type;
33  };

Field Documentation

◆ currenttype

int CFFactory::currenttype = IntegerDomain
staticprivate

Definition at line 26 of file cf_factory.h.


The documentation for this class was generated from the following files: