My Project
Loading...
Searching...
No Matches
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
27
28void setCharacteristic( int c )
29{
30 if ( c == 0 )
31 {
32 theDegree = 0;
35 }
36 else
37 {
38 theDegree = 1;
41 if (c!=theCharacteristic)
42 {
43 if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
44 ff_setprime( c );
45 }
47 }
48}
49
50#if !defined(HAVE_NTL)
51void setCharacteristic( int c, int n )
52{
53 ASSERT( c > 1 && n > 0, "illegal characteristic" );
57}
58#endif
59
60
61void setCharacteristic( int c, int n, char name )
62{
63 ASSERT( c != 0 && n > 1, "illegal GF(q)" );
66 theDegree = n;
68}
69
71{
72 return theCharacteristic;
73}
74
76{
77 //ASSERT( theDegree > 0, "not in GF(q)" );
78 return theDegree;
79}
80
82{
83 ASSERT( theDegree > 1, "not in GF(q)" );
84 return int2imm_gf( 1 );
85}
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
Header for factory's main class CanonicalForm.
assertions for Factory
#define ASSERT(expression, message)
Definition: cf_assert.h:99
int getCharacteristic()
Definition: cf_char.cc:70
int getGFDegree()
Definition: cf_char.cc:75
STATIC_VAR int theCharacteristic
Definition: cf_char.cc:25
STATIC_VAR int theDegree
Definition: cf_char.cc:26
CanonicalForm getGFGenerator()
Definition: cf_char.cc:81
void setCharacteristic(int c)
Definition: cf_char.cc:28
factory switches.
#define PrimePowerDomain
Definition: cf_defs.h:17
#define FiniteFieldDomain
Definition: cf_defs.h:19
#define IntegerDomain
Definition: cf_defs.h:21
#define GaloisFieldDomain
Definition: cf_defs.h:18
int cf_getNumSmallPrimes()
Definition: cf_primes.cc:34
int cf_getSmallPrime(int i)
Definition: cf_primes.cc:28
access to prime tables
VAR void(* factoryError)(const char *s)
Definition: cf_util.cc:80
static void settype(int type)
Definition: cf_factory.h:29
factory's main class
Definition: canonicalform.h:86
static void setPrimePower(int p, int k)
VAR bool ff_big
Definition: ffops.cc:16
void ff_setprime(const int p)
Definition: ffops.cc:19
void gf_setcharacteristic(int p, int n, char name)
Definition: gfops.cc:202
#define STATIC_VAR
Definition: globaldefs.h:7
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int,...
InternalCF * int2imm_gf(long i)
Definition: imm.h:106
int name
New type name for int.
Definition: templateForC.h:21