 |
My Project
debian-1:4.1.1-p2+ds-4build3
|
Go to the source code of this file.
|
BOOLEAN | nfDBTest (number a, const char *f, const int l, const coeffs r) |
|
static BOOLEAN | nfIsZero (number a, const coeffs r) |
|
static BOOLEAN | nfIsMOne (number a, const coeffs r) |
|
static BOOLEAN | nfGreaterZero (number k, const coeffs r) |
|
static number | nfMult (number a, number b, const coeffs r) |
|
static number | nfInit (long i, const coeffs r) |
|
static number | nfParameter (int i, const coeffs) |
|
static int | nfParDeg (number n, const coeffs r) |
|
static long | nfInt (number &n, const coeffs r) |
|
static number | nfAdd (number a, number b, const coeffs R) |
|
static number | nfNeg (number c, const coeffs r) |
|
static number | nfSub (number a, number b, const coeffs r) |
|
static BOOLEAN | nfIsOne (number a, const coeffs r) |
|
static number | nfDiv (number a, number b, const coeffs r) |
|
static number | nfInvers (number c, const coeffs r) |
|
static BOOLEAN | nfGreater (number a, number b, const coeffs r) |
|
static BOOLEAN | nfEqual (number a, number b, const coeffs r) |
|
static void | nfWriteLong (number a, const coeffs r) |
|
static void | nfWriteShort (number a, const coeffs r) |
|
static void | nfPower (number a, int i, number *result, const coeffs r) |
|
static const char * | nfEati (const char *s, int *i, const coeffs r) |
|
static const char * | nfRead (const char *s, number *a, const coeffs r) |
|
int | gf_tab_numdigits62 (int q) |
|
int | convertback62 (char *p, int n) |
|
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...
|
|
static void | nfReadMipo (char *s) |
|
static void | nfReadTable (const int c, const coeffs r) |
|
static number | nfMapP (number c, const coeffs, const coeffs dst) |
|
static number | nfMapGG (number c, const coeffs src, const coeffs) |
|
static number | nfMapGGrev (number c, const coeffs src, const coeffs) |
|
static nMapFunc | nfSetMap (const coeffs src, const coeffs dst) |
|
static BOOLEAN | nfCoeffIsEqual (const coeffs, n_coeffType, void *) |
|
static void | nfKillChar (coeffs r) |
|
static char * | nfCoeffString (const coeffs r) |
|
static char * | nfCoeffName (const coeffs r) |
|
static number | nfRandom (siRandProc p, number, number, const coeffs cf) |
|
static void | nfCoeffWrite (const coeffs r, BOOLEAN details) |
|
BOOLEAN | nfInitChar (coeffs r, void *parameter) |
|
◆ nfTest
◆ sixteenlog2
#define sixteenlog2 11.09035489 |
◆ convertback62()
int convertback62 |
( |
char * |
p, |
|
|
int |
n |
|
) |
| |
◆ gf_tab_numdigits62()
int gf_tab_numdigits62 |
( |
int |
q | ) |
|
◆ nfAdd()
static number nfAdd |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
R |
|
) |
| |
|
static |
Definition at line 258 of file ffields.cc.
266 if ((
long)
R->m_nfCharQ == (
long)a)
return b;
267 if ((
long)
R->m_nfCharQ == (
long)
b)
return a;
269 if ((
long)a >= (
long)
b)
272 zab = (long)a-(
long)
b;
277 zab = (long)
b-(
long)a;
282 if (
R->m_nfPlus1Table[zab]==
R->m_nfCharQ) r=(long)
R->m_nfCharQ;
285 r= zb+(
long)
R->m_nfPlus1Table[zab];
286 if(r>=(
long)
R->m_nfCharQ1) r-=(
long)
R->m_nfCharQ1;
◆ nfCoeffIsEqual()
Definition at line 842 of file ffields.cc.
846 int c = (int)
pow ((
double)
p->GFChar, (double)
p->GFDegree);
◆ nfCoeffName()
Definition at line 814 of file ffields.cc.
816 static char nfCoeffName_buf[32];
818 nfCoeffName_buf[31]=
'\0';
819 snprintf(nfCoeffName_buf,31,
"ZZ/%d[%s]",r->m_nfCharQ,
p);
820 return nfCoeffName_buf;
◆ nfCoeffString()
Definition at line 806 of file ffields.cc.
810 sprintf(
s,
"%d,%s",r->m_nfCharQ,
p);
◆ nfCoeffWrite()
◆ nfDBTest()
Definition at line 111 of file ffields.cc.
114 if (((
long)a<0L) || ((
long)a>(
long)r->m_nfCharQ))
116 Print(
"wrong %d in %s:%d\n",(
int)((
long)a),
f,
l);
122 if (r->m_nfPlus1Table[
i]>r->m_nfCharQ)
124 Print(
"wrong table %d=%d in %s:%d\n",
i,r->m_nfPlus1Table[
i],
f,
l);
128 }
while (i<r->m_nfCharQ);
◆ nfDiv()
static number nfDiv |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 335 of file ffields.cc.
340 if ((
long)
b==(
long)r->m_nfCharQ)
343 return (number)((long)r->m_nfCharQ);
348 if ((
long)a==(
long)r->m_nfCharQ)
349 return (number)((long)r->m_nfCharQ);
351 long s = (long)a - (
long)
b;
353 s += (long)r->m_nfCharQ1;
◆ nfEati()
Definition at line 501 of file ffields.cc.
503 if (*
s >=
'0' && *
s <=
'9')
512 while (*
s >=
'0' && *
s <=
'9');
513 if (*
i >= r->m_nfCharP) *
i = *
i % r->m_nfCharP;
◆ nfEqual()
Definition at line 394 of file ffields.cc.
400 return (
long)a == (long)
b;
◆ nfGreater()
Definition at line 382 of file ffields.cc.
388 return (
long)a != (long)
b;
◆ nfGreaterZero()
◆ nfInit()
Definition at line 191 of file ffields.cc.
196 if (
i==0)
return (number)(long)r->m_nfCharQ;
197 while (
i < 0)
i += r->m_nfCharP;
198 while (
i >= r->m_nfCharP)
i -= r->m_nfCharP;
199 if (
i==0)
return (number)(long)r->m_nfCharQ;
203 c=r->m_nfPlus1Table[c];
207 nfTest((number)(
long)c, r);
209 return (number)(long)c;
◆ nfInitChar()
Definition at line 852 of file ffields.cc.
868 r->cfExactDiv=
nfDiv;
918 const char *
name =
p->GFPar_name;
921 r->m_nfCharP =
p->GFChar;
924 r->iNumberOfParameters = 1;
927 char ** pParameterNames = (
char **)
omAlloc0(
sizeof(
char *));
933 r->pParameterNames = (
const char**)pParameterNames;
938 r->m_nfPlus1Table=
NULL;
940 if (strlen(
name) > 1)
945 r->has_simple_Alloc=
TRUE;
946 r->has_simple_Inverse=
TRUE;
948 if(
p->GFChar > (2<<15))
951 WarnS(
"illegal characteristic");
956 const double check=
log ((
double) (
p->GFChar));
958 #define sixteenlog2 11.09035489
962 Warn(
"Sorry: illegal size: %u ^ %u",
p->GFChar,
p->GFDegree );
967 int c = (int)
pow ((
double)
p->GFChar, (double)
p->GFDegree);
971 if( r->m_nfPlus1Table ==
NULL )
977 assume (r -> m_nfCharQ > 0);
979 r->ch = r->m_nfCharP;
◆ nfInt()
Definition at line 240 of file ffields.cc.
243 unsigned short nn=(
unsigned short)(
long)n;
244 if (nn==r->m_nfCharQ)
return 0;
246 while ((c!=nn)&&(
i<r->m_nfCharP))
248 c=r->m_nfPlus1Table[c];
◆ nfInvers()
Definition at line 363 of file ffields.cc.
368 if ((
long)c==(
long)r->m_nfCharQ)
371 return (number)((long)r->m_nfCharQ);
374 nfTest(((number)((
long)r->m_nfCharQ1-(
long)c)), r);
376 return (number)((long)r->m_nfCharQ1-(
long)c);
◆ nfIsMOne()
Definition at line 148 of file ffields.cc.
153 if (0L == (
long)a)
return FALSE;
154 return (
long)r->m_nfM1 == (long)a;
◆ nfIsOne()
Definition at line 324 of file ffields.cc.
329 return 0L == (long)a;
◆ nfIsZero()
Definition at line 137 of file ffields.cc.
142 return (
long)r->m_nfCharQ == (long)a;
◆ nfKillChar()
static void nfKillChar |
( |
coeffs |
r | ) |
|
|
static |
◆ nfMapGG()
Definition at line 717 of file ffields.cc.
721 while (
i >src->m_nfCharQ1)
i-=src->m_nfCharQ1;
722 return (number)((long)
i);
◆ nfMapGGrev()
Definition at line 727 of file ffields.cc.
729 int ex=(int)((
long)c);
733 return (number)(long)src->m_nfCharQ;
◆ nfMapP()
◆ nfMult()
static number nfMult |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 171 of file ffields.cc.
177 if (((
long)a == (
long)r->m_nfCharQ) || ((
long)
b == (
long)r->m_nfCharQ))
178 return (number)(long)r->m_nfCharQ;
180 int i=(
int)((long)a+(
long)
b);
181 if (
i>=r->m_nfCharQ1)
i-=r->m_nfCharQ1;
185 return (number)(long)
i;
◆ nfNeg()
Definition at line 297 of file ffields.cc.
303 if ((
long)r->m_nfCharQ == (
long)c)
return c;
304 long i=(long)c+(
long)r->m_nfM1;
305 if (
i>=(
long)r->m_nfCharQ1)
i-=(
long)r->m_nfCharQ1;
◆ nfParameter()
static number nfParameter |
( |
int |
i, |
|
|
const |
coeffs |
|
) |
| |
|
static |
◆ nfParDeg()
Definition at line 228 of file ffields.cc.
233 if((
long)r->m_nfCharQ == (
long)n)
return -1;
234 return (
int)((long)n);
◆ nfPower()
static void nfPower |
( |
number |
a, |
|
|
int |
i, |
|
|
number * |
result, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
Definition at line 473 of file ffields.cc.
489 if ((
long)a == (long)r->m_nfCharQ) rl=(long)r->m_nfCharQ;
490 else rl=((
long)a*(long)
i) % (long)r->m_nfCharQ1;
◆ nfRandom()
Definition at line 823 of file ffields.cc.
825 return (number)(long)(
p() %(
cf->m_nfCharQ+1));
◆ nfRead()
Definition at line 522 of file ffields.cc.
539 const int N = strlen(nf_Parameter);
540 if (strncmp(
s,nf_Parameter,
N)==0)
543 if ((*
s >=
'0') && (*
s <=
'9'))
546 while (
i>=r->m_nfCharQ1)
i-=r->m_nfCharQ1;
◆ nfReadMipo()
static void nfReadMipo |
( |
char * |
s | ) |
|
|
static |
Definition at line 580 of file ffields.cc.
582 const char *
l=strchr(
s,
';')+1;
584 int i=strtol(
l,&n,10);
598 WerrorS(
"error in reading minpoly from gftables");
◆ nfReadTable()
Definition at line 605 of file ffields.cc.
608 if ((c==r->m_nfCharQ)||(c== -r->m_nfCharQ))
624 if (r->m_nfCharQ > 1)
626 omFreeSize( (
ADDRESS)r->m_nfPlus1Table,(r->m_nfCharQ+1)*
sizeof(
unsigned short) );
627 r->m_nfPlus1Table=
NULL;
631 if (c>1) r->m_nfCharQ = c;
632 else r->m_nfCharQ = -c;
634 sprintf(
buf,
"gftables/%d",r->m_nfCharQ);
640 if(!fgets(
buf,
sizeof(
buf),
fp))
return;
641 if(strcmp(
buf,
"@@ factory GF(q) table @@\n")!=0)
653 res = sscanf(
buf,
"%d %d",&r->m_nfCharP,&q);
655 while((
res < 0) and (errno == EINTR));
658 r->m_nfCharQ1=r->m_nfCharQ-1;
660 r->m_nfPlus1Table= (
unsigned short *)
omAlloc0( (r->m_nfCharQ+1)*
sizeof(
unsigned short) );
665 while ( i < r->m_nfCharQ )
671 while ( (i < r->m_nfCharQ) && (
k < 30) )
674 if(r->m_nfPlus1Table[
i]>r->m_nfCharQ)
676 Print(
"wrong entry %d: %d(%c%c%c)\n",
i,r->m_nfPlus1Table[
i],bufptr[0],bufptr[1],bufptr[2]);
679 if (r->m_nfPlus1Table[
i]==r->m_nfCharQ)
693 r->m_nfPlus1Table[0]=r->m_nfPlus1Table[r->m_nfCharQ1];
702 Werror(
"illegal GF-table %d",r->m_nfCharQ);
◆ nfSetMap()
Definition at line 739 of file ffields.cc.
749 if ((src->m_nfCharQ % q)==0)
754 while(qq!=q) { qq *= r->m_nfCharP; n1++; }
757 while(qq!=src->m_nfCharQ) { qq *= r->m_nfCharP; n2++; }
761 int save_ch=r->m_nfCharQ;
763 int nn=r->m_nfPlus1Table[0];
769 else if ((n1 % n2)==0)
◆ nfShowMipo()
◆ nfSub()
static number nfSub |
( |
number |
a, |
|
|
number |
b, |
|
|
const coeffs |
r |
|
) |
| |
|
static |
◆ nfWriteLong()
Definition at line 406 of file ffields.cc.
418 unsigned short nn=(
unsigned short)(
long)a;
419 while ((c!=nn)&&(
i<r->m_nfCharQ))
421 c=r->m_nfPlus1Table[c];
◆ nfWriteShort()
Definition at line 440 of file ffields.cc.
452 unsigned short nn=(
unsigned short)(
long)a;
453 while ((c!=nn)&&(
i<r->m_nfCharQ))
455 c=r->m_nfPlus1Table[c];
◆ fftable
const unsigned short fftable[] |
◆ nfMapGG_factor
◆ nfMinPoly
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
@ n_rep_gap_rat
(number), see longrat.h
static nMapFunc nfSetMap(const coeffs src, const coeffs dst)
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
void StringAppendS(const char *st)
static char * nfCoeffString(const coeffs r)
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
static void nfCoeffWrite(const coeffs r, BOOLEAN details)
Creation data needed for finite fields.
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
static BOOLEAN nfIsMOne(number a, const coeffs r)
static int nfParDeg(number n, const coeffs r)
const unsigned short fftable[]
static void nfPower(number a, int i, number *result, const coeffs r)
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
static const char * nfEati(const char *s, int *i, const coeffs r)
const CanonicalForm CFMap CFMap & N
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
static number nfRandom(siRandProc p, number, number, const coeffs cf)
static number nfMapGGrev(number c, const coeffs src, const coeffs)
@ n_rep_int
(int), see modulop.h
int gf_tab_numdigits62(int q)
static number nfInvers(number c, const coeffs r)
static void nfWriteLong(number a, const coeffs r)
int convertback62(char *p, int n)
static int nfMapGG_factor
static BOOLEAN nfIsZero(number a, const coeffs r)
static number nfDiv(number a, number b, const coeffs r)
static char * nfCoeffName(const coeffs r)
static const char * nfRead(const char *s, number *a, const coeffs r)
static BOOLEAN nfEqual(number a, number b, const coeffs r)
int status int void * buf
const char *const nDivBy0
void PrintS(const char *s)
#define omFreeSize(addr, size)
static number nfSub(number a, number b, const coeffs r)
static BOOLEAN nfGreater(number a, number b, const coeffs r)
static BOOLEAN nfIsOne(number a, const coeffs r)
number nlModP(number q, const coeffs, const coeffs Zp)
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d,...
static number nfInit(long i, const coeffs r)
static void nfReadTable(const int c, const coeffs r)
static number nfAdd(number a, number b, const coeffs R)
static BOOLEAN nfGreaterZero(number k, const coeffs r)
void StringSetS(const char *st)
gmp_float log(const gmp_float &a)
static number nfNeg(number c, const coeffs r)
void Werror(const char *fmt,...)
char name(const Variable &v)
Rational pow(const Rational &a, int e)
void WerrorS(const char *s)
BOOLEAN nfDBTest(number a, const char *f, const int l, const coeffs r)
@ n_rep_gf
(int), see ffields.h
static long nfInt(number &n, const coeffs r)
const char * eati(const char *s, int *i)
static number nfMult(number a, number b, const coeffs r)
static number nfMapGG(number c, const coeffs src, const coeffs)
static number nfParameter(int i, const coeffs)
const CanonicalForm int s
static void nfKillChar(coeffs r)
static number nfMapP(number c, const coeffs, const coeffs dst)
static void nfReadMipo(char *s)
static BOOLEAN nfCoeffIsEqual(const coeffs, n_coeffType, void *)
static void nfWriteShort(number a, const coeffs r)