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 *   
)

Definition at line 833 of file ffields.cc.

834 {
835  r->is_field=TRUE;
836  r->is_domain=TRUE;
837  r->rep=n_rep_gf;
838  //r->cfInitChar=npInitChar;
839  r->cfKillChar=nfKillChar;
840  r->nCoeffIsEqual=nfCoeffIsEqual;
841  r->cfCoeffString=nfCoeffString;
842  r->cfCoeffName=nfCoeffName;
843 
844  r->cfMult = nfMult;
845  r->cfSub = nfSub;
846  r->cfAdd = nfAdd;
847  r->cfDiv = nfDiv;
848  //r->cfIntMod= ndIntMod;
849  r->cfExactDiv= nfDiv;
850  r->cfInit = nfInit;
851  //r->cfSize = ndSize;
852  r->cfInt = nfInt;
853  #ifdef HAVE_RINGS
854  //r->cfDivComp = NULL; // only for ring stuff
855  //r->cfIsUnit = NULL; // only for ring stuff
856  //r->cfGetUnit = NULL; // only for ring stuff
857  //r->cfExtGcd = NULL; // only for ring stuff
858  // r->cfDivBy = NULL; // only for ring stuff
859  #endif
860  r->cfInpNeg = nfNeg;
861  r->cfInvers= nfInvers;
862  //r->cfCopy = ndCopy;
863  //r->cfRePart = ndCopy;
864  //r->cfImPart = ndReturn0;
865 
866  r->cfWriteLong = nfWriteLong;
867  r->cfRead = nfRead;
868  //r->cfNormalize=ndNormalize;
869  r->cfGreater = nfGreater;
870  r->cfEqual = nfEqual;
871  r->cfIsZero = nfIsZero;
872  r->cfIsOne = nfIsOne;
873  r->cfIsMOne = nfIsMOne;
874  r->cfGreaterZero = nfGreaterZero;
875  r->cfPower = nfPower;
876  //r->cfGcd = ndGcd;
877  //r->cfLcm = ndGcd;
878  //r->cfDelete= ndDelete;
879  r->cfSetMap = nfSetMap;
880  //r->cfName = ndName;
881  // debug stuff
882  r->cfCoeffWrite=nfCoeffWrite;
883 
884  r->cfParDeg = nfParDeg;
885 
886  r->cfRandom = nfRandom;
887 
888 #ifdef LDEBUG
889  r->cfDBTest=nfDBTest;
890 #endif
891 
892  // the variables:
893  assume( getCoeffType(r) == n_GF );
894 
895  GFInfo* p = (GFInfo *)(parameter);
896  assume (p->GFChar > 0);
897  assume (p->GFDegree > 0);
898 
899  const char * name = p->GFPar_name;
900 
901  r->m_nfCharQ = 0;
902  r->m_nfCharP = p->GFChar;
903  r->m_nfCharQ1 = 0;
904 
905  r->iNumberOfParameters = 1;
906  r->cfParameter = nfParameter;
907 
908  char ** pParameterNames = (char **) omAlloc(sizeof(char *));
909  assume( pParameterNames != NULL );
910  pParameterNames[0] = omStrDup(name);
911  assume( pParameterNames[0] != NULL );
912 
913  r->pParameterNames = (const char**)pParameterNames;
914 
915  r->m_nfPlus1Table= NULL;
916 
917  if (strlen(name) > 1)
918  r->cfWriteShort = nfWriteLong;
919  else
920  r->cfWriteShort = nfWriteShort;
921 
922  r->has_simple_Alloc=TRUE;
923  r->has_simple_Inverse=TRUE;
924 
925  if(p->GFChar > (2<<15))
926  {
927 #ifndef SING_NDEBUG
928  WarnS("illegal characteristic");
929 #endif
930  return TRUE;
931  }
932 
933  const double check= log ((double) (p->GFChar));
934 
935  #define sixteenlog2 11.09035489
936  if( (p->GFDegree * check) > sixteenlog2 )
937  {
938 #ifndef SING_NDEBUG
939  Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
940 #endif
941  return TRUE;
942  }
943 
944  int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
945 
946  nfReadTable(c, r);
947 
948  if( r->m_nfPlus1Table == NULL )
949  {
950  return TRUE;
951  }
952 
953 
954  assume (r -> m_nfCharQ > 0);
955 
956  r->ch = r->m_nfCharP;
957  assume( r->m_nfPlus1Table != NULL );
958 
959  return FALSE;
960 }
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:823
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:804
int check
Definition: libparse.cc:1104
#define FALSE
Definition: auxiliary.h:94
static number nfDiv(number a, number b, const coeffs r)
Definition: ffields.cc:334
static BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition: ffields.cc:159
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:508
const char * GFPar_name
Definition: coeffs.h:96
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:343
#define TRUE
Definition: auxiliary.h:98
BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition: ffields.cc:110
static number nfSub(number a, number b, const coeffs r)
Definition: ffields.cc:314
static BOOLEAN nfIsOne(number a, const coeffs r)
Definition: ffields.cc:323
static number nfParameter(int i, const coeffs)
Definition: ffields.cc:214
static number nfNeg(number c, const coeffs r)
Definition: ffields.cc:296
#define WarnS
Definition: emacs.cc:78
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void nfKillChar(coeffs r)
Definition: ffields.cc:779
Creation data needed for finite fields.
Definition: coeffs.h:92
static void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:472
static char * nfCoeffString(const coeffs r)
Definition: ffields.cc:787
#define assume(x)
Definition: mod2.h:390
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:439
static BOOLEAN nfIsZero(number a, const coeffs r)
Definition: ffields.cc:136
static number nfAdd(number a, number b, const coeffs R)
Definition: ffields.cc:257
int GFDegree
Definition: coeffs.h:95
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:725
char name(const Variable &v)
Definition: factory.h:180
static number nfMult(number a, number b, const coeffs r)
Definition: ffields.cc:170
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static int nfParDeg(number n, const coeffs r)
Definition: ffields.cc:227
int GFChar
Definition: coeffs.h:94
#define NULL
Definition: omList.c:12
static number nfInvers(number c, const coeffs r)
Definition: ffields.cc:362
{p^n < 2^16}
Definition: coeffs.h:33
static void nfWriteLong(number a, const coeffs r)
Definition: ffields.cc:405
static number nfInit(long i, const coeffs r)
Definition: ffields.cc:190
static char * nfCoeffName(const coeffs r)
Definition: ffields.cc:795
static void nfReadTable(const int c, const coeffs r)
Definition: ffields.cc:591
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:809
int p
Definition: cfModGcd.cc:4019
(int), see ffields.h
Definition: coeffs.h:119
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:411
static BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition: ffields.cc:393
static BOOLEAN nfIsMOne(number a, const coeffs r)
Definition: ffields.cc:147
static long nfInt(number &n, const coeffs r)
Definition: ffields.cc:239
static BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:381
#define sixteenlog2
#define Warn
Definition: emacs.cc:77
#define omStrDup(s)
Definition: omAllocDecl.h:263

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

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