My Project  debian-1:4.1.1-p2+ds-4build2
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 852 of file ffields.cc.

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

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

565 {
566  int i=nfMinPoly[0];
567  int j=0;
568  loop
569  {
570  j++;
571  if (nfMinPoly[j]!=0)
572  StringAppend("%d*%s^%d",nfMinPoly[j],n_ParameterNames(r)[0],i);
573  i--;
574  if(i<0) break;
575  if (nfMinPoly[j]!=0)
576  StringAppendS("+");
577  }
578 }
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
nfSetMap
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
Definition: ffields.cc:739
FALSE
#define FALSE
Definition: auxiliary.h:94
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:107
nfCoeffString
static char * nfCoeffString(const coeffs r)
Definition: ffields.cc:806
j
int j
Definition: facHensel.cc:105
nfCoeffWrite
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Definition: ffields.cc:828
GFInfo
Creation data needed for finite fields.
Definition: coeffs.h:93
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:263
nfPower
static void nfPower(number a, int i, number *result, const coeffs r)
Definition: ffields.cc:473
n_GF
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:33
nfRandom
static number nfRandom(siRandProc p, number, number, const coeffs cf)
Definition: ffields.cc:823
loop
#define loop
Definition: structs.h:78
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:814
nfRead
static const char * nfRead(const char *s, number *a, const coeffs r)
Definition: ffields.cc:522
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:562
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:605
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:809
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:344
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
@ n_rep_gf
(int), see ffields.h
Definition: coeffs.h:120
WarnS
#define WarnS
Definition: emacs.cc:78
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
check
int check
Definition: libparse.cc:1104
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:77
StringAppend
#define StringAppend
Definition: emacs.cc:79
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:793
nfCoeffIsEqual
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
Definition: ffields.cc:842
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
nfWriteShort
static void nfWriteShort(number a, const coeffs r)
Definition: ffields.cc:440