My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
factory
cf_char.cc
Go to the documentation of this file.
1
/* emacs edit mode for this file is -*- C++ -*- */
2
3
/**
4
* @file cf_char.cc
5
*
6
* getting and setting the characteristic of a finite field
7
**/
8
9
#include "config.h"
10
11
12
#include "
cf_assert.h
"
13
14
#include "
cf_defs.h
"
15
#include "
canonicalform.h
"
16
#include "
imm.h
"
17
#include "
cf_primes.h
"
18
#include "
cf_util.h
"
19
#include "
int_pp.h
"
20
21
#ifdef HAVE_FLINT
22
#include "
FLINTconvert.h
"
// for __FLINT_RELEASE
23
#endif
24
25
STATIC_VAR
int
theCharacteristic
= 0;
26
STATIC_VAR
int
theDegree
= 1;
27
28
void
setCharacteristic
(
int
c )
29
{
30
if
( c == 0 )
31
{
32
theDegree
= 0;
33
CFFactory::settype
(
IntegerDomain
);
34
theCharacteristic
= 0;
35
}
36
else
37
{
38
theDegree
= 1;
39
CFFactory::settype
(
FiniteFieldDomain
);
40
ff_big
= c >
cf_getSmallPrime
(
cf_getNumSmallPrimes
()-1 );
41
if
(c!=
theCharacteristic
)
42
{
43
if
(c > 536870909)
factoryError
(
"characteristic is too large(max is 2^29)"
);
44
ff_setprime
( c );
45
}
46
theCharacteristic
= c;
47
}
48
}
49
50
#if !defined(HAVE_NTL)
51
void
setCharacteristic
(
int
c,
int
n )
52
{
53
ASSERT
( c > 1 && n > 0,
"illegal characteristic"
);
54
setCharacteristic
( c );
55
InternalPrimePower::setPrimePower
( c, n );
56
CFFactory::settype
(
PrimePowerDomain
);
57
}
58
#endif
59
60
61
void
setCharacteristic
(
int
c,
int
n,
char
name
)
62
{
63
ASSERT
( c != 0 && n > 1,
"illegal GF(q)"
);
64
setCharacteristic
( c );
65
gf_setcharacteristic
( c, n,
name
);
66
theDegree
= n;
67
CFFactory::settype
(
GaloisFieldDomain
);
68
}
69
70
int
getCharacteristic
()
71
{
72
return
theCharacteristic
;
73
}
74
75
int
getGFDegree
()
76
{
77
//ASSERT( theDegree > 0, "not in GF(q)" );
78
return
theDegree
;
79
}
80
81
CanonicalForm
getGFGenerator
()
82
{
83
ASSERT
(
theDegree
> 1,
"not in GF(q)"
);
84
return
int2imm_gf
( 1 );
85
}
FLINTconvert.h
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
canonicalform.h
Header for factory's main class CanonicalForm.
cf_assert.h
assertions for Factory
ASSERT
#define ASSERT(expression, message)
Definition
cf_assert.h:99
getCharacteristic
int getCharacteristic()
Definition
cf_char.cc:70
getGFDegree
int getGFDegree()
Definition
cf_char.cc:75
theCharacteristic
STATIC_VAR int theCharacteristic
Definition
cf_char.cc:25
theDegree
STATIC_VAR int theDegree
Definition
cf_char.cc:26
getGFGenerator
CanonicalForm getGFGenerator()
Definition
cf_char.cc:81
setCharacteristic
void setCharacteristic(int c)
Definition
cf_char.cc:28
cf_defs.h
factory switches.
PrimePowerDomain
#define PrimePowerDomain
Definition
cf_defs.h:17
FiniteFieldDomain
#define FiniteFieldDomain
Definition
cf_defs.h:19
IntegerDomain
#define IntegerDomain
Definition
cf_defs.h:21
GaloisFieldDomain
#define GaloisFieldDomain
Definition
cf_defs.h:18
cf_getNumSmallPrimes
int cf_getNumSmallPrimes()
Definition
cf_primes.cc:34
cf_getSmallPrime
int cf_getSmallPrime(int i)
Definition
cf_primes.cc:28
cf_primes.h
access to prime tables
factoryError
VAR void(* factoryError)(const char *s)
Definition
cf_util.cc:80
cf_util.h
CFFactory::settype
static void settype(int type)
Definition
cf_factory.h:29
CanonicalForm
factory's main class
Definition
canonicalform.h:86
InternalPrimePower::setPrimePower
static void setPrimePower(int p, int k)
ff_big
VAR bool ff_big
Definition
ffops.cc:25
ff_setprime
void ff_setprime(const int p)
Definition
ffops.cc:28
gf_setcharacteristic
void gf_setcharacteristic(int p, int n, char name)
Definition
gfops.cc:202
STATIC_VAR
#define STATIC_VAR
Definition
globaldefs.h:7
imm.h
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int,...
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition
imm.h:106
int_pp.h
name
int name
New type name for int.
Definition
templateForC.h:21
Generated on
for My Project by
doxygen 1.17.0
for
Singular