Loading...
Searching...
No Matches
algext.h File Reference
`#include "coeffs/coeffs.h"`
`#include "polys/monomials/ring.h"`

Go to the source code of this file.

## Data Structures

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

## Functions

nMapFunc | naSetMap (const coeffs src, const coeffs dst)
| Get a mapping function from src into the domain of this type (n_algExt).
BOOLEAN | naInitChar (coeffs cf, void *infoStruct)
| Initialize the coeffs object.
BOOLEAN | n2pInitChar (coeffs cf, void *infoStruct)
int | naIsParam (number, const coeffs)
| if m == var(i)/1 => return i,
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
char * | naCoeffName (const coeffs r)

## Data Structure Documentation

## AlgExtInfo

struct AlgExtInfo

struct for passing initialization parameters to naInitChar

Definition at line 37 of file algext.h.

Data Fields
ring | r |

## Function Documentation

## n2pInitChar()

BOOLEAN n2pInitChar | ( | coeffs | cf,
|  | void * | infoStruct )

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

Definition at line 1687 of file algext.cc.

{
assume( infoStruct != NULL );
AlgExtInfo *e = (AlgExtInfo *)infoStruct;
/// first check whether cf->extRing != NULL and delete old ring???
assume(e->r != NULL); // extRing;
assume(e->r->cf != NULL); // extRing->cf;
assume( cf != NULL );
rIncRefCnt(e->r); // increase the ref.counter for the ground poly. ring!
const ring R = e->r; // no copy!
cf->extRing = R;
/* propagate characteristic up so that it becomes
directly accessible in cf: */
cf->ch = R->cf->ch;
cf->is_field=FALSE;
cf->is_domain=TRUE;
cf->cfCoeffName = n2pCoeffName;
cf->cfGreaterZero = naGreaterZero;
cf->cfGreater = naGreater;
cf->cfEqual = naEqual;
cf->cfIsZero = naIsZero;
cf->cfIsOne = naIsOne;
cf->cfIsMOne = naIsMOne;
cf->cfInit = naInit;
cf->cfInitMPZ = naInitMPZ;
cf->cfFarey = naFarey;
cf->cfChineseRemainder= naChineseRemainder;
cf->cfInt = naInt;
cf->cfInpNeg = naNeg;
cf->cfAdd = naAdd;
cf->cfInpAdd = naInpAdd;
cf->cfSub = naSub;
cf->cfMult = n2pMult;
cf->cfDiv = n2pDiv;
cf->cfPower = n2pPower;
cf->cfCopy = naCopy;
cf->cfWriteLong = naWriteLong;
if( rCanShortOut(n2pRing) )
cf->cfWriteShort = naWriteShort;
else
cf->cfWriteShort = naWriteLong;
cf->cfRead = n2pRead;
cf->cfDelete = naDelete;
cf->cfSetMap = naSetMap;
//cf->cfGetDenom = naGetDenom; // use nd*
//cf->cfGetNumerator = naGetNumerator; // use nd*
cf->cfRePart = naCopy;
cf->cfCoeffWrite = n2pCoeffWrite;
cf->cfNormalize = n2pNormalize;
cf->cfKillChar = naKillChar;
#ifdef LDEBUG
cf->cfDBTest = naDBTest;
#endif
cf->cfGcd = naGcd;
cf->cfNormalizeHelper = naLcmContent;
cf->cfSize = naSize;
cf->nCoeffIsEqual = n2pCoeffIsEqual;
cf->cfInvers = n2pInvers;
cf->convFactoryNSingN=naConvFactoryNSingN;
cf->convSingNFactoryN=naConvSingNFactoryN;
cf->cfParDeg = naParDeg;
cf->iNumberOfParameters = rVar(R);
cf->pParameterNames = (const char**)R->names;
cf->cfParameter = naParameter;
cf->has_simple_Inverse=FALSE;
/* cf->has_simple_Alloc= FALSE; */
if( nCoeff_is_Q(R->cf) )
{
cf->cfClearContent = naClearContent;
cf->cfClearDenominators = naClearDenominators;
}
return FALSE;
}
naInit
static number naInit(long i, const coeffs cf)
Definition algext.cc:325
n2pDiv
number n2pDiv(number a, number b, const coeffs cf)
Definition algext.cc:1587
naSub
static number naSub(number a, number b, const coeffs cf)
Definition algext.cc:451
naEqual
static BOOLEAN naEqual(number a, number b, const coeffs cf)
Definition algext.cc:285
naGreaterZero
static BOOLEAN naGreaterZero(number a, const coeffs cf)
forward declarations
Definition algext.cc:370
naConvSingNFactoryN
static CanonicalForm naConvSingNFactoryN(number n, BOOLEAN, const coeffs cf)
Definition algext.cc:769
naInpAdd
static void naInpAdd(number &a, number b, const coeffs cf)
Definition algext.cc:440
naIsOne
static BOOLEAN naIsOne(number a, const coeffs cf)
Definition algext.cc:301
naFarey
static number naFarey(number p, number n, const coeffs cf)
Definition algext.cc:1425
n2pMult
number n2pMult(number a, number b, const coeffs cf)
Definition algext.cc:1579
n2pRead
const char * n2pRead(const char *s, number *a, const coeffs cf)
Definition algext.cc:1603
naChineseRemainder
static number naChineseRemainder(number *x, number *q, int rl, BOOLEAN, CFArray &inv_cache, const coeffs cf)
Definition algext.cc:1413
naConvFactoryNSingN
static number naConvFactoryNSingN(const CanonicalForm n, const coeffs cf)
Definition algext.cc:763
naDBTest
static BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs r)
Definition algext.cc:231
naClearContent
static void naClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition algext.cc:1162
naWriteShort
static void naWriteShort(number a, const coeffs cf)
Definition algext.cc:601
naSize
static int naSize(number a, const coeffs cf)
Definition algext.cc:725
naAdd
static number naAdd(number a, number b, const coeffs cf)
Definition algext.cc:429
naParameter
static number naParameter(const int iParameter, const coeffs cf)
return the specified parameter as a number in the given alg. field
Definition algext.cc:1136
n2pRing
#define n2pRing
Definition algext.cc:1556
naParDeg
static int naParDeg(number a, const coeffs cf)
Definition algext.cc:1128
naCopy
static number naCopy(number a, const coeffs cf)
Definition algext.cc:294
naClearDenominators
static void naClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition algext.cc:1367
naInitMPZ
static number naInitMPZ(mpz_t m, const coeffs r)
Definition algext.cc:331
n2pCoeffIsEqual
static BOOLEAN n2pCoeffIsEqual(const coeffs cf, n_coeffType n, void *param)
Definition algext.cc:1612
naInt
static long naInt(number &a, const coeffs cf)
Definition algext.cc:337
naLcmContent
static number naLcmContent(number a, number b, const coeffs cf)
Definition algext.cc:656
n2pCoeffName
char * n2pCoeffName(const coeffs cf)
Definition algext.cc:1632
naGcd
static number naGcd(number a, number b, const coeffs cf)
Definition algext.cc:783
naSetMap
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:1077
naKillChar
static void naKillChar(coeffs cf)
Definition algext.cc:1383
naGreater
static BOOLEAN naGreater(number a, number b, const coeffs cf)
Definition algext.cc:350
naIsZero
static BOOLEAN naIsZero(number a, const coeffs cf)
Definition algext.cc:270
n2pInvers
number n2pInvers(number a, const coeffs cf)
Definition algext.cc:1671
n2pCoeffWrite
void n2pCoeffWrite(const coeffs cf, BOOLEAN details)
Definition algext.cc:1659
naDelete
static void naDelete(number *a, const coeffs cf)
Definition algext.cc:276
n2pNormalize
void n2pNormalize(number &a, const coeffs cf)
Definition algext.cc:1572
naWriteLong
static void naWriteLong(number a, const coeffs cf)
Definition algext.cc:583
n2pPower
void n2pPower(number a, int exp, number *b, const coeffs cf)
Definition algext.cc:1596
naNeg
static number naNeg(number a, const coeffs cf)
this is in-place, modifies a
Definition algext.cc:318
naIsMOne
static BOOLEAN naIsMOne(number a, const coeffs cf)
Definition algext.cc:309
AlgExtInfo::r
ring r
Definition algext.h:37
AlgExtInfo
struct for passing initialization parameters to naInitChar
Definition algext.h:37
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
cf
CanonicalForm cf
Definition cfModGcd.cc:4091
nCoeff_is_Q
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition coeffs.h:801
assume
#define assume(x)
Definition mod2.h:389
NULL
#define NULL
Definition omList.c:12
rIncRefCnt
static ring rIncRefCnt(ring r)
Definition ring.h:849
rCanShortOut
static BOOLEAN rCanShortOut(const ring r)
Definition ring.h:592
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
R
#define R
Definition sirandom.c:27

## naCoeffName()

char * naCoeffName | ( | const coeffs | r | ) |

Definition at line 1390 of file algext.cc.

{
const char* const* p=n_ParameterNames(r);
int l=0;
int i;
for(i=0; i<n_NumberOfParameters(r);i++)
{
l+=(strlen(p[i])+1);
}
STATIC_VAR char s[200];
s[0]='\0';
snprintf(s,10+1,"%d",r->ch); /* Fp(a) or Q(a) */
char tt[2];
tt[0]=',';
tt[1]='\0';
for(i=0; i<n_NumberOfParameters(r);i++)
{
strcat(s,tt);
strcat(s,p[i]);
}
return s;
}
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
n_ParameterNames
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition coeffs.h:773
n_NumberOfParameters
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition coeffs.h:769
s
const CanonicalForm int s
Definition facAbsFact.cc:51
STATIC_VAR
#define STATIC_VAR
Definition globaldefs.h:7

## naInitChar()

BOOLEAN naInitChar | ( | coeffs | cf,
|  | void * | infoStruct )

Initialize the coeffs object.

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

Definition at line 1433 of file algext.cc.

{
assume( infoStruct != NULL );
AlgExtInfo *e = (AlgExtInfo *)infoStruct;
/// first check whether cf->extRing != NULL and delete old ring???
assume(e->r != NULL); // extRing;
assume(e->r->cf != NULL); // extRing->cf;
assume((e->r->qideal != NULL) && // minideal has one
(IDELEMS(e->r->qideal) == 1) && // non-zero generator
(e->r->qideal->m[0] != NULL) ); // at m[0];
assume( cf != NULL );
assume(getCoeffType(cf) == n_algExt); // coeff type;
rIncRefCnt(e->r); // increase the ref.counter for the ground poly. ring!
const ring R = e->r; // no copy!
cf->extRing = R;
/* propagate characteristic up so that it becomes
directly accessible in cf: */
cf->ch = R->cf->ch;
cf->is_field=TRUE;
cf->is_domain=TRUE;
cf->rep=n_rep_poly;
#ifdef LDEBUG
p_Test((poly)naMinpoly, naRing);
#endif
cf->cfCoeffName = naCoeffName;
cf->cfGreaterZero = naGreaterZero;
cf->cfGreater = naGreater;
cf->cfEqual = naEqual;
cf->cfIsZero = naIsZero;
cf->cfIsOne = naIsOne;
cf->cfIsMOne = naIsMOne;
cf->cfInit = naInit;
cf->cfInitMPZ = naInitMPZ;
cf->cfFarey = naFarey;
cf->cfChineseRemainder= naChineseRemainder;
cf->cfInt = naInt;
cf->cfInpNeg = naNeg;
cf->cfAdd = naAdd;
cf->cfSub = naSub;
cf->cfMult = naMult;
cf->cfInpMult = naInpMult;
cf->cfDiv = naDiv;
cf->cfExactDiv = naDiv;
cf->cfPower = naPower;
cf->cfCopy = naCopy;
cf->cfWriteLong = naWriteLong;
if( rCanShortOut(naRing) )
cf->cfWriteShort = naWriteShort;
else
cf->cfWriteShort = naWriteLong;
cf->cfRead = naRead;
cf->cfDelete = naDelete;
cf->cfSetMap = naSetMap;
cf->cfRePart = naCopy;
cf->cfCoeffWrite = naCoeffWrite;
cf->cfNormalize = naNormalize;
cf->cfKillChar = naKillChar;
#ifdef LDEBUG
cf->cfDBTest = naDBTest;
#endif
cf->cfGcd = naGcd;
cf->cfNormalizeHelper = naLcmContent;
cf->cfSize = naSize;
cf->nCoeffIsEqual = naCoeffIsEqual;
cf->cfInvers = naInvers;
cf->convFactoryNSingN=naConvFactoryNSingN;
cf->convSingNFactoryN=naConvSingNFactoryN;
cf->cfParDeg = naParDeg;
cf->iNumberOfParameters = rVar(R);
cf->pParameterNames = (const char**)R->names;
cf->cfParameter = naParameter;
cf->has_simple_Inverse= R->cf->has_simple_Inverse;
/* cf->has_simple_Alloc= FALSE; */
if( nCoeff_is_Q(R->cf) )
{
cf->cfClearContent = naClearContent;
cf->cfClearDenominators = naClearDenominators;
}
return FALSE;
}
naInvers
static number naInvers(number a, const coeffs cf)
Definition algext.cc:831
naPower
static void naPower(number a, int exp, number *b, const coeffs cf)
Definition algext.cc:506
naMinpoly
#define naMinpoly
Definition algext.cc:70
naMult
static number naMult(number a, number b, const coeffs cf)
Definition algext.cc:462
naInpMult
static void naInpMult(number &a, number b, const coeffs cf)
Definition algext.cc:472
naRead
static const char * naRead(const char *s, number *a, const coeffs cf)
Definition algext.cc:619
naCoeffIsEqual
static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void *param)
Definition algext.cc:691
naCoeffName
char * naCoeffName(const coeffs r)
Definition algext.cc:1390
naRing
#define naRing
Definition algext.cc:61
naNormalize
static void naNormalize(number &a, const coeffs cf)
Definition algext.cc:755
naDiv
static number naDiv(number a, number b, const coeffs cf)
Definition algext.cc:482
naCoeffWrite
static void naCoeffWrite(const coeffs cf, BOOLEAN details)
Definition algext.cc:379
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_rep_poly
@ n_rep_poly
(poly), see algext.h
Definition coeffs.h:120
p_Test
#define p_Test(p, r)
Definition p_polys.h:161
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## naIsParam()

int naIsParam | ( | number | m,
|  | const coeffs | cf )

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

Definition at line 1151 of file algext.cc.

{
assume((getCoeffType(cf) == n_algExt)||(getCoeffType(cf) == n_polyExt));
const ring R = cf->extRing;
assume( R != NULL );
return p_Var( (poly)m, R );
}
m
int m
Definition cfEzgcd.cc:128
n_polyExt
@ n_polyExt
used to represent polys as coefficients
Definition coeffs.h:34
p_Var
int p_Var(poly m, const ring r)
Definition p_polys.cc:4810

## naSetMap()

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 1077 of file algext.cc.

{
/* dst is expected to be an algebraic field extension */
assume(getCoeffType(dst) == n_algExt);
int h = 0; /* the height of the extension tower given by dst */
coeffs bDst = nCoeff_bottom(dst, h); /* the bottom field in the tower dst */
coeffs bSrc = nCoeff_bottom(src, h); /* the bottom field in the tower src */
/* for the time being, we only provide maps if h = 1 or 0 */
if (h==0)
{
if ((src->rep==n_rep_gap_rat) && nCoeff_is_Q(bDst))
return naMap00; /// Q or Z --> Q(a)
if ((src->rep==n_rep_gap_gmp) && nCoeff_is_Q(bDst))
return naMapZ0; /// Z --> Q(a)
if (nCoeff_is_Zp(src) && nCoeff_is_Q(bDst))
return naMapP0; /// Z/p --> Q(a)
if (nCoeff_is_Q_or_BI(src) && nCoeff_is_Zp(bDst))
return naMap0P; /// Q --> Z/p(a)
if ((src->rep==n_rep_gap_gmp) && nCoeff_is_Zp(bDst))
return naMapZ0; /// Z --> Z/p(a)
if (nCoeff_is_Zp(src) && nCoeff_is_Zp(bDst))
{
if (src->ch == dst->ch) return naMapPP; /// Z/p --> Z/p(a)
else return naMapUP; /// Z/u --> Z/p(a)
}
}
if (h != 1) return NULL;
if ((!nCoeff_is_Zp(bDst)) && (!nCoeff_is_Q(bDst))) return NULL;
if ((!nCoeff_is_Zp(bSrc)) && (!nCoeff_is_Q_or_BI(bSrc))) return NULL;
nMapFunc nMap=n_SetMap(src->extRing->cf,dst->extRing->cf);
if (rSamePolyRep(src->extRing, dst->extRing) && (strcmp(rRingVar(0, src->extRing), rRingVar(0, dst->extRing)) == 0))
{
if (src->type==n_algExt)
return ndCopyMap; // naCopyMap; /// K(a) --> K(a)
else
return naCopyTrans2AlgExt;
}
else if ((nMap!=NULL) && (strcmp(rRingVar(0,src->extRing),rRingVar(0,dst->extRing))==0) && (rVar (src->extRing) == rVar (dst->extRing)))
{
if (src->type==n_algExt)
return naGenMap; // naCopyMap; /// K(a) --> K'(a)
else
return naGenTrans2AlgExt;
}
return NULL; /// default
}
naGenTrans2AlgExt
static number naGenTrans2AlgExt(number a, const coeffs cf, const coeffs dst)
Definition algext.cc:1047
naGenMap
static number naGenMap(number a, const coeffs cf, const coeffs dst)
Definition algext.cc:1032
naMapPP
static number naMapPP(number a, const coeffs src, const coeffs dst)
Definition algext.cc:1011
naMapZ0
static number naMapZ0(number a, const coeffs src, const coeffs dst)
Definition algext.cc:918
naMap0P
static number naMap0P(number a, const coeffs src, const coeffs dst)
Definition algext.cc:998
naCopyTrans2AlgExt
static number naCopyTrans2AlgExt(number a, const coeffs src, const coeffs dst)
Definition algext.cc:950
naMapUP
static number naMapUP(number a, const coeffs src, const coeffs dst)
Definition algext.cc:1021
naMap00
static number naMap00(number a, const coeffs src, const coeffs dst)
Definition algext.cc:908
naMapP0
static number naMapP0(number a, const coeffs src, const coeffs dst)
Definition algext.cc:930
nCoeff_bottom
static coeffs nCoeff_bottom(const coeffs r, int &height)
Definition algext.cc:256
ndCopyMap
number ndCopyMap(number a, const coeffs src, const coeffs dst)
Definition numbers.cc:293
n_SetMap
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:703
nCoeff_is_Q_or_BI
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
Definition coeffs.h:824
nCoeff_is_Zp
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition coeffs.h:795
n_rep_gap_rat
@ n_rep_gap_rat
(number), see longrat.h
Definition coeffs.h:118
n_rep_gap_gmp
@ n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition coeffs.h:119
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
h
STATIC_VAR Poly * h
Definition janet.cc:971
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
rSamePolyRep
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:1805
rRingVar
static char * rRingVar(short i, const ring r)
Definition ring.h:583

## p_ExtGcd()

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 214 of file algext.cc.

{
assume((p != NULL) || (q != NULL));
poly a = p; poly b = q; BOOLEAN aCorrespondsToP = TRUE;
if (p_Deg(a, r) < p_Deg(b, r))
{ a = q; b = p; aCorrespondsToP = FALSE; }
a = p_Copy(a, r); b = p_Copy(b, r);
poly aFactor = NULL; poly bFactor = NULL;
poly theGcd = p_ExtGcdHelper(a, aFactor, b, bFactor, r);
if (aCorrespondsToP) { pFactor = aFactor; qFactor = bFactor; }
else { pFactor = bFactor; qFactor = aFactor; }
return theGcd;
}
p_ExtGcdHelper
static poly p_ExtGcdHelper(poly &p, poly &pFactor, poly &q, poly &qFactor, ring r)
Definition algext.cc:181
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
b
CanonicalForm b
Definition cfModGcd.cc:4111
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848