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