Loading...
Searching...
No Matches
flintcf_Q.cc
Go to the documentation of this file.
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: flint: fmpq_poly
*/
#include <ctype.h> /* isdigit*/
#include "misc/auxiliary.h"
#ifdef HAVE_FLINT
#include <gmp.h>
#include <flint/flint.h>
#include <flint/fmpz.h>
#include <flint/fmpq.h>
#include <flint/fmpq_poly.h>
#include "factory/factory.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "coeffs/longrat.h"
typedef fmpq_poly_struct *fmpq_poly_ptr;
typedef fmpz *fmpz_ptr;
/*2
* extracts a long integer from s, returns the rest
*/
static char * nlEatLong(char *s, mpz_ptr i)
{
const char * start=s;
while (*s >= '0' && *s <= '9') s++;
if (*s=='\0')
{
mpz_set_str(i,start,10);
}
else
{
char c=*s;
*s='\0';
mpz_set_str(i,start,10);
*s=c;
}
return s;
}
static BOOLEAN CoeffIsEqual(const coeffs r, n_coeffType n, void *)
{
return (r->type==n);
}
static void SetChar(const coeffs)
{
// dummy
}
static number Mult(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_mul(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
static number Sub(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_sub(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
static number Add(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_add(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
static number Div(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
if(fmpq_poly_is_zero((fmpq_poly_ptr)b))
{
WerrorS(nDivBy0);
}
else
{
fmpq_poly_div(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
fmpq_poly_t mod;
fmpq_poly_init(mod);
fmpq_poly_rem(mod,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
if (!fmpq_poly_is_zero((fmpq_poly_ptr)mod))
{
WerrorS("cannot divide");
}
fmpq_poly_clear(mod);
}
return (number)res;
}
static number ExactDiv(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
if(fmpq_poly_is_zero((fmpq_poly_ptr)b))
{
WerrorS(nDivBy0);
}
else
fmpq_poly_div(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
#if 0
static number IntMod(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_rem(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
#endif
static number Init (long i, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_set_si(res,i);
return (number)res;
}
static number InitMPZ (mpz_t i, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_fit_length(res, 1);
fmpz_set_mpz(res->coeffs, i);
fmpz_one(res->den);
_fmpq_poly_set_length(res, 1);
_fmpq_poly_normalise(res);
return (number)res;
}
static int Size (number n, const coeffs)
{
return fmpq_poly_degree((fmpq_poly_ptr)n);
}
static long Int (number &n, const coeffs)
{
if (fmpq_poly_degree((fmpq_poly_ptr)n)==0)
{
fmpq_t m;
fmpq_init(m);
fmpq_poly_get_coeff_fmpq(m,(fmpq_poly_ptr)n,0);
long nl=fmpz_get_si(fmpq_numref(m));
if (fmpz_cmp_si(fmpq_numref(m),nl)!=0) nl=0;
long dl=fmpz_get_si(fmpq_denref(m));
if ((dl!=1)||(fmpz_cmp_si(fmpq_denref(m),dl)!=0)) nl=0;
fmpq_clear(m);
return nl;
}
return 0;
}
static void MPZ(mpz_t result, number &n, const coeffs)
{
mpz_init(result);
if (fmpq_poly_degree((fmpq_poly_ptr)n)==0)
{
#if __FLINT_RELEASE >= 20503
fmpq_t m;
fmpq_init(m);
fmpq_poly_get_coeff_fmpq(m,(fmpq_poly_ptr)n,0);
mpz_t den;
mpz_init(den);
fmpq_get_mpz_frac(result,den,m);
int dl=(int)mpz_get_si(den);
if ((dl!=1)||(mpz_cmp_si(den,(long)dl)!=0)) mpz_set_ui(result,0);
mpz_clear(den);
fmpq_clear(m);
#else
mpq_t m;
mpq_init(m);
fmpq_poly_get_coeff_mpq(m,(fmpq_poly_ptr)n,0);
mpz_t den;
mpz_init(den);
mpq_get_num(result,m);
mpq_get_den(den,m);
int dl=(int)mpz_get_si(den);
if ((dl!=1)||(mpz_cmp_si(den,(long)dl)!=0)) mpz_set_ui(result,0);
mpz_clear(den);
mpq_clear(m);
#endif
}
}
static number Neg(number a, const coeffs)
{
fmpq_poly_neg((fmpq_poly_ptr)a,(fmpq_poly_ptr)a);
return a;
}
static number Invers(number a, const coeffs)
{
if(fmpq_poly_is_zero((fmpq_poly_ptr)a))
{
WerrorS(nDivBy0);
return NULL;
}
if (fmpq_poly_degree((fmpq_poly_ptr)a)==0)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_inv(res,(fmpq_poly_ptr)a);
return (number)res;
}
else
{
WerrorS("not invertable");
return NULL;
}
}
static number Copy(number a, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_set(res,(fmpq_poly_ptr)a);
return (number)res;
}
//static number RePart(number a, const coeffs)
//{
//}
//static number ImPart(number a, const coeffs)
//{
//}
static BOOLEAN IsOne (number a, const coeffs);
static BOOLEAN IsZero (number a, const coeffs);
//static void WriteLong(number &a, const coeffs)
//{
//}
static void WriteShort(number a, const coeffs r)
{
//fmpq_poly_print_pretty((fmpq_poly_ptr)a,r->pParameterNames[0]);
if (IsOne(a,r)) StringAppendS("1");
else if (IsZero(a,r)) StringAppendS("0");
else
{
StringAppendS("(");
#if __FLINT_RELEASE >= 20503
fmpq_t m;
fmpq_init(m);
BOOLEAN need_plus=FALSE;
for(int i=fmpq_poly_length((fmpq_poly_ptr)a);i>=0;i--)
{
fmpq_poly_get_coeff_fmpq(m,(fmpq_poly_ptr)a,i);
if (!fmpq_is_zero(m))
{
if (need_plus && (fmpq_cmp_ui(m,0)>0))
StringAppendS("+");
need_plus=TRUE;
int l=fmpz_sizeinbase(fmpq_numref(m),10);
l=si_max(l,(int)fmpz_sizeinbase(fmpq_denref(m),10));
l+=2;
char *s=(char*)omAlloc(l);
char *z=fmpz_get_str(s,10,fmpq_numref(m));
if ((i==0)
||(fmpz_cmp_si(fmpq_numref(m),1)!=0)
||(fmpz_cmp_si(fmpq_denref(m),1)!=0))
{
StringAppendS(z);
if (fmpz_cmp_si(fmpq_denref(m),1)!=0)
{
StringAppendS("/");
z=fmpz_get_str(s,10,fmpq_denref(m));
StringAppendS(z);
}
if (i!=0) StringAppendS("*");
}
if (i>1)
StringAppend("%s^%d",r->pParameterNames[0],i);
else if (i==1)
StringAppend("%s",r->pParameterNames[0]);
}
}
fmpq_clear(m);
#else
mpq_t m;
mpq_init(m);
mpz_t num,den;
mpz_init(num);
mpz_init(den);
BOOLEAN need_plus=FALSE;
for(int i=fmpq_poly_length((fmpq_poly_ptr)a);i>=0;i--)
{
fmpq_poly_get_coeff_mpq(m,(fmpq_poly_ptr)a,i);
mpq_get_num(num,m);
mpq_get_den(den,m);
if (mpz_sgn1(num)!=0)
{
if (need_plus && (mpz_sgn1(num)>0))
StringAppendS("+");
need_plus=TRUE;
int l=mpz_sizeinbase(num,10);
l=si_max(l,(int)mpz_sizeinbase(den,10));
l+=2;
char *s=(char*)omAlloc(l);
char *z=mpz_get_str(s,10,num);
if ((i==0)
||(mpz_cmp_si(num,1)!=0)
||(mpz_cmp_si(den,1)!=0))
{
StringAppendS(z);
if (mpz_cmp_si(den,1)!=0)
{
StringAppendS("/");
z=mpz_get_str(s,10,den);
StringAppendS(z);
}
if (i!=0) StringAppendS("*");
}
if (i>1)
StringAppend("%s^%d",r->pParameterNames[0],i);
else if (i==1)
StringAppend("%s",r->pParameterNames[0]);
}
}
mpz_clear(den);
mpz_clear(num);
mpq_clear(m);
#endif
StringAppendS(")");
}
}
static const char* Read(const char * st, number * a, const coeffs r)
{
// we only read "monomials" (i.e. [-][digits][parameter]),
// everything else (+,*,^,()) is left to the singular interpreter
char *s=(char *)st;
*a=(number)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init((fmpq_poly_ptr)(*a));
BOOLEAN neg=FALSE;
if (*s=='-') { neg=TRUE; s++;}
if (isdigit(*s))
{
mpz_t z;
mpz_init(z);
fmpz_t z1;
fmpz_init(z1);
s=nlEatLong((char *)s, z);
fmpz_set_mpz(z1,z);
fmpq_poly_set_fmpz((fmpq_poly_ptr)(*a),z1);
if (*s == '/')
{
s++;
s=nlEatLong((char *)s, z);
fmpz_set_mpz(z1,z);
fmpq_poly_scalar_div_fmpz((fmpq_poly_ptr)(*a),(fmpq_poly_ptr)(*a),z1);
}
fmpz_clear(z1);
mpz_clear(z);
}
else if(strncmp(s,r->pParameterNames[0],strlen(r->pParameterNames[0]))==0)
{
fmpq_poly_set_coeff_si((fmpq_poly_ptr)(*a),1,1);
s+=strlen(r->pParameterNames[0]);
if(isdigit(*s))
{
int i=1;
s=nEati(s,&i,0);
if (i!=1)
{
fmpq_poly_set_coeff_si((fmpq_poly_ptr)(*a),1,0);
fmpq_poly_set_coeff_si((fmpq_poly_ptr)(*a),i,1);
}
}
}
if (neg)
fmpq_poly_neg((fmpq_poly_ptr)(*a),(fmpq_poly_ptr)(*a));
return s;
}
static void Normalize(number &a, const coeffs)
{
fmpq_poly_canonicalise((fmpq_poly_ptr)a);
}
static BOOLEAN Greater (number a, number b, const coeffs)
{
return (fmpq_poly_cmp((fmpq_poly_ptr)a,(fmpq_poly_ptr)b)>0);
}
static BOOLEAN Equal (number a, number b, const coeffs)
{
return (fmpq_poly_equal((fmpq_poly_ptr)a,(fmpq_poly_ptr)b));
}
static BOOLEAN IsZero (number a, const coeffs)
{
return fmpq_poly_is_zero((fmpq_poly_ptr)a);
}
static BOOLEAN IsOne (number a, const coeffs)
{
return fmpq_poly_is_one((fmpq_poly_ptr)a);
}
static BOOLEAN IsMOne (number k, const coeffs)
{
if (fmpq_poly_length((fmpq_poly_ptr)k)>0) return FALSE;
fmpq_poly_canonicalise((fmpq_poly_ptr)k);
fmpq_t m;
fmpq_init(m);
fmpq_poly_get_coeff_fmpq(m,(fmpq_poly_ptr)k,0);
BOOLEAN result=TRUE;
if (fmpz_cmp_si(fmpq_numref(m),(long)-1)!=0) result=FALSE;
else
{
int dl=(int)fmpz_get_si(fmpq_denref(m));
if ((dl!=1)||(fmpz_cmp_si(fmpq_denref(m),(long)dl)!=0)) result=FALSE;
}
fmpq_clear(m);
return (result);
}
static BOOLEAN GreaterZero (number, const coeffs)
{
// does it have a leading sign?
// no: 0 and 1 do not have, everything else is in (...)
return TRUE;
}
static void Power(number a, int i, number * result, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
*result=(number)res;
fmpq_poly_pow((fmpq_poly_ptr)(*result),(fmpq_poly_ptr)a,i);
}
static number GetDenom(number &n, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpz_ptr den=fmpq_poly_denref((fmpq_poly_ptr)n);
fmpq_poly_set_fmpz(res,den);
return (number)res;
}
static number GetNumerator(number &n, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_set(res,(fmpq_poly_ptr)n);
fmpz_ptr den=fmpq_poly_denref(res);
fmpq_poly_scalar_mul_fmpz(res,res,den);
return (number)res;
}
static number Gcd(number a, number b, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_gcd(res,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
static number ExtGcd(number a, number b, number *s, number *t,const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_init((fmpq_poly_ptr)*s);
fmpq_poly_init((fmpq_poly_ptr)*t);
fmpq_poly_xgcd(res,(fmpq_poly_ptr)*s,(fmpq_poly_ptr)*t,(fmpq_poly_ptr)a,(fmpq_poly_ptr)b);
return (number)res;
}
static number Lcm(number, number, const coeffs)
{
WerrorS("not yet: Lcm");
return NULL;
}
static void Delete(number * a, const coeffs)
{
if ((*a)!=NULL)
{
fmpq_poly_clear((fmpq_poly_ptr)*a);
omFree(*a);
*a=NULL;
}
}
static nMapFunc SetMap(const coeffs, const coeffs)
{
WerrorS("not yet: SetMap");
return NULL;
}
//static void InpMult(number &a, number b, const coeffs)
//{
//}
//static void InpAdd(number &a, number b, const coeffs)
//{
//}
#if 0
static number Init_bigint(number i, const coeffs, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
if (SR_HDL(i) & SR_INT)
{
fmpq_poly_set_si(res,SR_TO_INT(i));
}
else
fmpq_poly_set_mpz(res,i->z);
return (number)res;
}
#endif
static number Farey(number, number, const coeffs)
{
WerrorS("not yet: Farey");
return NULL;
}
static number ChineseRemainder(number *, number *,int , BOOLEAN ,CFArray &,const coeffs)
{
WerrorS("not yet: ChineseRemainder");
return NULL;
}
static int ParDeg(number x,const coeffs)
{
return fmpq_poly_degree((fmpq_poly_ptr)x);
}
static number Parameter(const int, const coeffs)
{
fmpq_poly_ptr res=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(res);
fmpq_poly_set_coeff_si(res,1,1);
return (number)res;
}
static void WriteFd(number a, const ssiInfo *d, const coeffs)
{
// format: len a_len(num den) .. a_0
fmpq_poly_ptr aa=(fmpq_poly_ptr)a;
int l=fmpq_poly_length(aa);
fprintf(d->f_write,"%d ",l);
#if __FLINT_RELEASE >= 20503
fmpq_t m;
fmpq_init(m);
mpz_t num,den;
mpz_init(num);
mpz_init(den);
for(int i=l; i>=0; i--)
{
fmpq_poly_get_coeff_fmpq(m,(fmpq_poly_ptr)a,i);
fmpq_get_mpz_frac(num,den,m);
mpz_out_str (d->f_write,SSI_BASE, num);
fputc(' ',d->f_write);
mpz_out_str (d->f_write,SSI_BASE, den);
fputc(' ',d->f_write);
}
mpz_clear(den);
mpz_clear(num);
fmpq_clear(m);
#else
mpq_t m;
mpq_init(m);
mpz_t num,den;
mpz_init(num);
mpz_init(den);
for(int i=l; i>=0; i--)
{
fmpq_poly_get_coeff_mpq(m,(fmpq_poly_ptr)a,i);
mpq_get_num(num,m);
mpq_get_den(den,m);
mpz_out_str (d->f_write,SSI_BASE, num);
fputc(' ',d->f_write);
mpz_out_str (d->f_write,SSI_BASE, den);
fputc(' ',d->f_write);
}
mpz_clear(den);
mpz_clear(num);
mpq_clear(m);
#endif
}
static number ReadFd(const ssiInfo *d, const coeffs)
{
// format: len a_len .. a_0
fmpq_poly_ptr aa=(fmpq_poly_ptr)omAlloc(sizeof(fmpq_poly_t));
fmpq_poly_init(aa);
int l=s_readint(d->f_read);
mpz_t tmp;
mpz_init(tmp);
fmpq_t m;
fmpq_init(m);
fmpz_t num,den;
fmpz_init(num);
fmpz_init(den);
for (int i=l;i>=0;i--)
{
s_readmpz_base (d->f_read,tmp, SSI_BASE);
fmpz_set_mpz(num, tmp);
s_readmpz_base (d->f_read,tmp, SSI_BASE);
fmpz_set_mpz(den, tmp);
fmpq_set_fmpz_frac(m,num,den);
fmpq_poly_set_coeff_fmpq(aa,i,m);
}
mpz_clear(tmp);
fmpz_clear(den);
fmpz_clear(num);
fmpq_clear(m);
return (number)aa;
}
// cfClearContent
// cfClearDenominators
static number ConvFactoryNSingN( const CanonicalForm, const coeffs)
{
WerrorS("not yet: ConvFactoryNSingN");
return NULL;
}
static CanonicalForm ConvSingNFactoryN( number, BOOLEAN, const coeffs )
{
WerrorS("not yet: ConvSingNFactoryN");
return CanonicalForm(0);
}
char * CoeffName(const coeffs r)
{
STATIC_VAR char CoeffName_flint_Q[20];
snprintf(CoeffName_flint_Q,20,"flintQp[%s]",r->pParameterNames[0]);
return (char*)CoeffName_flint_Q;
}
coeffs flintQInitCfByName(char *s,n_coeffType n)
{
const char start[]="flintQp[";
const int start_len=strlen(start);
if (strncmp(s,start,start_len)==0)
{
s+=start_len;
char st[10];
int l=sscanf(s,"%s",st);
if (l==1)
{
while (st[strlen(st)-1]==']') st[strlen(st)-1]='\0';
return nInitChar(n,(void*)st);
}
}
return NULL;
}
#ifdef LDEBUG
static BOOLEAN DBTest(number, const char *, const int, const coeffs)
{
return TRUE;
}
#endif
static void KillChar(coeffs cf)
{
omFree((ADDRESS)(cf->pParameterNames[0]));
omFreeSize(cf->pParameterNames,sizeof(char*));
}
BOOLEAN flintQ_InitChar(coeffs cf, void * infoStruct)
{
char *pp=(char*)infoStruct;
cf->cfCoeffName = CoeffName;
cf->nCoeffIsEqual = CoeffIsEqual;
cf->cfKillChar = KillChar;
cf->cfSetChar = SetChar;
cf->ch=0; //char 0
cf->cfMult = Mult;
cf->cfSub = Sub;
cf->cfAdd = Add;
cf->cfDiv = Div;
cf->cfExactDiv = ExactDiv; // ???
cf->cfInit =Init;
cf->cfInitMPZ =InitMPZ;
cf->cfSize = Size;
cf->cfInt = Int;
cf->cfMPZ = MPZ;
cf->cfInpNeg = Neg;
cf->cfInvers = Invers;
cf->cfCopy = Copy;
cf->cfRePart = Copy;
// default: cf->cfImPart = ndReturn0;
cf->cfWriteLong = WriteShort; //WriteLong;
cf->cfWriteShort = WriteShort;
cf->cfRead = Read;
cf->cfNormalize = Normalize;
//cf->cfDivComp=
//cf->cfIsUnit=
//cf->cfGetUnit=
//cf->cfDivBy=
cf->cfGreater=Greater;
cf->cfEqual =Equal;
cf->cfIsZero =IsZero;
cf->cfIsOne =IsOne;
cf->cfIsMOne =IsMOne;
cf->cfGreaterZero=GreaterZero;
cf->cfPower = Power;
cf->cfGetDenom = GetDenom;
cf->cfGetNumerator = GetNumerator;
cf->cfGcd = Gcd;
cf->cfExtGcd = ExtGcd;
cf->cfLcm = Lcm;
cf->cfDelete = Delete;
cf->cfSetMap = SetMap;
// default: cf->cfInpMult
// default: cf->cfInpAdd
cf->cfFarey =Farey;
cf->cfChineseRemainder=ChineseRemainder;
cf->cfParDeg = ParDeg;
cf->cfParameter = Parameter;
// cf->cfClearContent = ClearContent;
// cf->cfClearDenominators = ClearDenominators;
cf->convFactoryNSingN=ConvFactoryNSingN;
cf->convSingNFactoryN=ConvSingNFactoryN;
cf->cfWriteFd = WriteFd;
cf->cfReadFd = ReadFd;
#ifdef LDEBUG
cf->cfDBTest = DBTest;
#endif
cf->iNumberOfParameters = 1;
char **pn=(char**)omAlloc0(sizeof(char*));
pn[0]=omStrDup(pp);
cf->pParameterNames = (const char **)pn;
cf->has_simple_Inverse= FALSE;
cf->has_simple_Alloc= FALSE;
cf->is_field=FALSE;
return FALSE;
}
#endif
auxiliary.h
All the auxiliary stuff.
SSI_BASE
#define SSI_BASE
Definition auxiliary.h:136
si_max
static int si_max(const int a, const int b)
Definition auxiliary.h:125
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
mod
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
CFArray
Array< CanonicalForm > CFArray
Definition canonicalform.h:397
num
CanonicalForm num(const CanonicalForm &f)
Definition canonicalform.h:337
den
CanonicalForm den(const CanonicalForm &f)
Definition canonicalform.h:340
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
x
Variable x
Definition cfModGcd.cc:4090
cf
CanonicalForm cf
Definition cfModGcd.cc:4091
b
CanonicalForm b
Definition cfModGcd.cc:4111
CanonicalForm
factory's main class
Definition canonicalform.h:86
coeffs.h
Coefficient rings, fields and other domains suitable for Singular polynomials.
n_coeffType
n_coeffType
Definition coeffs.h:27
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
StringAppend
#define StringAppend
Definition emacs.cc:79
result
return result
Definition facAbsBiFact.cc:76
s
const CanonicalForm int s
Definition facAbsFact.cc:51
res
CanonicalForm res
Definition facAbsFact.cc:60
factory.h
factory.h' is the user interface to Factory.
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
ExtGcd
static number ExtGcd(number a, number b, number *s, number *t, const coeffs)
Definition flintcf_Q.cc:447
WriteShort
static void WriteShort(number a, const coeffs r)
Definition flintcf_Q.cc:233
Copy
static number Copy(number a, const coeffs)
Definition flintcf_Q.cc:215
ChineseRemainder
static number ChineseRemainder(number *, number *, int, BOOLEAN, CFArray &, const coeffs)
Definition flintcf_Q.cc:500
Normalize
static void Normalize(number &a, const coeffs)
Definition flintcf_Q.cc:373
SetChar
static void SetChar(const coeffs)
Definition flintcf_Q.cc:53
SetMap
static nMapFunc SetMap(const coeffs, const coeffs)
Definition flintcf_Q.cc:470
Farey
static number Farey(number, number, const coeffs)
Definition flintcf_Q.cc:495
GetDenom
static number GetDenom(number &n, const coeffs)
Definition flintcf_Q.cc:423
Read
static const char * Read(const char *st, number *a, const coeffs r)
Definition flintcf_Q.cc:326
IsOne
static BOOLEAN IsOne(number a, const coeffs)
Definition flintcf_Q.cc:389
CoeffName
char * CoeffName(const coeffs r)
Definition flintcf_Q.cc:601
ConvFactoryNSingN
static number ConvFactoryNSingN(const CanonicalForm, const coeffs)
Definition flintcf_Q.cc:591
flintQ_InitChar
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition flintcf_Q.cc:636
fmpq_poly_ptr
fmpq_poly_struct * fmpq_poly_ptr
Definition flintcf_Q.cc:25
InitMPZ
static number InitMPZ(mpz_t i, const coeffs)
Definition flintcf_Q.cc:128
Size
static int Size(number n, const coeffs)
Definition flintcf_Q.cc:139
Add
static number Add(number a, number b, const coeffs)
Definition flintcf_Q.cc:71
Div
static number Div(number a, number b, const coeffs)
Definition flintcf_Q.cc:78
WriteFd
static void WriteFd(number a, const ssiInfo *d, const coeffs)
Definition flintcf_Q.cc:516
fmpz_ptr
fmpz * fmpz_ptr
Definition flintcf_Q.cc:26
flintQInitCfByName
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition flintcf_Q.cc:608
Delete
static void Delete(number *a, const coeffs)
Definition flintcf_Q.cc:461
Parameter
static number Parameter(const int, const coeffs)
Definition flintcf_Q.cc:509
DBTest
static BOOLEAN DBTest(number, const char *, const int, const coeffs)
Definition flintcf_Q.cc:626
KillChar
static void KillChar(coeffs cf)
Definition flintcf_Q.cc:631
ConvSingNFactoryN
static CanonicalForm ConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition flintcf_Q.cc:596
Init
static number Init(long i, const coeffs)
Definition flintcf_Q.cc:121
MPZ
static void MPZ(mpz_t result, number &n, const coeffs)
Definition flintcf_Q.cc:159
ReadFd
static number ReadFd(const ssiInfo *d, const coeffs)
Definition flintcf_Q.cc:561
ExactDiv
static number ExactDiv(number a, number b, const coeffs)
Definition flintcf_Q.cc:100
Power
static void Power(number a, int i, number *result, const coeffs)
Definition flintcf_Q.cc:416
IsMOne
static BOOLEAN IsMOne(number k, const coeffs)
Definition flintcf_Q.cc:393
Sub
static number Sub(number a, number b, const coeffs)
Definition flintcf_Q.cc:64
GetNumerator
static number GetNumerator(number &n, const coeffs)
Definition flintcf_Q.cc:431
GreaterZero
static BOOLEAN GreaterZero(number, const coeffs)
Definition flintcf_Q.cc:410
Gcd
static number Gcd(number a, number b, const coeffs)
Definition flintcf_Q.cc:440
CoeffIsEqual
static BOOLEAN CoeffIsEqual(const coeffs r, n_coeffType n, void *)
Definition flintcf_Q.cc:49
Mult
static number Mult(number a, number b, const coeffs)
Definition flintcf_Q.cc:57
Invers
static number Invers(number a, const coeffs)
Definition flintcf_Q.cc:195
Lcm
static number Lcm(number, number, const coeffs)
Definition flintcf_Q.cc:456
ParDeg
static int ParDeg(number x, const coeffs)
Definition flintcf_Q.cc:505
IsZero
static BOOLEAN IsZero(number a, const coeffs)
Definition flintcf_Q.cc:385
Neg
static number Neg(number a, const coeffs)
Definition flintcf_Q.cc:190
Equal
static BOOLEAN Equal(number a, number b, const coeffs)
Definition flintcf_Q.cc:381
Greater
static BOOLEAN Greater(number a, number b, const coeffs)
Definition flintcf_Q.cc:377
Int
static long Int(number &n, const coeffs)
Definition flintcf_Q.cc:143
nlEatLong
static char * nlEatLong(char *s, mpz_ptr i)
Definition flintcf_Q.cc:30
Init_bigint
static number Init_bigint(number i, const coeffs dummy, const coeffs dst)
Definition flintcf_Zn.cc:369
IntMod
static number IntMod(number a, number b, const coeffs c)
Definition flintcf_Zn.cc:118
STATIC_VAR
#define STATIC_VAR
Definition globaldefs.h:7
Greater
static bool Greater(mono_type m1, mono_type m2)
Definition interpolation.cc:285
longrat.h
SR_INT
#define SR_INT
Definition longrat.h:67
SR_TO_INT
#define SR_TO_INT(SR)
Definition longrat.h:69
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
nEati
char * nEati(char *s, int *i, int m)
divide by the first (leading) number and return it, i.e. make monic
Definition numbers.cc:672
numbers.h
nDivBy0
const char *const nDivBy0
Definition numbers.h:90
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107
s_readmpz_base
void s_readmpz_base(s_buff F, mpz_ptr a, int base)
Definition s_buff.cc:264
s_readint
int s_readint(s_buff F)
Definition s_buff.cc:113
ssiInfo::f_read
s_buff f_read
Definition s_buff.h:22
ssiInfo::f_write
FILE * f_write
Definition s_buff.h:23
ssiInfo
Definition s_buff.h:21
mpz_sgn1
#define mpz_sgn1(A)
Definition si_gmp.h:18
SR_HDL
#define SR_HDL(A)
Definition tgb.cc:35