source: git/factory/cf_char.cc @ 4d2aefb

fieker-DuValspielwiese
Last change on this file since 4d2aefb was cc1367, checked in by Jens Schmidt <schmidt@…>, 27 years ago
include <config.h> added git-svn-id: file:///usr/local/Singular/svn/trunk@132 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.0 KB
Line 
1// emacs edit mode for this file is -*- C++ -*-
2// $Id: cf_char.cc,v 1.5 1997-04-07 14:57:12 schmidt Exp $
3
4/*
5$Log: not supported by cvs2svn $
6Revision 1.4  1996/07/08 08:12:23  stobbe
7"setCharacteristic: Now resets the pascal triangle in the case that the
8                   characteristic changes
9"
10
11Revision 1.3  1996/06/24 11:25:45  stobbe
12"setCharacteristic: minor bug fix, index correction
13"
14
15Revision 1.2  1996/06/18 12:09:43  stobbe
16"setCharacteristic: changed the setting of ff_big.
17"
18
19Revision 1.1  1996/06/18 06:52:45  stobbe
20"setCharacteristic: now sets the flag ff_big
21"
22
23Revision 1.0  1996/05/17 10:59:43  stobbe
24Initial revision
25
26*/
27
28#include <config.h>
29
30#include "assert.h"
31
32#include "cf_defs.h"
33#include "canonicalform.h"
34#include "imm.h"
35#include "int_pp.h"
36#include "cf_primes.h"
37#include "cf_binom.h"
38
39static int theCharacteristic = 0;
40static int theDegree = 1;
41
42int initializeCharacteristic ()
43{
44    theCharacteristic = 0;
45    theDegree = 1;
46    return 1;
47}
48
49void setCharacteristic( int c )
50{
51    if ( c == 0 ) {
52        theDegree = 0;
53        CFFactory::settype( IntegerDomain );
54        theCharacteristic = 0;
55    }
56    else {
57        theDegree = 1;
58        CFFactory::settype( FiniteFieldDomain );
59        theCharacteristic = c;
60        ff_big = c > cf_getSmallPrime( cf_getNumSmallPrimes()-1 );
61        ff_setprime( c );
62        resetFPT();
63    }
64}
65
66void setCharacteristic( int c, int n )
67{
68    ASSERT( c > 1 && n > 0, "illegal characteristic" );
69    setCharacteristic( c );
70    InternalPrimePower::setPrimePower( c, n );
71    CFFactory::settype( PrimePowerDomain );
72}
73
74void setCharacteristic( int c, int n, char name )
75{
76    ASSERT( c != 0 && n > 1, "illegal GF(q)" );
77    setCharacteristic( c );
78    gf_setcharacteristic( c, n, name );
79    theDegree = n;
80    CFFactory::settype( GaloisFieldDomain );
81}
82
83int getCharacteristic()
84{
85    return theCharacteristic;
86}
87
88int getGFDegree()
89{
90    ASSERT( theDegree > 0, "not in GF(q)" );
91    return theDegree;
92}
93
94CanonicalForm getGFGenerator()
95{
96    ASSERT( theDegree > 1, "not in GF(q)" );
97    return int2imm_gf( 1 );
98}
Note: See TracBrowser for help on using the repository browser.