spielwiese
Last change
on this file since 928fb6 was
928fb6,
checked in by Martin Lee <martinlee84@…>, 10 years ago
|
chg: get rid of PrimePowerDomain
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | |
---|
3 | #ifdef HAVE_CONFIG_H |
---|
4 | #include "config.h" |
---|
5 | #endif /* HAVE_CONFIG_H */ |
---|
6 | |
---|
7 | #include "cf_assert.h" |
---|
8 | |
---|
9 | #include "cf_defs.h" |
---|
10 | #include "canonicalform.h" |
---|
11 | #include "imm.h" |
---|
12 | #include "cf_primes.h" |
---|
13 | #include "cf_util.h" |
---|
14 | |
---|
15 | static int theCharacteristic = 0; |
---|
16 | static int theDegree = 1; |
---|
17 | |
---|
18 | void setCharacteristic( int c ) |
---|
19 | { |
---|
20 | if ( c == 0 ) |
---|
21 | { |
---|
22 | theDegree = 0; |
---|
23 | CFFactory::settype( IntegerDomain ); |
---|
24 | theCharacteristic = 0; |
---|
25 | } |
---|
26 | else |
---|
27 | { |
---|
28 | theDegree = 1; |
---|
29 | CFFactory::settype( FiniteFieldDomain ); |
---|
30 | theCharacteristic = c; |
---|
31 | ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 ); |
---|
32 | if (c > 536870909) factoryError("characteristic is too large(max is 2^29)"); |
---|
33 | ff_setprime( c ); |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | void setCharacteristic( int c, int n, char name ) |
---|
38 | { |
---|
39 | ASSERT( c != 0 && n > 1, "illegal GF(q)" ); |
---|
40 | setCharacteristic( c ); |
---|
41 | gf_setcharacteristic( c, n, name ); |
---|
42 | theDegree = n; |
---|
43 | CFFactory::settype( GaloisFieldDomain ); |
---|
44 | } |
---|
45 | |
---|
46 | int getCharacteristic() |
---|
47 | { |
---|
48 | return theCharacteristic; |
---|
49 | } |
---|
50 | |
---|
51 | int getGFDegree() |
---|
52 | { |
---|
53 | //ASSERT( theDegree > 0, "not in GF(q)" ); |
---|
54 | return theDegree; |
---|
55 | } |
---|
56 | |
---|
57 | CanonicalForm getGFGenerator() |
---|
58 | { |
---|
59 | ASSERT( theDegree > 1, "not in GF(q)" ); |
---|
60 | return int2imm_gf( 1 ); |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.