Loading...
Searching...
No Matches
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"`
`#include "int_pp.h"`
`#include "FLINTconvert.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 70 of file cf_char.cc.

{
return theCharacteristic;
}
theCharacteristic
STATIC_VAR int theCharacteristic
Definition cf_char.cc:25

## getGFDegree()

int getGFDegree | ( |  | ) |

Definition at line 75 of file cf_char.cc.

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

## getGFGenerator()

CanonicalForm getGFGenerator | ( |  | ) |

Definition at line 81 of file cf_char.cc.

{
ASSERT( theDegree > 1, "not in GF(q)" );
return int2imm_gf( 1 );
}
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition imm.h:106

## setCharacteristic() [1/2]

void setCharacteristic | ( | int | c | ) |

Definition at line 28 of file cf_char.cc.

{
if ( c == 0 )
{
theDegree = 0;
CFFactory::settype( IntegerDomain );
theCharacteristic = 0;
}
else
{
theDegree = 1;
CFFactory::settype( FiniteFieldDomain );
ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
if (c!=theCharacteristic)
{
if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
ff_setprime( c );
}
theCharacteristic = c;
}
}
FiniteFieldDomain
#define FiniteFieldDomain
Definition cf_defs.h:19
IntegerDomain
#define IntegerDomain
Definition cf_defs.h:21
cf_getNumSmallPrimes
int cf_getNumSmallPrimes()
Definition cf_primes.cc:34
cf_getSmallPrime
int cf_getSmallPrime(int i)
Definition cf_primes.cc:28
factoryError
VAR void(* factoryError)(const char *s)
Definition cf_util.cc:80
CFFactory::settype
static void settype(int type)
Definition cf_factory.h:29
ff_big
VAR bool ff_big
Definition ffops.cc:25
ff_setprime
void ff_setprime(const int p)
Definition ffops.cc:28

## setCharacteristic() [2/2]

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

Definition at line 61 of file cf_char.cc.

{
ASSERT( c != 0 && n > 1, "illegal GF(q)" );
setCharacteristic( c );
gf_setcharacteristic( c, n, name );
theDegree = n;
CFFactory::settype( GaloisFieldDomain );
}
setCharacteristic
void setCharacteristic(int c)
Definition cf_char.cc:28
GaloisFieldDomain
#define GaloisFieldDomain
Definition cf_defs.h:18
name
char name(const Variable &v)
Definition factory.h:189
gf_setcharacteristic
void gf_setcharacteristic(int p, int n, char name)
Definition gfops.cc:202

## Variable Documentation

## theCharacteristic

STATIC_VAR int theCharacteristic = 0

Definition at line 25 of file cf_char.cc.

## theDegree

STATIC_VAR int theDegree = 1

Definition at line 26 of file cf_char.cc.