jengelh-datetimespielwiese
Last change
on this file since b1d287 was
362fc67,
checked in by Martin Lee <martinlee84@…>, 11 years ago
|
chg: remove $Id$
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | |
---|
3 | #include "config.h" |
---|
4 | |
---|
5 | #include "cf_assert.h" |
---|
6 | |
---|
7 | #include "cf_defs.h" |
---|
8 | #include "canonicalform.h" |
---|
9 | #include "imm.h" |
---|
10 | #include "int_pp.h" |
---|
11 | #include "cf_primes.h" |
---|
12 | #include "cf_binom.h" |
---|
13 | #include "cf_util.h" |
---|
14 | |
---|
15 | static int theCharacteristic = 0; |
---|
16 | static int theDegree = 1; |
---|
17 | |
---|
18 | int initializeCharacteristic () |
---|
19 | { |
---|
20 | theCharacteristic = 0; |
---|
21 | theDegree = 1; |
---|
22 | return 1; |
---|
23 | } |
---|
24 | |
---|
25 | void setCharacteristic( int c ) |
---|
26 | { |
---|
27 | if ( c == 0 ) |
---|
28 | { |
---|
29 | theDegree = 0; |
---|
30 | CFFactory::settype( IntegerDomain ); |
---|
31 | theCharacteristic = 0; |
---|
32 | } |
---|
33 | else |
---|
34 | { |
---|
35 | theDegree = 1; |
---|
36 | CFFactory::settype( FiniteFieldDomain ); |
---|
37 | theCharacteristic = c; |
---|
38 | ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 ); |
---|
39 | if (c > 536870909) factoryError("characteristic is too large(max is 2^29)"); |
---|
40 | ff_setprime( c ); |
---|
41 | resetFPT(); |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | void setCharacteristic( int c, int n ) |
---|
46 | { |
---|
47 | ASSERT( c > 1 && n > 0, "illegal characteristic" ); |
---|
48 | setCharacteristic( c ); |
---|
49 | InternalPrimePower::setPrimePower( c, n ); |
---|
50 | CFFactory::settype( PrimePowerDomain ); |
---|
51 | } |
---|
52 | |
---|
53 | void setCharacteristic( int c, int n, char name ) |
---|
54 | { |
---|
55 | ASSERT( c != 0 && n > 1, "illegal GF(q)" ); |
---|
56 | setCharacteristic( c ); |
---|
57 | gf_setcharacteristic( c, n, name ); |
---|
58 | theDegree = n; |
---|
59 | CFFactory::settype( GaloisFieldDomain ); |
---|
60 | } |
---|
61 | |
---|
62 | int getCharacteristic() |
---|
63 | { |
---|
64 | return theCharacteristic; |
---|
65 | } |
---|
66 | |
---|
67 | int getExp() |
---|
68 | { |
---|
69 | return InternalPrimePower::getk(); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | int getGFDegree() |
---|
74 | { |
---|
75 | //ASSERT( theDegree > 0, "not in GF(q)" ); |
---|
76 | return theDegree; |
---|
77 | } |
---|
78 | |
---|
79 | CanonicalForm getGFGenerator() |
---|
80 | { |
---|
81 | ASSERT( theDegree > 1, "not in GF(q)" ); |
---|
82 | return int2imm_gf( 1 ); |
---|
83 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.