Loading...
Searching...
No Matches
ffields.h File Reference
`#include "misc/auxiliary.h"`

Go to the source code of this file.

## Functions

BOOLEAN | nfInitChar (coeffs r, void *)
void | nfShowMipo (const coeffs r)
| Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d, BOOLEAN typed, int dim) (from Singular/subexpr.cc) for printing minpoly.

## Function Documentation

## nfInitChar()

BOOLEAN nfInitChar | ( | coeffs | r,
|  | void * | parameter )

Definition at line 855 of file ffields.cc.

{
// the variables:
assume( getCoeffType(r) == n_GF );
GFInfo* p = (GFInfo *)(parameter);
assume (p->GFChar > 0);
assume (p->GFDegree > 0);
if(p->GFChar > (2<<15))
{
#ifndef SING_NDEBUG
WarnS("illegal characteristic");
#endif
return TRUE;
}
const double check= log ((double) (p->GFChar));
#define sixteenlog2 11.09035489
if( (p->GFDegree * check) > sixteenlog2 )
{
#ifndef SING_NDEBUG
Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
#endif
return TRUE;
}
r->is_field=TRUE;
r->is_domain=TRUE;
r->rep=n_rep_gf;
//r->cfInitChar=npInitChar;
r->cfKillChar=nfKillChar;
r->nCoeffIsEqual=nfCoeffIsEqual;
r->cfCoeffName=nfCoeffName;
r->cfMult = nfMult;
r->cfSub = nfSub;
r->cfAdd = nfAdd;
r->cfDiv = nfDiv;
//r->cfIntMod= ndIntMod;
r->cfExactDiv= nfDiv;
r->cfInit = nfInit;
r->cfInitMPZ = nfInitMPZ;
//r->cfSize = ndSize;
r->cfInt = nfInt;
//r->cfDivComp = NULL; // only for ring stuff
//r->cfIsUnit = NULL; // only for ring stuff
//r->cfGetUnit = NULL; // only for ring stuff
//r->cfExtGcd = NULL; // only for ring stuff
// r->cfDivBy = NULL; // only for ring stuff
r->cfInpNeg = nfNeg;
r->cfInvers= nfInvers;
//r->cfCopy = ndCopy;
//r->cfRePart = ndCopy;
//r->cfImPart = ndReturn0;
r->cfWriteLong = nfWriteLong;
r->cfRead = nfRead;
//r->cfNormalize=ndNormalize;
r->cfGreater = nfGreater;
r->cfEqual = nfEqual;
r->cfIsZero = nfIsZero;
r->cfIsOne = nfIsOne;
r->cfIsMOne = nfIsMOne;
r->cfGreaterZero = nfGreaterZero;
r->cfPower = nfPower;
//r->cfGcd = ndGcd;
//r->cfLcm = ndGcd;
//r->cfDelete= ndDelete;
r->cfSetMap = nfSetMap;
//r->cfName = ndName;
// debug stuff
r->cfCoeffWrite=nfCoeffWrite;
r->cfParDeg = nfParDeg;
r->cfRandom = nfRandom;
#ifdef LDEBUG
r->cfDBTest=nfDBTest;
#endif
const char * name = p->GFPar_name;
r->m_nfCharQ = 0;
r->m_nfCharP = p->GFChar;
r->m_nfCharQ1 = 0;
r->iNumberOfParameters = 1;
r->cfParameter = nfParameter;
char ** pParameterNames = (char **) omAlloc(sizeof(char *));
assume( pParameterNames != NULL );
pParameterNames[0] = omStrDup(name);
assume( pParameterNames[0] != NULL );
r->pParameterNames = (const char**)pParameterNames;
r->m_nfPlus1Table= NULL;
if (strlen(name) > 1)
r->cfWriteShort = nfWriteLong;
else
r->cfWriteShort = nfWriteShort;
r->has_simple_Alloc=TRUE;
r->has_simple_Inverse=TRUE;
int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
nfReadTable(c, r);
if( r->m_nfPlus1Table == NULL )
{
Werror("reading table for field with %d elements failed",c);
return TRUE;
}
assume (r -> m_nfCharQ > 0);
r->ch = r->m_nfCharP;
assume( r->m_nfPlus1Table != NULL );
return FALSE;
}
pow
Rational pow(const Rational &a, int e)
Definition GMPrat.cc:411
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
p
int p
Definition cfModGcd.cc:4086
n_GF
@ n_GF
\GF{p^n < 2^16}
Definition coeffs.h:32
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_rep_gf
@ n_rep_gf
(int), see ffields.h
Definition coeffs.h:126
GFInfo
Creation data needed for finite fields.
Definition coeffs.h:100
Warn
#define Warn
Definition emacs.cc:77
WarnS
#define WarnS
Definition emacs.cc:78
name
char name(const Variable &v)
Definition factory.h:189
nfIsMOne
static BOOLEAN nfIsMOne(number a, const coeffs r)
Definition ffields.cc:144
nfInitMPZ
static number nfInitMPZ(mpz_t m, const coeffs cf)
Definition ffields.cc:728
nfAdd
static number nfAdd(number a, number b, const coeffs R)
Definition ffields.cc:254
nfSetMap
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition ffields.cc:749
nfDBTest
static BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition ffields.cc:107
nfInit
static number nfInit(long i, const coeffs r)
Definition ffields.cc:187
nfKillChar
static void nfKillChar(coeffs r)
Definition ffields.cc:809
nfParDeg
static int nfParDeg(number n, const coeffs r)
Definition ffields.cc:224
nfInt
static long nfInt(number &n, const coeffs r)
Definition ffields.cc:236
sixteenlog2
#define sixteenlog2
nfMult
static number nfMult(number a, number b, const coeffs r)
Definition ffields.cc:167
nfGreaterZero
static BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition ffields.cc:156
nfCoeffName
static char * nfCoeffName(const coeffs r)
Definition ffields.cc:817
nfWriteShort
static void nfWriteShort(number a, const coeffs r)
Definition ffields.cc:436
nfSub
static number nfSub(number a, number b, const coeffs r)
Definition ffields.cc:311
nfRandom
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition ffields.cc:826
nfIsOne
static BOOLEAN nfIsOne(number a, const coeffs r)
Definition ffields.cc:320
nfCoeffWrite
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition ffields.cc:831
nfRead
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition ffields.cc:505
nfGreater
static BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition ffields.cc:378
nfNeg
static number nfNeg(number c, const coeffs r)
Definition ffields.cc:293
nfIsZero
static BOOLEAN nfIsZero(number a, const coeffs r)
Definition ffields.cc:133
nfCoeffIsEqual
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition ffields.cc:845
nfEqual
static BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition ffields.cc:390
nfReadTable
static void nfReadTable(const int c, const coeffs r)
Definition ffields.cc:588
nfWriteLong
static void nfWriteLong(number a, const coeffs r)
Definition ffields.cc:402
nfDiv
static number nfDiv(number a, number b, const coeffs r)
Definition ffields.cc:331
nfParameter
static number nfParameter(int i, const coeffs)
Definition ffields.cc:211
nfInvers
static number nfInvers(number c, const coeffs r)
Definition ffields.cc:359
nfPower
static void nfPower(number a, int i, number *result, const coeffs r)
Definition ffields.cc:469
check
VAR int check
Definition libparse.cc:1106
assume
#define assume(x)
Definition mod2.h:389
log
gmp_float log(const gmp_float &a)
Definition mpr_complex.cc:335
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
NULL
#define NULL
Definition omList.c:12
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189

## nfShowMipo()

void nfShowMipo | ( | const coeffs | r | ) |

Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d, BOOLEAN typed, int dim) (from Singular/subexpr.cc) for printing minpoly.

Definition at line 547 of file ffields.cc.

{
int i=nfMinPoly[0];
int j=0;
loop
{
j++;
if (nfMinPoly[j]!=0)
StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
i--;
if(i<0) break;
if (nfMinPoly[j]!=0)
StringAppendS("+");
}
}
i
int i
Definition cfEzgcd.cc:132
n_ParameterNames
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:773
StringAppend
#define StringAppend
Definition emacs.cc:79
j
int j
Definition facHensel.cc:110
nfMinPoly
STATIC_VAR int nfMinPoly[16]
Definition ffields.cc:545
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107
loop
#define loop
Definition structs.h:71