source: git/factory/cf_char.cc @ 9f7665

fieker-DuValspielwiese
Last change on this file since 9f7665 was 9f7665, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Removed HAVE_CONFIG guards fix: fixed the inclusion of configure-generated *config.h's
  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[2dd068]2
[9f7665]3
[e4fe2b]4#include "config.h"
[9f7665]5
[cc1367]6
[650f2d8]7#include "cf_assert.h"
[cc1367]8
[2dd068]9#include "cf_defs.h"
10#include "canonicalform.h"
11#include "imm.h"
[e82860]12#include "cf_primes.h"
[a41f4b6]13#include "cf_util.h"
[2dd068]14
15static int theCharacteristic = 0;
16static int theDegree = 1;
17
18void setCharacteristic( int c )
19{
[d09118]20    if ( c == 0 )
21    {
22        theDegree = 0;
23        CFFactory::settype( IntegerDomain );
24        theCharacteristic = 0;
[2dd068]25    }
[d09118]26    else
27    {
28        theDegree = 1;
29        CFFactory::settype( FiniteFieldDomain );
30        theCharacteristic = c;
31        ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
[806c18]32        if (c > 536870909) factoryError("characteristic is too large(max is 2^29)");
[d09118]33        ff_setprime( c );
[2dd068]34    }
35}
36
37void 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
46int getCharacteristic()
47{
48    return theCharacteristic;
49}
50
51int getGFDegree()
52{
[050d1b]53    //ASSERT( theDegree > 0, "not in GF(q)" );
[2dd068]54    return theDegree;
55}
56
57CanonicalForm 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.