My Project
Functions
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. More...
 

Function Documentation

◆ nfInitChar()

BOOLEAN nfInitChar ( coeffs  r,
void *  parameter 
)

Definition at line 858 of file ffields.cc.

859{
860 // the variables:
861 assume( getCoeffType(r) == n_GF );
862
863 GFInfo* p = (GFInfo *)(parameter);
864 assume (p->GFChar > 0);
865 assume (p->GFDegree > 0);
866 if(p->GFChar > (2<<15))
867 {
868#ifndef SING_NDEBUG
869 WarnS("illegal characteristic");
870#endif
871 return TRUE;
872 }
873
874 const double check= log ((double) (p->GFChar));
875
876 #define sixteenlog2 11.09035489
877 if( (p->GFDegree * check) > sixteenlog2 )
878 {
879#ifndef SING_NDEBUG
880 Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
881#endif
882 return TRUE;
883 }
884
885 r->is_field=TRUE;
886 r->is_domain=TRUE;
887 r->rep=n_rep_gf;
888 //r->cfInitChar=npInitChar;
889 r->cfKillChar=nfKillChar;
890 r->nCoeffIsEqual=nfCoeffIsEqual;
891 r->cfCoeffName=nfCoeffName;
892
893 r->cfMult = nfMult;
894 r->cfSub = nfSub;
895 r->cfAdd = nfAdd;
896 r->cfDiv = nfDiv;
897 //r->cfIntMod= ndIntMod;
898 r->cfExactDiv= nfDiv;
899 r->cfInit = nfInit;
900 r->cfInitMPZ = nfInitMPZ;
901 //r->cfSize = ndSize;
902 r->cfInt = nfInt;
903 #ifdef HAVE_RINGS
904 //r->cfDivComp = NULL; // only for ring stuff
905 //r->cfIsUnit = NULL; // only for ring stuff
906 //r->cfGetUnit = NULL; // only for ring stuff
907 //r->cfExtGcd = NULL; // only for ring stuff
908 // r->cfDivBy = NULL; // only for ring stuff
909 #endif
910 r->cfInpNeg = nfNeg;
911 r->cfInvers= nfInvers;
912 //r->cfCopy = ndCopy;
913 //r->cfRePart = ndCopy;
914 //r->cfImPart = ndReturn0;
915
916 r->cfWriteLong = nfWriteLong;
917 r->cfRead = nfRead;
918 //r->cfNormalize=ndNormalize;
919 r->cfGreater = nfGreater;
920 r->cfEqual = nfEqual;
921 r->cfIsZero = nfIsZero;
922 r->cfIsOne = nfIsOne;
923 r->cfIsMOne = nfIsMOne;
924 r->cfGreaterZero = nfGreaterZero;
925 r->cfPower = nfPower;
926 //r->cfGcd = ndGcd;
927 //r->cfLcm = ndGcd;
928 //r->cfDelete= ndDelete;
929 r->cfSetMap = nfSetMap;
930 //r->cfName = ndName;
931 // debug stuff
932 r->cfCoeffWrite=nfCoeffWrite;
933
934 r->cfParDeg = nfParDeg;
935
936 r->cfRandom = nfRandom;
937
938#ifdef LDEBUG
939 r->cfDBTest=nfDBTest;
940#endif
941
942
943 const char * name = p->GFPar_name;
944
945 r->m_nfCharQ = 0;
946 r->m_nfCharP = p->GFChar;
947 r->m_nfCharQ1 = 0;
948
949 r->iNumberOfParameters = 1;
950 r->cfParameter = nfParameter;
951
952 char ** pParameterNames = (char **) omAlloc(sizeof(char *));
953 assume( pParameterNames != NULL );
954 pParameterNames[0] = omStrDup(name);
955 assume( pParameterNames[0] != NULL );
956
957 r->pParameterNames = (const char**)pParameterNames;
958
959 r->m_nfPlus1Table= NULL;
960
961 if (strlen(name) > 1)
962 r->cfWriteShort = nfWriteLong;
963 else
964 r->cfWriteShort = nfWriteShort;
965
966 r->has_simple_Alloc=TRUE;
967 r->has_simple_Inverse=TRUE;
968
969 int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
970
971 nfReadTable(c, r);
972
973 if( r->m_nfPlus1Table == NULL )
974 {
975 Werror("reading table for field with %d elements failed",c);
976 return TRUE;
977 }
978
979
980 assume (r -> m_nfCharQ > 0);
981
982 r->ch = r->m_nfCharP;
983 assume( r->m_nfPlus1Table != NULL );
984
985 return FALSE;
986}
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:411
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:32
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
@ n_rep_gf
(int), see ffields.h
Definition: coeffs.h:119
Creation data needed for finite fields.
Definition: coeffs.h:93
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
static BOOLEAN nfIsMOne(number a, const coeffs r)
Definition: ffields.cc:148
static number nfInitMPZ(mpz_t m, const coeffs cf)
Definition: ffields.cc:732
static number nfAdd(number a, number b, const coeffs R)
Definition: ffields.cc:258
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:753
static number nfInit(long i, const coeffs r)
Definition: ffields.cc:191
BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition: ffields.cc:111
static void nfKillChar(coeffs r)
Definition: ffields.cc:812
static int nfParDeg(number n, const coeffs r)
Definition: ffields.cc:228
static long nfInt(number &n, const coeffs r)
Definition: ffields.cc:240
#define sixteenlog2
static number nfMult(number a, number b, const coeffs r)
Definition: ffields.cc:171
static BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition: ffields.cc:160
static char * nfCoeffName(const coeffs r)
Definition: ffields.cc:820
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:440
static number nfSub(number a, number b, const coeffs r)
Definition: ffields.cc:315
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:829
static BOOLEAN nfIsOne(number a, const coeffs r)
Definition: ffields.cc:324
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:834
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:509
static BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:382
static number nfNeg(number c, const coeffs r)
Definition: ffields.cc:297
static BOOLEAN nfIsZero(number a, const coeffs r)
Definition: ffields.cc:137
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:848
static BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition: ffields.cc:394
static void nfReadTable(const int c, const coeffs r)
Definition: ffields.cc:592
static void nfWriteLong(number a, const coeffs r)
Definition: ffields.cc:406
static number nfDiv(number a, number b, const coeffs r)
Definition: ffields.cc:335
static number nfParameter(int i, const coeffs)
Definition: ffields.cc:215
static number nfInvers(number c, const coeffs r)
Definition: ffields.cc:363
static void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:473
VAR int check
Definition: libparse.cc:1106
#define assume(x)
Definition: mod2.h:387
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:343
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
void Werror(const char *fmt,...)
Definition: reporter.cc:189
char name(const Variable &v)
Definition: variable.h:95

◆ 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 551 of file ffields.cc.

552{
553 int i=nfMinPoly[0];
554 int j=0;
555 loop
556 {
557 j++;
558 if (nfMinPoly[j]!=0)
559 StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
560 i--;
561 if(i<0) break;
562 if (nfMinPoly[j]!=0)
563 StringAppendS("+");
564 }
565}
int i
Definition: cfEzgcd.cc:132
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:778
#define StringAppend
Definition: emacs.cc:79
int j
Definition: facHensel.cc:110
STATIC_VAR int nfMinPoly[16]
Definition: ffields.cc:549
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define loop
Definition: structs.h:75