Data Structures | Typedefs | Functions
algext.h File Reference
#include <coeffs/coeffs.h>

Go to the source code of this file.

Data Structures

struct  AlgExtInfo
 struct for passing initialization parameters to naInitChar More...
 

Typedefs

typedef polyrec * poly
 

Functions

nMapFunc naSetMap (const coeffs src, const coeffs dst)
 Get a mapping function from src into the domain of this type (n_algExt) More...
 
BOOLEAN naInitChar (coeffs cf, void *infoStruct)
 Initialize the coeffs object. More...
 
int naIsParam (number, const coeffs)
 if m == var(i)/1 => return i, More...
 
poly p_ExtGcd (poly p, poly &pFactor, poly q, poly &qFactor, ring r)
 assumes that p and q are univariate polynomials in r, mentioning the same variable; assumes a global monomial ordering in r; assumes that not both p and q are NULL; returns the gcd of p and q; moreover, afterwards pFactor and qFactor contain appropriate factors such that gcd(p, q) = p * pFactor + q * qFactor; leaves p and q unmodified More...
 
char * naCoeffString (const coeffs r)
 

Data Structure Documentation

struct AlgExtInfo

struct for passing initialization parameters to naInitChar

Definition at line 40 of file algext.h.

Data Fields
ring r

Typedef Documentation

typedef polyrec* poly

Definition at line 53 of file algext.h.

Function Documentation

char* naCoeffString ( const coeffs  r)

Definition at line 1346 of file algext.cc.

1347 {
1348  const char* const* p=n_ParameterNames(r);
1349  int l=0;
1350  int i;
1351  for(i=0; i<n_NumberOfParameters(r);i++)
1352  {
1353  l+=(strlen(p[i])+1);
1354  }
1355  char *s=(char *)omAlloc(l+10+1);
1356  s[0]='\0';
1357  snprintf(s,10+1,"%d",r->ch); /* Fp(a) or Q(a) */
1358  char tt[2];
1359  tt[0]=',';
1360  tt[1]='\0';
1361  for(i=0; i<n_NumberOfParameters(r);i++)
1362  {
1363  strcat(s,tt);
1364  strcat(s,p[i]);
1365  }
1366  return s;
1367 }
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:796
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
#define omAlloc(size)
Definition: omAllocDecl.h:210
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:792
int i
Definition: cfEzgcd.cc:123
int l
Definition: cfEzgcd.cc:94
BOOLEAN naInitChar ( coeffs  cf,
void *  infoStruct 
)

Initialize the coeffs object.

first check whether cf->extRing != NULL and delete old ring???

Definition at line 1389 of file algext.cc.

1390 {
1391  assume( infoStruct != NULL );
1392 
1393  AlgExtInfo *e = (AlgExtInfo *)infoStruct;
1394  /// first check whether cf->extRing != NULL and delete old ring???
1395 
1396  assume(e->r != NULL); // extRing;
1397  assume(e->r->cf != NULL); // extRing->cf;
1398 
1399  assume((e->r->qideal != NULL) && // minideal has one
1400  (IDELEMS(e->r->qideal) == 1) && // non-zero generator
1401  (e->r->qideal->m[0] != NULL) ); // at m[0];
1402 
1403  assume( cf != NULL );
1404  assume(getCoeffType(cf) == ID); // coeff type;
1405 
1406  e->r->ref ++; // increase the ref.counter for the ground poly. ring!
1407  const ring R = e->r; // no copy!
1408  cf->extRing = R;
1409 
1410  /* propagate characteristic up so that it becomes
1411  directly accessible in cf: */
1412  cf->ch = R->cf->ch;
1413 
1414  cf->is_field=TRUE;
1415  cf->is_domain=TRUE;
1416  cf->rep=n_rep_poly;
1417 
1418  #ifdef LDEBUG
1420  #endif
1421 
1422  cf->cfCoeffString = naCoeffString;
1423 
1424  cf->cfGreaterZero = naGreaterZero;
1425  cf->cfGreater = naGreater;
1426  cf->cfEqual = naEqual;
1427  cf->cfIsZero = naIsZero;
1428  cf->cfIsOne = naIsOne;
1429  cf->cfIsMOne = naIsMOne;
1430  cf->cfInit = naInit;
1431  cf->cfFarey = naFarey;
1432  cf->cfChineseRemainder= naChineseRemainder;
1433  cf->cfInt = naInt;
1434  cf->cfInpNeg = naNeg;
1435  cf->cfAdd = naAdd;
1436  cf->cfSub = naSub;
1437  cf->cfMult = naMult;
1438  cf->cfDiv = naDiv;
1439  cf->cfExactDiv = naDiv;
1440  cf->cfPower = naPower;
1441  cf->cfCopy = naCopy;
1442 
1443  cf->cfWriteLong = naWriteLong;
1444 
1445  if( rCanShortOut(naRing) )
1446  cf->cfWriteShort = naWriteShort;
1447  else
1448  cf->cfWriteShort = naWriteLong;
1449 
1450  cf->cfRead = naRead;
1451  cf->cfDelete = naDelete;
1452  cf->cfSetMap = naSetMap;
1453  cf->cfGetDenom = naGetDenom;
1454  cf->cfGetNumerator = naGetNumerator;
1455  cf->cfRePart = naCopy;
1456  cf->cfCoeffWrite = naCoeffWrite;
1457  cf->cfNormalize = naNormalize;
1458  cf->cfKillChar = naKillChar;
1459 #ifdef LDEBUG
1460  cf->cfDBTest = naDBTest;
1461 #endif
1462  cf->cfGcd = naGcd;
1463  cf->cfNormalizeHelper = naLcmContent;
1464  cf->cfSize = naSize;
1465  cf->nCoeffIsEqual = naCoeffIsEqual;
1466  cf->cfInvers = naInvers;
1467  cf->convFactoryNSingN=naConvFactoryNSingN;
1468  cf->convSingNFactoryN=naConvSingNFactoryN;
1469  cf->cfParDeg = naParDeg;
1470 
1471  cf->iNumberOfParameters = rVar(R);
1472  cf->pParameterNames = (const char**)R->names;
1473  cf->cfParameter = naParameter;
1474  cf->has_simple_Inverse= R->cf->has_simple_Inverse;
1475  /* cf->has_simple_Alloc= FALSE; */
1476 
1477  if( nCoeff_is_Q(R->cf) )
1478  {
1479  cf->cfClearContent = naClearContent;
1480  cf->cfClearDenominators = naClearDenominators;
1481  }
1482 
1483  return FALSE;
1484 }
void naDelete(number *a, const coeffs cf)
Definition: algext.cc:291
ring r
Definition: algext.h:40
BOOLEAN naIsZero(number a, const coeffs cf)
Definition: algext.cc:285
#define FALSE
Definition: auxiliary.h:140
void naKillChar(coeffs cf)
Definition: algext.cc:1340
void naPower(number a, int exp, number *b, const coeffs cf)
Definition: algext.cc:507
number naSub(number a, number b, const coeffs cf)
Definition: algext.cc:461
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
const char * naRead(const char *s, number *a, const coeffs cf)
Definition: algext.cc:620
nMapFunc naSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type (n_algExt)
Definition: algext.cc:1036
number naInit(long i, const coeffs cf)
Definition: algext.cc:352
#define TRUE
Definition: auxiliary.h:144
long naInt(number &a, const coeffs cf)
Definition: algext.cc:358
BOOLEAN naGreater(number a, number b, const coeffs cf)
Definition: algext.cc:371
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:824
static void naClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: algext.cc:1324
char * naCoeffString(const coeffs r)
Definition: algext.cc:1346
static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void *param)
Definition: algext.cc:693
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:534
(poly), see algext.h
Definition: coeffs.h:112
BOOLEAN naGreaterZero(number a, const coeffs cf)
forward declarations
Definition: algext.cc:391
number naFarey(number p, number n, const coeffs cf)
Definition: algext.cc:1381
int naSize(number a, const coeffs cf)
Definition: algext.cc:727
BOOLEAN naEqual(number a, number b, const coeffs cf)
Definition: algext.cc:300
number naConvFactoryNSingN(const CanonicalForm n, const coeffs cf)
Definition: algext.cc:769
number naDiv(number a, number b, const coeffs cf)
Definition: algext.cc:483
number naGetDenom(number &a, const coeffs cf)
Definition: algext.cc:322
BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs r)
Definition: algext.cc:246
#define assume(x)
Definition: mod2.h:405
static void naClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: algext.cc:1123
number naMult(number a, number b, const coeffs cf)
Definition: algext.cc:472
static int naParDeg(number a, const coeffs cf)
Definition: algext.cc:1089
static const n_coeffType ID
Our own type!
Definition: algext.cc:68
void naWriteLong(number a, const coeffs cf)
Definition: algext.cc:584
#define IDELEMS(i)
Definition: simpleideals.h:24
number naInvers(number a, const coeffs cf)
Definition: algext.cc:837
void naCoeffWrite(const coeffs cf, BOOLEAN details)
Definition: algext.cc:400
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
#define p_Test(p, r)
Definition: p_polys.h:160
number naLcmContent(number a, number b, const coeffs cf)
Definition: algext.cc:658
#define naMinpoly
Definition: algext.cc:80
#define NULL
Definition: omList.c:10
number naAdd(number a, number b, const coeffs cf)
Definition: algext.cc:450
struct for passing initialization parameters to naInitChar
Definition: algext.h:40
CanonicalForm naConvSingNFactoryN(number n, BOOLEAN, const coeffs cf)
Definition: algext.cc:775
#define R
Definition: sirandom.c:26
number naCopy(number a, const coeffs cf)
Definition: algext.cc:309
number naGcd(number a, number b, const coeffs cf)
Definition: algext.cc:789
number naNeg(number a, const coeffs cf)
this is in-place, modifies a
Definition: algext.cc:345
#define naRing
Definition: algext.cc:71
static number naParameter(const int iParameter, const coeffs cf)
return the specified parameter as a number in the given alg. field
Definition: algext.cc:1097
polyrec * poly
Definition: hilb.h:10
BOOLEAN naIsOne(number a, const coeffs cf)
Definition: algext.cc:328
number naChineseRemainder(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs cf)
Definition: algext.cc:1369
BOOLEAN naIsMOne(number a, const coeffs cf)
Definition: algext.cc:336
void naWriteShort(number a, const coeffs cf)
Definition: algext.cc:602
void naNormalize(number &a, const coeffs cf)
Definition: algext.cc:761
number naGetNumerator(number &a, const coeffs cf)
Definition: algext.cc:317
int naIsParam ( number  ,
const coeffs   
)

if m == var(i)/1 => return i,

Definition at line 1112 of file algext.cc.

1113 {
1114  assume(getCoeffType(cf) == ID);
1115 
1116  const ring R = cf->extRing;
1117  assume( R != NULL );
1118 
1119  return p_Var( (poly)m, R );
1120 }
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
static const n_coeffType ID
Our own type!
Definition: algext.cc:68
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
polyrec * poly
Definition: hilb.h:10
int p_Var(poly m, const ring r)
Definition: p_polys.cc:4435
nMapFunc naSetMap ( const coeffs  src,
const coeffs  dst 
)

Get a mapping function from src into the domain of this type (n_algExt)

Q or Z –> Q(a)

Z –> Q(a)

Z/p –> Q(a)

Q –> Z/p(a)

Z –> Z/p(a)

Z/p –> Z/p(a)

Z/u –> Z/p(a)

default

Definition at line 1036 of file algext.cc.

1037 {
1038  /* dst is expected to be an algebraic field extension */
1039  assume(getCoeffType(dst) == ID);
1040 
1041  if( src == dst ) return ndCopyMap;
1042 
1043  int h = 0; /* the height of the extension tower given by dst */
1044  coeffs bDst = nCoeff_bottom(dst, h); /* the bottom field in the tower dst */
1045  coeffs bSrc = nCoeff_bottom(src, h); /* the bottom field in the tower src */
1046 
1047  /* for the time being, we only provide maps if h = 1 or 0 */
1048  if (h==0)
1049  {
1050  if ((src->rep==n_rep_gap_rat) && nCoeff_is_Q(bDst))
1051  return naMap00; /// Q or Z --> Q(a)
1052  if ((src->rep==n_rep_gap_gmp) && nCoeff_is_Q(bDst))
1053  return naMapZ0; /// Z --> Q(a)
1054  if (nCoeff_is_Zp(src) && nCoeff_is_Q(bDst))
1055  return naMapP0; /// Z/p --> Q(a)
1056  if (nCoeff_is_Q_or_BI(src) && nCoeff_is_Zp(bDst))
1057  return naMap0P; /// Q --> Z/p(a)
1058  if ((src->rep==n_rep_gap_gmp) && nCoeff_is_Zp(bDst))
1059  return naMapZ0; /// Z --> Z/p(a)
1060  if (nCoeff_is_Zp(src) && nCoeff_is_Zp(bDst))
1061  {
1062  if (src->ch == dst->ch) return naMapPP; /// Z/p --> Z/p(a)
1063  else return naMapUP; /// Z/u --> Z/p(a)
1064  }
1065  }
1066  if (h != 1) return NULL;
1067  if ((!nCoeff_is_Zp(bDst)) && (!nCoeff_is_Q(bDst))) return NULL;
1068  if ((!nCoeff_is_Zp(bSrc)) && (!nCoeff_is_Q_or_BI(bSrc))) return NULL;
1069 
1070  nMapFunc nMap=n_SetMap(src->extRing->cf,dst->extRing->cf);
1071  if (rSamePolyRep(src->extRing, dst->extRing) && (strcmp(rRingVar(0, src->extRing), rRingVar(0, dst->extRing)) == 0))
1072  {
1073  if (src->type==n_algExt)
1074  return ndCopyMap; // naCopyMap; /// K(a) --> K(a)
1075  else
1076  return naCopyTrans2AlgExt;
1077  }
1078  else if ((nMap!=NULL) && (strcmp(rRingVar(0,src->extRing),rRingVar(0,dst->extRing))==0) && (rVar (src->extRing) == rVar (dst->extRing)))
1079  {
1080  if (src->type==n_algExt)
1081  return naGenMap; // naCopyMap; /// K(a) --> K'(a)
1082  else
1083  return naGenTrans2AlgExt;
1084  }
1085 
1086  return NULL; /// default
1087 }
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:818
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:239
number naMapZ0(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:877
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
Definition: coeffs.h:827
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
(), see rinteger.h, new impl.
Definition: coeffs.h:111
number naMap00(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:867
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:824
number naMapP0(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:889
number naCopyTrans2AlgExt(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:909
number naMapPP(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:970
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
number naGenMap(number a, const coeffs cf, const coeffs dst)
Definition: algext.cc:991
number naGenTrans2AlgExt(number a, const coeffs cf, const coeffs dst)
Definition: algext.cc:1006
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1681
static char * rRingVar(short i, const ring r)
Definition: ring.h:525
static const n_coeffType ID
Our own type!
Definition: algext.cc:68
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:720
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static coeffs nCoeff_bottom(const coeffs r, int &height)
Definition: algext.cc:271
(number), see longrat.h
Definition: coeffs.h:110
#define NULL
Definition: omList.c:10
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:35
number naMap0P(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:957
number naMapUP(number a, const coeffs src, const coeffs dst)
Definition: algext.cc:980
static Poly * h
Definition: janet.cc:978
poly p_ExtGcd ( poly  p,
poly pFactor,
poly  q,
poly qFactor,
ring  r 
)

assumes that p and q are univariate polynomials in r, mentioning the same variable; assumes a global monomial ordering in r; assumes that not both p and q are NULL; returns the gcd of p and q; moreover, afterwards pFactor and qFactor contain appropriate factors such that gcd(p, q) = p * pFactor + q * qFactor; leaves p and q unmodified

Definition at line 229 of file algext.cc.

230 {
231  assume((p != NULL) || (q != NULL));
232  poly a = p; poly b = q; BOOLEAN aCorrespondsToP = TRUE;
233  if (p_Deg(a, r) < p_Deg(b, r))
234  { a = q; b = p; aCorrespondsToP = FALSE; }
235  a = p_Copy(a, r); b = p_Copy(b, r);
236  poly aFactor = NULL; poly bFactor = NULL;
237  poly theGcd = p_ExtGcdHelper(a, aFactor, b, bFactor, r);
238  if (aCorrespondsToP) { pFactor = aFactor; qFactor = bFactor; }
239  else { pFactor = bFactor; qFactor = aFactor; }
240  return theGcd;
241 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
static poly p_ExtGcdHelper(poly &p, poly &pFactor, poly &q, poly &qFactor, ring r)
Definition: algext.cc:196
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213