source: git/factory/cf_char.cc @ 38b236

spielwiese
Last change on this file since 38b236 was 493c477, checked in by Jens Schmidt <schmidt@…>, 27 years ago
o header fixed git-svn-id: file:///usr/local/Singular/svn/trunk@404 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_char.cc,v 1.6 1997-06-19 12:27:27 schmidt Exp $ */
3
4#include <config.h>
5
6#include "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
15static int theCharacteristic = 0;
16static int theDegree = 1;
17
18int initializeCharacteristic ()
19{
20    theCharacteristic = 0;
21    theDegree = 1;
22    return 1;
23}
24
25void setCharacteristic( int c )
26{
27    if ( c == 0 ) {
28        theDegree = 0;
29        CFFactory::settype( IntegerDomain );
30        theCharacteristic = 0;
31    }
32    else {
33        theDegree = 1;
34        CFFactory::settype( FiniteFieldDomain );
35        theCharacteristic = c;
36        ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
37        ff_setprime( c );
38        resetFPT();
39    }
40}
41
42void setCharacteristic( int c, int n )
43{
44    ASSERT( c > 1 && n > 0, "illegal characteristic" );
45    setCharacteristic( c );
46    InternalPrimePower::setPrimePower( c, n );
47    CFFactory::settype( PrimePowerDomain );
48}
49
50void setCharacteristic( int c, int n, char name )
51{
52    ASSERT( c != 0 && n > 1, "illegal GF(q)" );
53    setCharacteristic( c );
54    gf_setcharacteristic( c, n, name );
55    theDegree = n;
56    CFFactory::settype( GaloisFieldDomain );
57}
58
59int getCharacteristic()
60{
61    return theCharacteristic;
62}
63
64int getGFDegree()
65{
66    ASSERT( theDegree > 0, "not in GF(q)" );
67    return theDegree;
68}
69
70CanonicalForm getGFGenerator()
71{
72    ASSERT( theDegree > 1, "not in GF(q)" );
73    return int2imm_gf( 1 );
74}
Note: See TracBrowser for help on using the repository browser.