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

835 {
836  r->is_field=TRUE;
837  r->is_domain=TRUE;
838  r->rep=n_rep_gf;
839  //r->cfInitChar=npInitChar;
840  r->cfKillChar=nfKillChar;
841  r->nCoeffIsEqual=nfCoeffIsEqual;
842  r->cfCoeffString=nfCoeffString;
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  r->nNULL = (number)0;
894  assume( getCoeffType(r) == n_GF );
895 
896  GFInfo* p = (GFInfo *)(parameter);
897  assume (p->GFChar > 0);
898  assume (p->GFDegree > 0);
899 
900  const char * name = p->GFPar_name;
901 
902  r->m_nfCharQ = 0;
903  r->m_nfCharP = p->GFChar;
904  r->m_nfCharQ1 = 0;
905 
906  r->iNumberOfParameters = 1;
907  r->cfParameter = nfParameter;
908 
909  char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
910  pParameterNames[0] = omStrDup(name); //TODO use omAlloc for allocating memory and use strcpy?
911 
912  assume( pParameterNames != NULL );
913  assume( pParameterNames[0] != NULL );
914 
915  r->pParameterNames = (const char**)pParameterNames;
916  // NOTE: r->m_nfParameter was replaced by n_ParameterNames(r)[0]
917 
918  // TODO: nfKillChar MUST destroy r->pParameterNames[0] (0-term. string) && r->pParameterNames (array of size 1)
919 
920  r->m_nfPlus1Table= NULL;
921 
922  if (strlen(name) > 1)
923  r->cfWriteShort = nfWriteLong;
924  else
925  r->cfWriteShort = nfWriteShort;
926 
927  r->has_simple_Alloc=TRUE;
928  r->has_simple_Inverse=TRUE;
929 
930  if(p->GFChar > (2<<15))
931  {
932 #ifndef SING_NDEBUG
933  Warn("illegal characteristic");
934 #endif
935  return TRUE;
936  }
937 
938  const double check= log ((double) (p->GFChar));
939 
940  if( (p->GFDegree * check) > sixteenlog2 )
941  {
942 #ifndef SING_NDEBUG
943  Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
944 #endif
945  return TRUE;
946  }
947 
948  int c = pow (p->GFChar, p->GFDegree);
949 
950  nfReadTable(c, r);
951 
952  if( r->m_nfPlus1Table == NULL )
953  {
954  return TRUE;
955  }
956 
957 
958  assume (r -> m_nfCharQ > 0);
959 
960  r->ch = r->m_nfCharP;
961  assume( r->m_nfPlus1Table != NULL );
962 
963  return FALSE;
964 
965 }
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:982
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:829
int check
Definition: libparse.cc:1104
#define FALSE
Definition: auxiliary.h:95
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:96
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:99
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:808
BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:402
Creation data needed for finite fields.
Definition: coeffs.h:92
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:821
#define assume(x)
Definition: mod2.h:403
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:448
int GFDegree
Definition: coeffs.h:95
long nfInt(number &n, const coeffs r)
Definition: ffields.cc:247
char name(const Variable &v)
Definition: factory.h:178
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:425
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:94
const double sixteenlog2
Definition: ffields.cc:59
void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:967
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:754
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:119
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

§ 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 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:812
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