Functions | Variables
cf_char.cc File Reference

getting and setting the characteristic of a finite field More...

#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "canonicalform.h"
#include "imm.h"
#include "cf_primes.h"
#include "cf_util.h"

Go to the source code of this file.

Functions

void setCharacteristic (int c)
 
void setCharacteristic (int c, int n, char name)
 
int getCharacteristic ()
 
int getGFDegree ()
 
CanonicalForm getGFGenerator ()
 

Variables

STATIC_VAR int theCharacteristic = 0
 
STATIC_VAR int theDegree = 1
 

Detailed Description

getting and setting the characteristic of a finite field

Definition in file cf_char.cc.

Function Documentation

◆ getCharacteristic()

int getCharacteristic ( )

Definition at line 51 of file cf_char.cc.

52 {
53  return theCharacteristic;
54 }
STATIC_VAR int theCharacteristic
Definition: cf_char.cc:20

◆ getGFDegree()

int getGFDegree ( )

Definition at line 56 of file cf_char.cc.

57 {
58  //ASSERT( theDegree > 0, "not in GF(q)" );
59  return theDegree;
60 }
STATIC_VAR int theDegree
Definition: cf_char.cc:21

◆ getGFGenerator()

CanonicalForm getGFGenerator ( )

Definition at line 62 of file cf_char.cc.

63 {
64  ASSERT( theDegree > 1, "not in GF(q)" );
65  return int2imm_gf( 1 );
66 }
InternalCF * int2imm_gf(long i)
Definition: imm.h:106
STATIC_VAR int theDegree
Definition: cf_char.cc:21
#define ASSERT(expression, message)
Definition: cf_assert.h:99

◆ setCharacteristic() [1/2]

void setCharacteristic ( int  c)

Definition at line 23 of file cf_char.cc.

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 }
int cf_getSmallPrime(int i)
Definition: cf_primes.cc:28
STATIC_VAR int theCharacteristic
Definition: cf_char.cc:20
static void settype(int type)
Definition: cf_factory.h:29
#define IntegerDomain
Definition: cf_defs.h:26
VAR void(* factoryError)(const char *s)
Definition: cf_util.cc:76
VAR bool ff_big
Definition: ffops.cc:16
int cf_getNumSmallPrimes()
Definition: cf_primes.cc:34
STATIC_VAR int theDegree
Definition: cf_char.cc:21
void ff_setprime(const int p)
Definition: ffops.cc:19
#define FiniteFieldDomain
Definition: cf_defs.h:24

◆ setCharacteristic() [2/2]

void setCharacteristic ( int  c,
int  n,
char  name 
)

Definition at line 42 of file cf_char.cc.

43 {
44  ASSERT( c != 0 && n > 1, "illegal GF(q)" );
45  setCharacteristic( c );
46  gf_setcharacteristic( c, n, name );
47  theDegree = n;
49 }
void gf_setcharacteristic(int p, int n, char name)
Definition: gfops.cc:219
static void settype(int type)
Definition: cf_factory.h:29
char name(const Variable &v)
Definition: factory.h:180
void setCharacteristic(int c)
Definition: cf_char.cc:23
STATIC_VAR int theDegree
Definition: cf_char.cc:21
#define GaloisFieldDomain
Definition: cf_defs.h:23
#define ASSERT(expression, message)
Definition: cf_assert.h:99

Variable Documentation

◆ theCharacteristic

STATIC_VAR int theCharacteristic = 0

Definition at line 20 of file cf_char.cc.

◆ theDegree

STATIC_VAR int theDegree = 1

Definition at line 21 of file cf_char.cc.