My Project  UNKNOWN_GIT_VERSION
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 839 of file ffields.cc.

840 {
841  r->is_field=TRUE;
842  r->is_domain=TRUE;
843  r->rep=n_rep_gf;
844  //r->cfInitChar=npInitChar;
845  r->cfKillChar=nfKillChar;
846  r->nCoeffIsEqual=nfCoeffIsEqual;
847  r->cfCoeffString=nfCoeffString;
848  r->cfCoeffName=nfCoeffName;
849 
850  r->cfMult = nfMult;
851  r->cfSub = nfSub;
852  r->cfAdd = nfAdd;
853  r->cfDiv = nfDiv;
854  //r->cfIntMod= ndIntMod;
855  r->cfExactDiv= nfDiv;
856  r->cfInit = nfInit;
857  //r->cfSize = ndSize;
858  r->cfInt = nfInt;
859  #ifdef HAVE_RINGS
860  //r->cfDivComp = NULL; // only for ring stuff
861  //r->cfIsUnit = NULL; // only for ring stuff
862  //r->cfGetUnit = NULL; // only for ring stuff
863  //r->cfExtGcd = NULL; // only for ring stuff
864  // r->cfDivBy = NULL; // only for ring stuff
865  #endif
866  r->cfInpNeg = nfNeg;
867  r->cfInvers= nfInvers;
868  //r->cfCopy = ndCopy;
869  //r->cfRePart = ndCopy;
870  //r->cfImPart = ndReturn0;
871 
872  r->cfWriteLong = nfWriteLong;
873  r->cfRead = nfRead;
874  //r->cfNormalize=ndNormalize;
875  r->cfGreater = nfGreater;
876  r->cfEqual = nfEqual;
877  r->cfIsZero = nfIsZero;
878  r->cfIsOne = nfIsOne;
879  r->cfIsMOne = nfIsMOne;
880  r->cfGreaterZero = nfGreaterZero;
881  r->cfPower = nfPower;
882  //r->cfGcd = ndGcd;
883  //r->cfLcm = ndGcd;
884  //r->cfDelete= ndDelete;
885  r->cfSetMap = nfSetMap;
886  //r->cfName = ndName;
887  // debug stuff
888  r->cfCoeffWrite=nfCoeffWrite;
889 
890  r->cfParDeg = nfParDeg;
891 
892  r->cfRandom = nfRandom;
893 
894 #ifdef LDEBUG
895  r->cfDBTest=nfDBTest;
896 #endif
897 
898  // the variables:
899  assume( getCoeffType(r) == n_GF );
900 
901  GFInfo* p = (GFInfo *)(parameter);
902  assume (p->GFChar > 0);
903  assume (p->GFDegree > 0);
904 
905  const char * name = p->GFPar_name;
906 
907  r->m_nfCharQ = 0;
908  r->m_nfCharP = p->GFChar;
909  r->m_nfCharQ1 = 0;
910 
911  r->iNumberOfParameters = 1;
912  r->cfParameter = nfParameter;
913 
914  char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
915  pParameterNames[0] = omStrDup(name); //TODO use omAlloc for allocating memory and use strcpy?
916 
917  assume( pParameterNames != NULL );
918  assume( pParameterNames[0] != NULL );
919 
920  r->pParameterNames = (const char**)pParameterNames;
921  // NOTE: r->m_nfParameter was replaced by n_ParameterNames(r)[0]
922 
923  // TODO: nfKillChar MUST destroy r->pParameterNames[0] (0-term. string) && r->pParameterNames (array of size 1)
924 
925  r->m_nfPlus1Table= NULL;
926 
927  if (strlen(name) > 1)
928  r->cfWriteShort = nfWriteLong;
929  else
930  r->cfWriteShort = nfWriteShort;
931 
932  r->has_simple_Alloc=TRUE;
933  r->has_simple_Inverse=TRUE;
934 
935  if(p->GFChar > (2<<15))
936  {
937 #ifndef SING_NDEBUG
938  WarnS("illegal characteristic");
939 #endif
940  return TRUE;
941  }
942 
943  const double check= log ((double) (p->GFChar));
944 
945  #define sixteenlog2 11.09035489
946  if( (p->GFDegree * check) > sixteenlog2 )
947  {
948 #ifndef SING_NDEBUG
949  Warn("Sorry: illegal size: %u ^ %u", p->GFChar, p->GFDegree );
950 #endif
951  return TRUE;
952  }
953 
954  int c = (int)pow ((double)p->GFChar, (double)p->GFDegree);
955 
956  nfReadTable(c, r);
957 
958  if( r->m_nfPlus1Table == NULL )
959  {
960  return TRUE;
961  }
962 
963 
964  assume (r -> m_nfCharQ > 0);
965 
966  r->ch = r->m_nfCharP;
967  assume( r->m_nfPlus1Table != NULL );
968 
969  return FALSE;
970 
971 }

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

552 {
553  int i=nfMinPoly[0];
554  int j=0;
555  loop
556  {
557  j++;
558  if (nfMinPoly[j]!=0)
559  StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
560  i--;
561  if(i<0) break;
562  if (nfMinPoly[j]!=0)
563  StringAppendS("+");
564  }
565 }
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:420
nfSetMap
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:726
FALSE
#define FALSE
Definition: auxiliary.h:94
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:106
nfCoeffString
static char * nfCoeffString(const coeffs r)
Definition: ffields.cc:793
j
int j
Definition: facHensel.cc:105
nfCoeffWrite
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:815
GFInfo
Creation data needed for finite fields.
Definition: coeffs.h:91
nfIsMOne
static BOOLEAN nfIsMOne(number a, const coeffs r)
Definition: ffields.cc:148
nfParDeg
static int nfParDeg(number n, const coeffs r)
Definition: ffields.cc:228
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:261
nfPower
static void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:473
n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:32
nfRandom
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:810
loop
#define loop
Definition: structs.h:77
nfInvers
static number nfInvers(number c, const coeffs r)
Definition: ffields.cc:363
nfWriteLong
static void nfWriteLong(number a, const coeffs r)
Definition: ffields.cc:406
nfIsZero
static BOOLEAN nfIsZero(number a, const coeffs r)
Definition: ffields.cc:137
nfDiv
static number nfDiv(number a, number b, const coeffs r)
Definition: ffields.cc:335
nfCoeffName
static char * nfCoeffName(const coeffs r)
Definition: ffields.cc:801
nfRead
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:509
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
nfEqual
static BOOLEAN nfEqual(number a, number b, const coeffs r)
Definition: ffields.cc:394
nfSub
static number nfSub(number a, number b, const coeffs r)
Definition: ffields.cc:315
nfGreater
static BOOLEAN nfGreater(number a, number b, const coeffs r)
Definition: ffields.cc:382
nfIsOne
static BOOLEAN nfIsOne(number a, const coeffs r)
Definition: ffields.cc:324
sixteenlog2
#define sixteenlog2
nfMinPoly
static int nfMinPoly[16]
Definition: ffields.cc:549
nfInit
static number nfInit(long i, const coeffs r)
Definition: ffields.cc:191
nfReadTable
static void nfReadTable(const int c, const coeffs r)
Definition: ffields.cc:592
n_ParameterNames
static FORCE_INLINE const char ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:799
nfAdd
static number nfAdd(number a, number b, const coeffs R)
Definition: ffields.cc:258
nfGreaterZero
static BOOLEAN nfGreaterZero(number k, const coeffs r)
Definition: ffields.cc:160
log
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:343
nfNeg
static number nfNeg(number c, const coeffs r)
Definition: ffields.cc:297
name
char name(const Variable &v)
Definition: factory.h:180
pow
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:414
nfDBTest
BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
Definition: ffields.cc:111
n_rep_gf
(int), see ffields.h
Definition: coeffs.h:118
WarnS
#define WarnS
Definition: emacs.cc:77
assume
#define assume(x)
Definition: mod2.h:384
NULL
#define NULL
Definition: omList.c:9
check
int check
Definition: libparse.cc:1103
nfInt
static long nfInt(number &n, const coeffs r)
Definition: ffields.cc:240
nfMult
static number nfMult(number a, number b, const coeffs r)
Definition: ffields.cc:171
Warn
#define Warn
Definition: emacs.cc:76
StringAppend
#define StringAppend
Definition: emacs.cc:78
p
int p
Definition: cfModGcd.cc:4019
nfParameter
static number nfParameter(int i, const coeffs)
Definition: ffields.cc:215
nfKillChar
static void nfKillChar(coeffs r)
Definition: ffields.cc:780
nfCoeffIsEqual
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:829
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
nfWriteShort
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:440