source: git/factory/cf_char.cc @ 88e0d34

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