Loading...
Searching...
No Matches
CFFactory Class Reference

`#include <cf_factory.h>`

## Static Public Member Functions

static int | gettype ()
static void | settype (int type)
static InternalCF * | basic (int value)
static InternalCF * | basic (long value)
static InternalCF * | basic (int type, long value)
static InternalCF * | basic (const char *str)
static InternalCF * | basic (const char *str, int base)
static InternalCF * | basic (int type, const char *const str)
static InternalCF * | basic (int type, long value, bool nonimm)
static InternalCF * | basic (const mpz_ptr num)
static InternalCF * | rational (long num, long den)
static InternalCF * | rational (const mpz_ptr num, const mpz_ptr den, bool normalize)
static InternalCF * | poly (const Variable &v, int exp, const CanonicalForm &c)
static InternalCF * | poly (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/8]

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

static

Definition at line 122 of file cf_factory.cc.

{
if ( currenttype == IntegerDomain ) {
InternalInteger * dummy = new InternalInteger( str );
if ( dummy->is_imm() ) {
InternalCF * res = int2imm( dummy->intval() );
delete dummy;
return res;
}
else
return dummy;
}
// else if ( currenttype == RationalDomain ) {
// InternalRational * dummy = new InternalRational( str );
// if ( dummy->is_imm() ) {
// InternalCF * res = int2imm( dummy->intval() );
// delete dummy;
// return res;
// }
// else
// return dummy;
// }
else if ( currenttype == FiniteFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str );
InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
delete dummy;
return res;
}
else if ( currenttype == GaloisFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str );
InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
delete dummy;
return res;
}
else {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
}
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
FiniteFieldDomain
#define FiniteFieldDomain
Definition cf_defs.h:19
IntegerDomain
#define IntegerDomain
Definition cf_defs.h:21
GaloisFieldDomain
#define GaloisFieldDomain
Definition cf_defs.h:18
CFFactory::currenttype
static int currenttype
Definition cf_factory.h:26
InternalInteger::intval
long intval() const
Definition int_int.cc:506
InternalInteger::is_imm
bool is_imm() const
Definition int_int.cc:41
InternalInteger::intmod
int intmod(int p) const
Definition int_int.cc:511
res
CanonicalForm res
Definition facAbsFact.cc:60
ff_prime
VAR int ff_prime
Definition ffops.cc:23
gf_int2gf
int gf_int2gf(int i)
Definition gfops.h:65
int2imm_p
InternalCF * int2imm_p(long i)
Definition imm.h:101
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition imm.h:106
int2imm
static InternalCF * int2imm(long i)
Definition imm.h:75

## basic() [2/8]

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

static

Definition at line 163 of file cf_factory.cc.

{
if ( currenttype == IntegerDomain ) {
InternalInteger * dummy = new InternalInteger( str, base );
if ( dummy->is_imm() ) {
InternalCF * res = int2imm( dummy->intval() );
delete dummy;
return res;
}
else
return dummy;
}
// else if ( currenttype == RationalDomain ) {
// InternalRational * dummy = new InternalRational( str );
// if ( dummy->is_imm() ) {
// InternalCF * res = int2imm( dummy->intval() );
// delete dummy;
// return res;
// }
// else
// return dummy;
// }
else if ( currenttype == FiniteFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str, base );
InternalCF * res = int2imm_p( dummy->intmod( ff_prime ) );
delete dummy;
return res;
}
else if ( currenttype == GaloisFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str, base );
InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
delete dummy;
return res;
}
else {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
}

## basic() [3/8]

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

static

Definition at line 261 of file cf_factory.cc.

{
ASSERT (currenttype == IntegerDomain, "Integer domain expected");
return new InternalInteger( num );
}
num
CanonicalForm num(const CanonicalForm &f)
Definition canonicalform.h:337

## basic() [4/8]

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

static

Definition at line 204 of file cf_factory.cc.

{
if ( type == IntegerDomain ) {
InternalInteger * dummy = new InternalInteger( str );
if ( dummy->is_imm() ) {
InternalCF * res = int2imm( dummy->intval() );
delete dummy;
return res;
}
else
return dummy;
}
// else if ( type == RationalDomain ) {
// InternalRational * dummy = new InternalRational( str );
// if ( dummy->is_imm() ) {
// InternalCF * res = int2imm( dummy->intval() );
// delete dummy;
// return res;
// }
// else
// return dummy;
// }
else if ( type == FiniteFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str );
InternalCF * res = int2imm( dummy->intmod( ff_prime ) );
delete dummy;
return res;
}
else if ( type == GaloisFieldDomain ) {
InternalInteger * dummy = new InternalInteger( str );
InternalCF * res = int2imm_gf( gf_int2gf( dummy->intmod( ff_prime ) ) );
delete dummy;
return res;
}
else {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
}

## basic() [5/8]

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

static

Definition at line 99 of file cf_factory.cc.

{
if ( type == IntegerDomain )
if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
return int2imm( value );
else
return new InternalInteger( value );
// else if ( type == RationalDomain )
// if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
// return int2imm( value );
// else
// return new InternalRational( value );
else if ( type == FiniteFieldDomain )
return int2imm_p( ff_norm( value ) );
else if ( type == GaloisFieldDomain )
return int2imm_gf( gf_int2gf( value ) );
else {
ASSERT1( 0, "illegal basic domain (type = %d)!", type );
return 0;
}
}
LIKELY
#define LIKELY(X)
Definition auxiliary.h:404
ASSERT1
#define ASSERT1(expression, message, parameter1)
Definition cf_assert.h:101
ff_norm
int ff_norm(const int a)
Definition ffops.h:39
MAXIMMEDIATE
const long MAXIMMEDIATE
Definition imm.h:55
MINIMMEDIATE
const long MINIMMEDIATE
Definition imm.h:54

## basic() [6/8]

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

static

Definition at line 245 of file cf_factory.cc.

{
if ( nonimm )
if ( type == IntegerDomain )
return new InternalInteger( value );
else if ( type == RationalDomain )
return new InternalRational( value );
else {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
else
return CFFactory::basic( type, value );
}
RationalDomain
#define RationalDomain
Definition cf_defs.h:20
CFFactory::basic
static InternalCF * basic(int value)
Definition cf_factory.cc:61

## basic() [7/8]

InternalCF * CFFactory::basic | ( | int | value | ) |

static

Definition at line 61 of file cf_factory.cc.

{
switch(currenttype)
{
case IntegerDomain:
#if SIZEOF_LONG == 8
return int2imm( value );
#else
if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
return int2imm( value );
else
return new InternalInteger( value );
#endif
case RationalDomain:
#if SIZEOF_LONG == 8
return int2imm( value );
#else
if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
return int2imm( value );
else
return new InternalRational( value );
#endif
case FiniteFieldDomain:
return int2imm_p( ff_norm( value ) );
case GaloisFieldDomain:
return int2imm_gf( gf_int2gf( value ) );
#ifndef HAVE_NTL
case PrimePowerDomain:
return new InternalPrimePower( value );
#endif
default: {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
}
}
PrimePowerDomain
#define PrimePowerDomain
Definition cf_defs.h:17

## basic() [8/8]

InternalCF * CFFactory::basic | ( | long | value | ) |

static

Definition at line 31 of file cf_factory.cc.

{
switch(currenttype)
{
case IntegerDomain:
if (LIKELY( value >= MINIMMEDIATE && value <= MAXIMMEDIATE ))
return int2imm( value );
else
return new InternalInteger( value );
// else if ( currenttype == RationalDomain )
// if ( value >= MINIMMEDIATE && value <= MAXIMMEDIATE )
// return int2imm( value );
// else
// return new InternalRational( value );
case FiniteFieldDomain:
return int2imm_p( ff_norm( value ) );
case GaloisFieldDomain:
return int2imm_gf( gf_int2gf( value ) );
#ifndef HAVE_NTL
case PrimePowerDomain:
return new InternalPrimePower( value );
#endif
default: {
ASSERT( 0, "illegal basic domain!" );
return 0;
}
}
}

## gettype()

int CFFactory::gettype | ( |  | ) |

inline static

Definition at line 28 of file cf_factory.h.

{ return currenttype; }

## poly() [1/2]

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

static

Definition at line 286 of file cf_factory.cc.

{
if ( v.level() == LEVELBASE )
return c.getval();
else
return new InternalPoly( v, exp, c );
}
LEVELBASE
#define LEVELBASE
Definition cf_defs.h:25
CanonicalForm::getval
InternalCF * getval() const
Definition canonicalform.cc:34
Variable::level
int level() const
Definition factory.h:143
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
exp
gmp_float exp(const gmp_float &a)
Definition mpr_complex.cc:349

## poly() [2/2]

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

static

Definition at line 295 of file cf_factory.cc.

{
if ( v.level() == LEVELBASE )
return CFFactory::basic( 1L );
else
return new InternalPoly( v, exp, 1 );
}

## rational() [1/2]

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

static

Definition at line 275 of file cf_factory.cc.

{
if ( normalize ) {
InternalRational * result = new InternalRational( num, den );
return result->normalize_myself();
}
else
return new InternalRational( num, den );
}
den
CanonicalForm den(const CanonicalForm &f)
Definition canonicalform.h:340
result
return result
Definition facAbsBiFact.cc:76
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition syz3.cc:1027

## rational() [2/2]

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

static

Definition at line 268 of file cf_factory.cc.

{
InternalRational * res = new InternalRational( num, den );
return res->normalize_myself();
}

## settype()

void CFFactory::settype | ( | int | type | ) |

inline static

Definition at line 29 of file cf_factory.h.

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

## Field Documentation

## currenttype

int CFFactory::currenttype = IntegerDomain

static private

Definition at line 26 of file cf_factory.h.

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

- factory/cf_factory.h
- factory/cf_factory.cc