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

BOOLEAN nfInitChar ( coeffs  r,
void *   
)

Definition at line 836 of file ffields.cc.

837 {
838  r->is_field=TRUE;
839  r->is_domain=TRUE;
840  r->rep=n_rep_gf;
841  //r->cfInitChar=npInitChar;
842  r->cfKillChar=nfKillChar;
843  r->nCoeffIsEqual=nfCoeffIsEqual;
844  r->cfCoeffString=nfCoeffString;
845 
846  r->cfMult = nfMult;
847  r->cfSub = nfSub;
848  r->cfAdd = nfAdd;
849  r->cfDiv = nfDiv;
850  //r->cfIntMod= ndIntMod;
851  r->cfExactDiv= nfDiv;
852  r->cfInit = nfInit;
853  //r->cfSize = ndSize;
854  r->cfInt = nfInt;
855  #ifdef HAVE_RINGS
856  //r->cfDivComp = NULL; // only for ring stuff
857  //r->cfIsUnit = NULL; // only for ring stuff
858  //r->cfGetUnit = NULL; // only for ring stuff
859  //r->cfExtGcd = NULL; // only for ring stuff
860  // r->cfDivBy = NULL; // only for ring stuff
861  #endif
862  r->cfInpNeg = nfNeg;
863  r->cfInvers= nfInvers;
864  //r->cfCopy = ndCopy;
865  //r->cfRePart = ndCopy;
866  //r->cfImPart = ndReturn0;
867 
868  r->cfWriteLong = nfWriteLong;
869  r->cfRead = nfRead;
870  //r->cfNormalize=ndNormalize;
871  r->cfGreater = nfGreater;
872  r->cfEqual = nfEqual;
873  r->cfIsZero = nfIsZero;
874  r->cfIsOne = nfIsOne;
875  r->cfIsMOne = nfIsMOne;
876  r->cfGreaterZero = nfGreaterZero;
877  r->cfPower = nfPower;
878  //r->cfGcd = ndGcd;
879  //r->cfLcm = ndGcd;
880  //r->cfDelete= ndDelete;
881  r->cfSetMap = nfSetMap;
882  //r->cfName = ndName;
883  // debug stuff
884  r->cfCoeffWrite=nfCoeffWrite;
885 
886  r->cfParDeg = nfParDeg;
887 
888  r->cfRandom = nfRandom;
889 
890 #ifdef LDEBUG
891  r->cfDBTest=nfDBTest;
892 #endif
893 
894  // the variables:
895  r->nNULL = (number)0;
896  assume( getCoeffType(r) == n_GF );
897 
898  GFInfo* p = (GFInfo *)(parameter);
899  assume (p->GFChar > 0);
900  assume (p->GFDegree > 0);
901 
902  const char * name = p->GFPar_name;
903 
904  r->m_nfCharQ = 0;
905  r->m_nfCharP = p->GFChar;
906  r->m_nfCharQ1 = 0;
907 
908  r->iNumberOfParameters = 1;
909  r->cfParameter = nfParameter;
910 
911  char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
912  pParameterNames[0] = omStrDup(name); //TODO use omAlloc for allocating memory and use strcpy?
913 
914  assume( pParameterNames != NULL );
915  assume( pParameterNames[0] != NULL );
916 
917  r->pParameterNames = (const char**)pParameterNames;
918  // NOTE: r->m_nfParameter was replaced by n_ParameterNames(r)[0]
919 
920  // TODO: nfKillChar MUST destroy r->pParameterNames[0] (0-term. string) && r->pParameterNames (array of size 1)
921 
922  r->m_nfPlus1Table= NULL;
923 
924  if (strlen(name) > 1)
925  r->cfWriteShort = nfWriteLong;
926  else
927  r->cfWriteShort = nfWriteShort;
928 
929  r->has_simple_Alloc=TRUE;
930  r->has_simple_Inverse=TRUE;
931 
932  if(p->GFChar > (2<<15))
933  {
934 #ifndef SING_NDEBUG
935  Warn("illegal characteristic");
936 #endif
937  return TRUE;
938  }
939 
940  const double check= log ((double) (p->GFChar));
941 
942  if( (p->GFDegree * check) > sixteenlog2 )
943  {
944 #ifndef SING_NDEBUG
945  Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
946 #endif
947  return TRUE;
948  }
949 
950  int c = pow (p->GFChar, p->GFDegree);
951 
952  nfReadTable(c, r);
953 
954  if( r->m_nfPlus1Table == NULL )
955  {
956 #ifndef SING_NDEBUG
957  Warn("Sorry: cannot init lookup table!");
958 #endif
959  return TRUE;
960  }
961 
962 
963  assume (r -> m_nfCharQ > 0);
964 
965  r->ch = r->m_nfCharP;
966  assume( r->m_nfPlus1Table != NULL );
967 
968  return FALSE;
969 
970 }
BOOLEAN nfIsZero(number a, const coeffs r)
Definition: ffields.cc:303
void nfReadTable(const int c, const coeffs r)
Definition: ffields.cc:623
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:987
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:831
int check
Definition: libparse.cc:1104
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
number nfInit(long i, const coeffs r)
Definition: ffields.cc:198
const char * GFPar_name
Definition: coeffs.h:95
number nfNeg(number c, const coeffs r)
Definition: ffields.cc:384
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:345
#define TRUE
Definition: auxiliary.h:144
BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition: ffields.cc:141
number nfParameter(int i, const coeffs r)
Definition: ffields.cc:222
BOOLEAN nfIsMOne(number a, const coeffs r)
Definition: ffields.cc:325
static void nfKillChar(coeffs r)
Definition: ffields.cc:810
BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:402
Creation data needed for finite fields.
Definition: coeffs.h:91
number nfDiv(number a, number b, const coeffs r)
Definition: ffields.cc:337
number nfAdd(number a, number b, const coeffs r)
Definition: ffields.cc:255
BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition: ffields.cc:167
static char * nfCoeffString(const coeffs r)
Definition: ffields.cc:823
#define assume(x)
Definition: mod2.h:405
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:448
int GFDegree
Definition: coeffs.h:94
long nfInt(number &n, const coeffs r)
Definition: ffields.cc:247
number nfSub(number a, number b, const coeffs r)
Definition: ffields.cc:294
void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:491
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
number nfInvers(number c, const coeffs r)
Definition: ffields.cc:365
static int nfParDeg(number n, const coeffs r)
Definition: ffields.cc:235
int GFChar
Definition: coeffs.h:93
const double sixteenlog2
Definition: ffields.cc:59
char name(const Variable &v)
Definition: variable.h:95
void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:972
number nfMult(number a, number b, const coeffs r)
Definition: ffields.cc:178
#define NULL
Definition: omList.c:10
nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:756
BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition: ffields.cc:414
{p^n < 2^16}
Definition: coeffs.h:33
static void nfWriteLong(number a, const coeffs r)
Definition: ffields.cc:426
(int), see ffields.h
Definition: coeffs.h:118
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:418
const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:540
BOOLEAN nfIsOne(number a, const coeffs r)
Definition: ffields.cc:314
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
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 582 of file ffields.cc.

583 {
584  int i=nfMinPoly[0];
585  int j=0;
586  loop
587  {
588  j++;
589  if (nfMinPoly[j]!=0)
590  StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
591  i--;
592  if(i<0) break;
593  if (nfMinPoly[j]!=0)
594  StringAppendS("+");
595  }
596 }
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:801
loop
Definition: myNF.cc:98
int j
Definition: myNF.cc:70
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
int nfMinPoly[16]
Definition: ffields.cc:580