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.
 

Function Documentation

◆ nfInitChar()

BOOLEAN nfInitChar ( coeffs r,
void * parameter )

Definition at line 855 of file ffields.cc.

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

◆ 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:782
#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