My Project  debian-1:4.1.2-p1+ds-2
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 
22 
23 void setCharacteristic( int c )
24 {
25  if ( c == 0 )
26  {
27  theDegree = 0;
30  }
31  else
32  {
33  theDegree = 1;
37  if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
38  ff_setprime( c );
39  }
40 }
41 
42 void setCharacteristic( int c, int n, char name )
43 {
44  ASSERT( c != 0 && n > 1, "illegal GF(q)" );
45  setCharacteristic( c );
46  gf_setcharacteristic( c, n, name );
47  theDegree = n;
49 }
50 
52 {
53  return theCharacteristic;
54 }
55 
57 {
58  //ASSERT( theDegree > 0, "not in GF(q)" );
59  return theDegree;
60 }
61 
63 {
64  ASSERT( theDegree > 1, "not in GF(q)" );
65  return int2imm_gf( 1 );
66 }
canonicalform.h
getCharacteristic
int getCharacteristic()
Definition: cf_char.cc:51
theCharacteristic
STATIC_VAR int theCharacteristic
Definition: cf_char.cc:20
STATIC_VAR
#define STATIC_VAR
Definition: globaldefs.h:7
cf_primes.h
CanonicalForm
factory's main class
Definition: canonicalform.h:77
GaloisFieldDomain
#define GaloisFieldDomain
Definition: cf_defs.h:23
ASSERT
#define ASSERT(expression, message)
Definition: cf_assert.h:99
cf_defs.h
cf_util.h
FiniteFieldDomain
#define FiniteFieldDomain
Definition: cf_defs.h:24
gf_setcharacteristic
void gf_setcharacteristic(int p, int n, char name)
Definition: gfops.cc:219
theDegree
STATIC_VAR int theDegree
Definition: cf_char.cc:21
imm.h
CFFactory::settype
static void settype(int type)
Definition: cf_factory.h:29
setCharacteristic
void setCharacteristic(int c)
Definition: cf_char.cc:23
cf_getSmallPrime
int cf_getSmallPrime(int i)
Definition: cf_primes.cc:28
name
char name(const Variable &v)
Definition: factory.h:180
getGFDegree
int getGFDegree()
Definition: cf_char.cc:56
ff_big
VAR bool ff_big
Definition: ffops.cc:16
cf_assert.h
getGFGenerator
CanonicalForm getGFGenerator()
Definition: cf_char.cc:62
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition: imm.h:106
cf_getNumSmallPrimes
int cf_getNumSmallPrimes()
Definition: cf_primes.cc:34
IntegerDomain
#define IntegerDomain
Definition: cf_defs.h:26
factoryError
VAR void(* factoryError)(const char *s)
Definition: cf_util.cc:76
ff_setprime
void ff_setprime(const int p)
Definition: ffops.cc:19