My Project  debian-1:4.1.1-p2+ds-4
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 76 of file cf_factory.cc.

77 {
78  if ( currenttype == IntegerDomain ) {
79  InternalInteger * dummy = new InternalInteger( str );
80  if ( dummy->is_imm() ) {
81  InternalCF * res = int2imm( dummy->intval() );
82  delete dummy;
83  return res;
84  }
85  else
86  return dummy;
87  }
88 // else if ( currenttype == RationalDomain ) {
89 // InternalRational * dummy = new InternalRational( str );
90 // if ( dummy->is_imm() ) {
91 // InternalCF * res = int2imm( dummy->intval() );
92 // delete dummy;
93 // return res;
94 // }
95 // else
96 // return dummy;
97 // }
98  else if ( currenttype == FiniteFieldDomain ) {
99  InternalInteger * dummy = new InternalInteger( str );
100  InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
101  delete dummy;
102  return res;
103  }
104  else if ( currenttype == GaloisFieldDomain ) {
105  InternalInteger * dummy = new InternalInteger( str );
106  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
107  delete dummy;
108  return res;
109  }
110  else {
111  ASSERT( 0, "illegal basic domain!" );
112  return 0;
113  }
114 }

◆ basic() [2/7]

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

Definition at line 117 of file cf_factory.cc.

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

◆ basic() [3/7]

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

Definition at line 215 of file cf_factory.cc.

216 {
217  ASSERT (currenttype == IntegerDomain, "Integer domain expected");
218  return new InternalInteger( num );
219 }

◆ basic() [4/7]

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

Definition at line 158 of file cf_factory.cc.

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

◆ basic() [5/7]

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

Definition at line 53 of file cf_factory.cc.

54 {
55  if ( type == IntegerDomain )
56  if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
57  return int2imm( value );
58  else
59  return new InternalInteger( value );
60 // else if ( type == RationalDomain )
61 // if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
62 // return int2imm( value );
63 // else
64 // return new InternalRational( value );
65  else if ( type == FiniteFieldDomain )
66  return int2imm_p( ff_norm( value ) );
67  else if ( type == GaloisFieldDomain )
68  return int2imm_gf( gf_int2gf( value ) );
69  else {
70  ASSERT1( 0, "illegal basic domain (type = %d)!", type );
71  return 0;
72  }
73 }

◆ basic() [6/7]

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

Definition at line 199 of file cf_factory.cc.

200 {
201  if ( nonimm )
202  if ( type == IntegerDomain )
203  return new InternalInteger( value );
204  else if ( type == RationalDomain )
205  return new InternalRational( value );
206  else {
207  ASSERT( 0, "illegal basic domain!" );
208  return 0;
209  }
210  else
211  return CFFactory::basic( type, value );
212 }

◆ basic() [7/7]

InternalCF * CFFactory::basic ( long  value)
static

Definition at line 30 of file cf_factory.cc.

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

◆ 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 240 of file cf_factory.cc.

241 {
242  if ( v.level() == LEVELBASE )
243  return c.getval();
244  else
245  return new InternalPoly( v, exp, c );
246 }

◆ poly() [2/2]

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

Definition at line 249 of file cf_factory.cc.

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

◆ rational() [1/2]

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

Definition at line 229 of file cf_factory.cc.

230 {
231  if ( normalize ) {
233  return result->normalize_myself();
234  }
235  else
236  return new InternalRational( num, den );
237 }

◆ rational() [2/2]

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

Definition at line 222 of file cf_factory.cc.

223 {
225  return res->normalize_myself();
226 }

◆ 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:
InternalInteger::intval
long intval() const
Definition: int_int.cc:506
MINIMMEDIATE
const long MINIMMEDIATE
Definition: imm.h:54
InternalInteger::is_imm
bool is_imm() const
Definition: int_int.cc:41
result
return result
Definition: facAbsBiFact.cc:76
RationalDomain
#define RationalDomain
Definition: cf_defs.h:24
num
CanonicalForm num(const CanonicalForm &f)
Definition: canonicalform.h:330
CxxTest::base
char N base
Definition: ValueTraits.h:144
MAXIMMEDIATE
const long MAXIMMEDIATE
Definition: imm.h:55
InternalCF
virtual class for internal CanonicalForm's
Definition: int_cf.h:41
GaloisFieldDomain
#define GaloisFieldDomain
Definition: cf_defs.h:22
res
CanonicalForm res
Definition: facAbsFact.cc:64
ASSERT
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int2imm
static InternalCF * int2imm(long i)
Definition: imm.h:75
InternalPoly
factory's class for polynomials
Definition: int_poly.h:71
CFFactory::basic
static InternalCF * basic(long value)
Definition: cf_factory.cc:30
InternalInteger::intmod
int intmod(int p) const
Definition: int_int.cc:511
FiniteFieldDomain
#define FiniteFieldDomain
Definition: cf_defs.h:23
Variable::level
int level() const
Definition: factory.h:134
den
CanonicalForm den(const CanonicalForm &f)
Definition: canonicalform.h:333
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
InternalRational
factory's class for rationals
Definition: int_rat.h:38
LEVELBASE
#define LEVELBASE
Definition: cf_defs.h:16
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1026
int2imm_p
InternalCF * int2imm_p(long i)
Definition: imm.h:101
ff_norm
int ff_norm(const int a)
Definition: ffops.h:39
ff_prime
int ff_prime
Definition: ffops.cc:14
LIKELY
#define LIKELY(expression)
For optimizing if-branches.
Definition: cf_factory.cc:23
CFFactory::currenttype
static int currenttype
Definition: cf_factory.h:26
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ASSERT1
#define ASSERT1(expression, message, parameter1)
Definition: cf_assert.h:101
gf_int2gf
int gf_int2gf(int i)
Definition: gfops.h:65
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition: imm.h:106
IntegerDomain
#define IntegerDomain
Definition: cf_defs.h:25
InternalInteger
factory's class for integers
Definition: int_int.h:40
CanonicalForm::getval
InternalCF * getval() const
Definition: canonicalform.cc:31