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 ( long  value)
static

Definition at line 21 of file cf_factory.cc.

22 {
23  if ( currenttype == IntegerDomain )
24  if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
25  return int2imm( value );
26  else
27  return new InternalInteger( value );
28 // else if ( currenttype == RationalDomain )
29 // if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
30 // return int2imm( value );
31 // else
32 // return new InternalRational( value );
33  else if ( currenttype == FiniteFieldDomain )
34  return int2imm_p( ff_norm( value ) );
35  else if ( currenttype == GaloisFieldDomain )
36  return int2imm_gf( gf_int2gf( value ) );
37  else {
38  ASSERT( 0, "illegal basic domain!" );
39  return 0;
40  }
41 }
const long MINIMMEDIATE
Definition: imm.h:50
InternalCF * int2imm(long i)
Definition: imm.h:71
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_norm(const int a)
Definition: ffops.h:35
#define IntegerDomain
Definition: cf_defs.h:25
static int currenttype
Definition: cf_factory.h:26
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
const long MAXIMMEDIATE
Definition: imm.h:51
#define GaloisFieldDomain
Definition: cf_defs.h:22
int gf_int2gf(int i)
Definition: gfops.h:65
#define ASSERT(expression, message)
Definition: cf_assert.h:99
factory&#39;s class for integers
Definition: int_int.h:41
#define FiniteFieldDomain
Definition: cf_defs.h:23

◆ basic() [2/7]

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

Definition at line 44 of file cf_factory.cc.

45 {
46  if ( type == IntegerDomain )
47  if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
48  return int2imm( value );
49  else
50  return new InternalInteger( value );
51 // else if ( type == RationalDomain )
52 // if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
53 // return int2imm( value );
54 // else
55 // return new InternalRational( value );
56  else if ( type == FiniteFieldDomain )
57  return int2imm_p( ff_norm( value ) );
58  else if ( type == GaloisFieldDomain )
59  return int2imm_gf( gf_int2gf( value ) );
60  else {
61  ASSERT1( 0, "illegal basic domain (type = %d)!", type );
62  return 0;
63  }
64 }
const long MINIMMEDIATE
Definition: imm.h:50
InternalCF * int2imm(long i)
Definition: imm.h:71
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_norm(const int a)
Definition: ffops.h:35
#define IntegerDomain
Definition: cf_defs.h:25
#define ASSERT1(expression, message, parameter1)
Definition: cf_assert.h:101
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
const long MAXIMMEDIATE
Definition: imm.h:51
#define GaloisFieldDomain
Definition: cf_defs.h:22
int gf_int2gf(int i)
Definition: gfops.h:65
factory&#39;s class for integers
Definition: int_int.h:41
#define FiniteFieldDomain
Definition: cf_defs.h:23

◆ basic() [3/7]

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

Definition at line 67 of file cf_factory.cc.

68 {
69  if ( currenttype == IntegerDomain ) {
70  InternalInteger * dummy = new InternalInteger( str );
71  if ( dummy->is_imm() ) {
72  InternalCF * res = int2imm( dummy->intval() );
73  delete dummy;
74  return res;
75  }
76  else
77  return dummy;
78  }
79 // else if ( currenttype == RationalDomain ) {
80 // InternalRational * dummy = new InternalRational( str );
81 // if ( dummy->is_imm() ) {
82 // InternalCF * res = int2imm( dummy->intval() );
83 // delete dummy;
84 // return res;
85 // }
86 // else
87 // return dummy;
88 // }
89  else if ( currenttype == FiniteFieldDomain ) {
90  InternalInteger * dummy = new InternalInteger( str );
91  InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
92  delete dummy;
93  return res;
94  }
95  else if ( currenttype == GaloisFieldDomain ) {
96  InternalInteger * dummy = new InternalInteger( str );
97  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
98  delete dummy;
99  return res;
100  }
101  else {
102  ASSERT( 0, "illegal basic domain!" );
103  return 0;
104  }
105 }
InternalCF * int2imm(long i)
Definition: imm.h:71
InternalCF * int2imm_p(long i)
Definition: imm.h:97
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
poly res
Definition: myNF.cc:322
long intval() const
Definition: int_int.cc:533
static int currenttype
Definition: cf_factory.h:26
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
int intmod(int p) const
Definition: int_int.cc:538
#define GaloisFieldDomain
Definition: cf_defs.h:22
int gf_int2gf(int i)
Definition: gfops.h:65
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int ff_prime
Definition: ffops.cc:14
factory&#39;s class for integers
Definition: int_int.h:41
bool is_imm() const
Definition: int_int.cc:68
#define FiniteFieldDomain
Definition: cf_defs.h:23

◆ basic() [4/7]

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

Definition at line 108 of file cf_factory.cc.

109 {
110  if ( currenttype == IntegerDomain ) {
111  InternalInteger * dummy = new InternalInteger( str, base );
112  if ( dummy->is_imm() ) {
113  InternalCF * res = int2imm( dummy->intval() );
114  delete dummy;
115  return res;
116  }
117  else
118  return dummy;
119  }
120 // else if ( currenttype == RationalDomain ) {
121 // InternalRational * dummy = new InternalRational( str );
122 // if ( dummy->is_imm() ) {
123 // InternalCF * res = int2imm( dummy->intval() );
124 // delete dummy;
125 // return res;
126 // }
127 // else
128 // return dummy;
129 // }
130  else if ( currenttype == FiniteFieldDomain ) {
131  InternalInteger * dummy = new InternalInteger( str, base );
132  InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
133  delete dummy;
134  return res;
135  }
136  else if ( currenttype == GaloisFieldDomain ) {
137  InternalInteger * dummy = new InternalInteger( str, base );
138  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
139  delete dummy;
140  return res;
141  }
142  else {
143  ASSERT( 0, "illegal basic domain!" );
144  return 0;
145  }
146 }
InternalCF * int2imm(long i)
Definition: imm.h:71
char N base
Definition: ValueTraits.h:144
InternalCF * int2imm_p(long i)
Definition: imm.h:97
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
poly res
Definition: myNF.cc:322
long intval() const
Definition: int_int.cc:533
static int currenttype
Definition: cf_factory.h:26
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
int intmod(int p) const
Definition: int_int.cc:538
#define GaloisFieldDomain
Definition: cf_defs.h:22
int gf_int2gf(int i)
Definition: gfops.h:65
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int ff_prime
Definition: ffops.cc:14
factory&#39;s class for integers
Definition: int_int.h:41
bool is_imm() const
Definition: int_int.cc:68
#define FiniteFieldDomain
Definition: cf_defs.h:23

◆ basic() [5/7]

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

Definition at line 149 of file cf_factory.cc.

150 {
151  if ( type == IntegerDomain ) {
152  InternalInteger * dummy = new InternalInteger( str );
153  if ( dummy->is_imm() ) {
154  InternalCF * res = int2imm( dummy->intval() );
155  delete dummy;
156  return res;
157  }
158  else
159  return dummy;
160  }
161 // else if ( type == RationalDomain ) {
162 // InternalRational * dummy = new InternalRational( str );
163 // if ( dummy->is_imm() ) {
164 // InternalCF * res = int2imm( dummy->intval() );
165 // delete dummy;
166 // return res;
167 // }
168 // else
169 // return dummy;
170 // }
171  else if ( type == FiniteFieldDomain ) {
172  InternalInteger * dummy = new InternalInteger( str );
173  InternalCF * res = int2imm( dummy->intmod( ff_prime ) );
174  delete dummy;
175  return res;
176  }
177  else if ( type == GaloisFieldDomain ) {
178  InternalInteger * dummy = new InternalInteger( str );
179  InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
180  delete dummy;
181  return res;
182  }
183  else {
184  ASSERT( 0, "illegal basic domain!" );
185  return 0;
186  }
187 }
InternalCF * int2imm(long i)
Definition: imm.h:71
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
poly res
Definition: myNF.cc:322
long intval() const
Definition: int_int.cc:533
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
int intmod(int p) const
Definition: int_int.cc:538
#define GaloisFieldDomain
Definition: cf_defs.h:22
int gf_int2gf(int i)
Definition: gfops.h:65
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int ff_prime
Definition: ffops.cc:14
factory&#39;s class for integers
Definition: int_int.h:41
bool is_imm() const
Definition: int_int.cc:68
#define FiniteFieldDomain
Definition: cf_defs.h:23

◆ basic() [6/7]

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

Definition at line 190 of file cf_factory.cc.

191 {
192  if ( nonimm )
193  if ( type == IntegerDomain )
194  return new InternalInteger( value );
195  else if ( type == RationalDomain )
196  return new InternalRational( value );
197  else {
198  ASSERT( 0, "illegal basic domain!" );
199  return 0;
200  }
201  else
202  return CFFactory::basic( type, value );
203 }
#define IntegerDomain
Definition: cf_defs.h:25
static InternalCF * basic(long value)
Definition: cf_factory.cc:21
#define RationalDomain
Definition: cf_defs.h:24
#define ASSERT(expression, message)
Definition: cf_assert.h:99
factory&#39;s class for integers
Definition: int_int.h:41
factory&#39;s class for rationals
Definition: int_rat.h:39

◆ basic() [7/7]

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

Definition at line 206 of file cf_factory.cc.

207 {
208  ASSERT (currenttype == IntegerDomain, "Integer domain expected");
209  return new InternalInteger( num );
210 }
CanonicalForm num(const CanonicalForm &f)
#define IntegerDomain
Definition: cf_defs.h:25
static int currenttype
Definition: cf_factory.h:26
#define ASSERT(expression, message)
Definition: cf_assert.h:99
factory&#39;s class for integers
Definition: int_int.h:41

◆ gettype()

static int CFFactory::gettype ( )
inlinestatic

Definition at line 28 of file cf_factory.h.

28 { return currenttype; }
static int currenttype
Definition: cf_factory.h:26

◆ poly() [1/2]

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

Definition at line 231 of file cf_factory.cc.

232 {
233  if ( v.level() == LEVELBASE )
234  return c.getval();
235  else
236  return new InternalPoly( v, exp, c );
237 }
#define LEVELBASE
Definition: cf_defs.h:16
int level() const
Definition: factory.h:132
factory&#39;s class for polynomials
Definition: int_poly.h:71
p exp[i]
Definition: DebugPrint.cc:39
InternalCF * getval() const

◆ poly() [2/2]

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

Definition at line 240 of file cf_factory.cc.

241 {
242  if ( v.level() == LEVELBASE )
243  return CFFactory::basic( 1L );
244  else
245  return new InternalPoly( v, exp, 1 );
246 }
#define LEVELBASE
Definition: cf_defs.h:16
int level() const
Definition: factory.h:132
factory&#39;s class for polynomials
Definition: int_poly.h:71
static InternalCF * basic(long value)
Definition: cf_factory.cc:21
p exp[i]
Definition: DebugPrint.cc:39

◆ rational() [1/2]

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

Definition at line 213 of file cf_factory.cc.

214 {
216  return res->normalize_myself();
217 }
InternalCF * normalize_myself()
reduce InternalRational to lowest terms
Definition: int_rat.cc:859
CanonicalForm num(const CanonicalForm &f)
poly res
Definition: myNF.cc:322
CanonicalForm den(const CanonicalForm &f)
factory&#39;s class for rationals
Definition: int_rat.h:39

◆ rational() [2/2]

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

Definition at line 220 of file cf_factory.cc.

221 {
222  if ( normalize ) {
224  return result->normalize_myself();
225  }
226  else
227  return new InternalRational( num, den );
228 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
InternalCF * normalize_myself()
reduce InternalRational to lowest terms
Definition: int_rat.cc:859
CanonicalForm num(const CanonicalForm &f)
CanonicalForm den(const CanonicalForm &f)
factory&#39;s class for rationals
Definition: int_rat.h:39
return result
Definition: facAbsBiFact.cc:76

◆ 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  };
#define IntegerDomain
Definition: cf_defs.h:25
static int currenttype
Definition: cf_factory.h:26
#define RationalDomain
Definition: cf_defs.h:24
#define GaloisFieldDomain
Definition: cf_defs.h:22
#define ASSERT(expression, message)
Definition: cf_assert.h:99
#define FiniteFieldDomain
Definition: cf_defs.h:23

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: