Skip to content

Commit

Permalink
minor changes to ParDeg
Browse files Browse the repository at this point in the history
chg: ndParDeg is a static function
add: nfParDef in ffields.cc (GF!)
add: n_ParDeg(ring) wrapper
add: added standard assumes to wrappers for ChineseRemainder, Farey, ParDeg
  • Loading branch information
Oleksandr Motsak committed Mar 17, 2012
1 parent 66b9679 commit da5d779
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Singular/iparith.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4445,7 +4445,7 @@ static BOOLEAN jjPAR1(leftv res, leftv v)
static BOOLEAN jjPARDEG(leftv res, leftv v)
{
number nn=(number)v->Data();
res->data = (char *)(long)n_ParDeg(nn,currRing->cf);
res->data = (char *)(long)n_ParDeg(nn, currRing);
return FALSE;
}
static BOOLEAN jjPARSTR1(leftv res, leftv v)
Expand Down
9 changes: 3 additions & 6 deletions libpolys/coeffs/coeffs.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,20 +629,17 @@ static inline BOOLEAN n_DivBy(number a, number b, const coeffs r)

static inline number n_ChineseRemainder(number *a, number *b, int rl, const coeffs r)
{
assume(r != NULL);
return r->cfChineseRemainder(a,b,rl,r);
assume(r != NULL); assume(r->cfChineseRemainder != NULL); return r->cfChineseRemainder(a,b,rl,r);
}

static inline number n_Farey(number a, number b, const coeffs r)
{
assume(r != NULL);
return r->cfFarey(a,b,r);
assume(r != NULL); assume(r->cfFarey != NULL); return r->cfFarey(a,b,r);
}

static inline int n_ParDeg(number n, const coeffs r)
{
assume(r != NULL);
return r->cfParDeg(n,r);
assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r);
}

/// Returns the number of parameters
Expand Down
5 changes: 3 additions & 2 deletions libpolys/coeffs/ffields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ BOOLEAN nfGreaterZero (number k, const coeffs r);
number nfMult (number a, number b, const coeffs r);
number nfInit (long i, const coeffs r);
number nfParameter (int i, const coeffs r);
int nfParDeg (number n, const coeffs r);
int nfInt (number &n, const coeffs r);
number nfAdd (number a, number b, const coeffs r);
number nfSub (number a, number b, const coeffs r);
Expand Down Expand Up @@ -236,7 +235,7 @@ number nfParameter (int i, const coeffs)
/*2
* the degree of the "alg. number"
*/
int nfParDeg(number n, const coeffs r)
static int nfParDeg(number n, const coeffs r)
{
#ifdef LDEBUG
nfTest(n, r);
Expand Down Expand Up @@ -883,6 +882,8 @@ BOOLEAN nfInitChar(coeffs r, void * parameter)
//r->cfName = ndName;
// debug stuff
r->cfCoeffWrite=nfCoeffWrite;

r->cfParDeg = nfParDeg;

#ifdef LDEBUG
r->cfDBTest=nfDBTest;
Expand Down
2 changes: 1 addition & 1 deletion libpolys/coeffs/numbers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ number ndChineseRemainder(number *,number *,int,const coeffs r)
return n_Init(0,r);
}

int ndParDeg(number n, const coeffs r)
static int ndParDeg(number n, const coeffs r)
{
return (-n_IsZero(n,r));
}
Expand Down
12 changes: 6 additions & 6 deletions libpolys/polys/OBSOLETE_pInitContent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void p_Content(poly ph, const ring r)
}
}

void pSimpleContent(poly ph,int smax)
void pSimpleContent(poly ph,int smax) // in currRing!
{
//if(TEST_OPT_CONTENTSB) return;
if (ph==NULL) return;
Expand Down Expand Up @@ -227,7 +227,7 @@ void pSimpleContent(poly ph,int smax)
nlDelete(&h,currRing);
}

number pInitContent(poly ph)
number pInitContent(poly ph) // in currRing!
// only for coefficients in Q
#if 0
{
Expand Down Expand Up @@ -312,12 +312,12 @@ number pInitContent(poly ph)
}
#endif

number pInitContent_a(poly ph)
number pInitContent_a(poly ph) // in currRing!
// only for coefficients in K(a) anf K(a,...)
{
number d=pGetCoeff(ph);
int s=naParDeg(d);
if (s /* naParDeg(d)*/ <=1) return naCopy(d);
int s=n_ParDeg(d, currRing);
if (s /* n_ParDeg(d, currRing)*/ <=1) return naCopy(d);
int s2=-1;
number d2;
int ss;
Expand All @@ -329,7 +329,7 @@ number pInitContent_a(poly ph)
if (s2==-1) return naCopy(d);
break;
}
if ((ss=naParDeg(pGetCoeff(ph)))<s)
if ((ss=n_ParDeg(pGetCoeff(ph), currRing))<s)
{
s2=s;
d2=d;
Expand Down
2 changes: 1 addition & 1 deletion libpolys/polys/coeffrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ static inline number n_GetUnit(number n, const ring r){ return n_GetUnit(n, r->c
static inline BOOLEAN n_DivBy(number a, number b, const ring r){ return n_DivBy(a,b, r->cf);}
#endif


static inline int n_ParDeg(number n, const ring r){ assume(r != NULL); assume(r->cf != NULL); return n_ParDeg(n,r->cf); }

#endif /* COEFFRINGS_H */
2 changes: 1 addition & 1 deletion libpolys/polys/ext_fields/algext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ nMapFunc naSetMap(const coeffs src, const coeffs dst)
return NULL; /// default
}

int naParDeg(number a, const coeffs cf)
static int naParDeg(number a, const coeffs cf)
{
if (a == NULL) return -1;
poly aa=(poly)a;
Expand Down
2 changes: 1 addition & 1 deletion libpolys/polys/ext_fields/transext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ CanonicalForm ntConvSingNFactoryN( number n, BOOLEAN setChar, const coeffs cf )
}
#endif

int ntParDeg(number a, const coeffs cf)
static int ntParDeg(number a, const coeffs cf)
{
if (IS0(a)) return -1;
fraction fa = (fraction)a;
Expand Down

0 comments on commit da5d779

Please sign in to comment.