My Project
Loading...
Searching...
No Matches
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 854 of file ffields.cc.

855{
856 // the variables:
857 assume( getCoeffType(r) == n_GF );
858
859 GFInfo* p = (GFInfo *)(parameter);
860 assume (p->GFChar > 0);
861 assume (p->GFDegree > 0);
862 if(p->GFChar > (2<<15))
863 {
864#ifndef SING_NDEBUG
865 WarnS("illegal characteristic");
866#endif
867 return TRUE;
868 }
869
870 const double check= log ((double) (p->GFChar));
871
872 #define sixteenlog2 11.09035489
873 if( (p->GFDegree * check) > sixteenlog2 )
874 {
875#ifndef SING_NDEBUG
876 Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
877#endif
878 return TRUE;
879 }
880
881 r->is_field=TRUE;
882 r->is_domain=TRUE;
883 r->rep=n_rep_gf;
884 //r->cfInitChar=npInitChar;
885 r->cfKillChar=nfKillChar;
886 r->nCoeffIsEqual=nfCoeffIsEqual;
887 r->cfCoeffName=nfCoeffName;
888
889 r->cfMult = nfMult;
890 r->cfSub = nfSub;
891 r->cfAdd = nfAdd;
892 r->cfDiv = nfDiv;
893 //r->cfIntMod= ndIntMod;
894 r->cfExactDiv= nfDiv;
895 r->cfInit = nfInit;
896 r->cfInitMPZ = nfInitMPZ;
897 //r->cfSize = ndSize;
898 r->cfInt = nfInt;
899 #ifdef HAVE_RINGS
900 //r->cfDivComp = NULL; // only for ring stuff
901 //r->cfIsUnit = NULL; // only for ring stuff
902 //r->cfGetUnit = NULL; // only for ring stuff
903 //r->cfExtGcd = NULL; // only for ring stuff
904 // r->cfDivBy = NULL; // only for ring stuff
905 #endif
906 r->cfInpNeg = nfNeg;
907 r->cfInvers= nfInvers;
908 //r->cfCopy = ndCopy;
909 //r->cfRePart = ndCopy;
910 //r->cfImPart = ndReturn0;
911
912 r->cfWriteLong = nfWriteLong;
913 r->cfRead = nfRead;
914 //r->cfNormalize=ndNormalize;
915 r->cfGreater = nfGreater;
916 r->cfEqual = nfEqual;
917 r->cfIsZero = nfIsZero;
918 r->cfIsOne = nfIsOne;
919 r->cfIsMOne = nfIsMOne;
920 r->cfGreaterZero = nfGreaterZero;
921 r->cfPower = nfPower;
922 //r->cfGcd = ndGcd;
923 //r->cfLcm = ndGcd;
924 //r->cfDelete= ndDelete;
925 r->cfSetMap = nfSetMap;
926 //r->cfName = ndName;
927 // debug stuff
928 r->cfCoeffWrite=nfCoeffWrite;
929
930 r->cfParDeg = nfParDeg;
931
932 r->cfRandom = nfRandom;
933
934#ifdef LDEBUG
935 r->cfDBTest=nfDBTest;
936#endif
937
938
939 const char * name = p->GFPar_name;
940
941 r->m_nfCharQ = 0;
942 r->m_nfCharP = p->GFChar;
943 r->m_nfCharQ1 = 0;
944
945 r->iNumberOfParameters = 1;
946 r->cfParameter = nfParameter;
947
948 char ** pParameterNames = (char **) omAlloc(sizeof(char *));
949 assume( pParameterNames != NULL );
950 pParameterNames[0] = omStrDup(name);
951 assume( pParameterNames[0] != NULL );
952
953 r->pParameterNames = (const char**)pParameterNames;
954
955 r->m_nfPlus1Table= NULL;
956
957 if (strlen(name) > 1)
958 r->cfWriteShort = nfWriteLong;
959 else
960 r->cfWriteShort = nfWriteShort;
961
962 r->has_simple_Alloc=TRUE;
963 r->has_simple_Inverse=TRUE;
964
965 int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
966
967 nfReadTable(c, r);
968
969 if( r->m_nfPlus1Table == NULL )
970 {
971 Werror("reading table for field with %d elements failed",c);
972 return TRUE;
973 }
974
975
976 assume (r -> m_nfCharQ > 0);
977
978 r->ch = r->m_nfCharP;
979 assume( r->m_nfPlus1Table != NULL );
980
981 return FALSE;
982}
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:422
@ 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:144
static number nfInitMPZ(mpz_t m, const coeffs cf)
Definition: ffields.cc:728
static number nfAdd(number a, number b, const coeffs R)
Definition: ffields.cc:254
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:749
static BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition: ffields.cc:107
static number nfInit(long i, const coeffs r)
Definition: ffields.cc:187
static void nfKillChar(coeffs r)
Definition: ffields.cc:808
static int nfParDeg(number n, const coeffs r)
Definition: ffields.cc:224
static long nfInt(number &n, const coeffs r)
Definition: ffields.cc:236
#define sixteenlog2
static number nfMult(number a, number b, const coeffs r)
Definition: ffields.cc:167
static BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition: ffields.cc:156
static char * nfCoeffName(const coeffs r)
Definition: ffields.cc:816
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:436
static number nfSub(number a, number b, const coeffs r)
Definition: ffields.cc:311
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:825
static BOOLEAN nfIsOne(number a, const coeffs r)
Definition: ffields.cc:320
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:830
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:505
static BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:378
static number nfNeg(number c, const coeffs r)
Definition: ffields.cc:293
static BOOLEAN nfIsZero(number a, const coeffs r)
Definition: ffields.cc:133
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:844
static BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition: ffields.cc:390
static void nfReadTable(const int c, const coeffs r)
Definition: ffields.cc:588
static void nfWriteLong(number a, const coeffs r)
Definition: ffields.cc:402
static number nfDiv(number a, number b, const coeffs r)
Definition: ffields.cc:331
static number nfParameter(int i, const coeffs)
Definition: ffields.cc:211
static number nfInvers(number c, const coeffs r)
Definition: ffields.cc:359
static void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:469
VAR int check
Definition: libparse.cc:1106
#define assume(x)
Definition: mod2.h:389
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
int name
New type name for int.
Definition: templateForC.h:21

◆ 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.

548{
549 int i=nfMinPoly[0];
550 int j=0;
551 loop
552 {
553 j++;
554 if (nfMinPoly[j]!=0)
555 StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
556 i--;
557 if(i<0) break;
558 if (nfMinPoly[j]!=0)
559 StringAppendS("+");
560 }
561}
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:775
#define StringAppend
Definition: emacs.cc:79
int j
Definition: facHensel.cc:110
STATIC_VAR int nfMinPoly[16]
Definition: ffields.cc:545
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define loop
Definition: structs.h:75