source: git/factory/cf_char.cc @ 2dd068

spielwiese
Last change on this file since 2dd068 was 2dd068, checked in by Rüdiger Stobbe <stobbe@…>, 28 years ago
Initial revision git-svn-id: file:///usr/local/Singular/svn/trunk@6 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.3 KB
Line 
1// emacs edit mode for this file is -*- C++ -*-
2// $Id: cf_char.cc,v 1.0 1996-05-17 10:59:43 stobbe Exp $
3
4/*
5$Log: not supported by cvs2svn $
6*/
7
8#include "assert.h"
9#include "cf_defs.h"
10#include "canonicalform.h"
11#include "imm.h"
12#include "int_pp.h"
13
14static int theCharacteristic = 0;
15static int theDegree = 1;
16
17int initializeCharacteristic ()
18{
19    theCharacteristic = 0;
20    theDegree = 1;
21    return 1;
22}
23
24void setCharacteristic( int c )
25{
26    if ( c == 0 ) {
27        theDegree = 0;
28        CFFactory::settype( IntegerDomain );
29        theCharacteristic = 0;
30    }
31    else {
32        theDegree = 1;
33        CFFactory::settype( FiniteFieldDomain );
34        theCharacteristic = c;
35        ff_setprime( c );
36    }
37}
38
39void setCharacteristic( int c, int n )
40{
41    ASSERT( c > 1 && n > 0, "illegal characteristic" );
42    setCharacteristic( c );
43    InternalPrimePower::setPrimePower( c, n );
44    CFFactory::settype( PrimePowerDomain );
45}
46
47void setCharacteristic( int c, int n, char name )
48{
49    ASSERT( c != 0 && n > 1, "illegal GF(q)" );
50    setCharacteristic( c );
51    gf_setcharacteristic( c, n, name );
52    theDegree = n;
53    CFFactory::settype( GaloisFieldDomain );
54}
55
56int getCharacteristic()
57{
58    return theCharacteristic;
59}
60
61int getGFDegree()
62{
63    ASSERT( theDegree > 0, "not in GF(q)" );
64    return theDegree;
65}
66
67CanonicalForm getGFGenerator()
68{
69    ASSERT( theDegree > 1, "not in GF(q)" );
70    return int2imm_gf( 1 );
71}
Note: See TracBrowser for help on using the repository browser.