10 #include "libpolysconfig.h" 17 #include <flint/flint.h> 18 #include <flint/nmod_poly.h> 19 #include <factory/factory.h> 34 static const char*
Eati(
const char *
s,
int *
i)
37 if (((*s) >=
'0') && ((*s) <=
'9'))
45 while (((*s) >=
'0') && ((*s) <=
'9'));
57 Print(
"// coefficients: flint:Z/%d[%s]\n",r->ch,r->pParameterNames[0]);
62 return (r->type==n) &&(r->ch==pp->
ch)
63 &&(r->pParameterNames!=
NULL)
64 &&(strcmp(r->pParameterNames[0],pp->
name)==0);
142 nmod_poly_set_coeff_ui(res,0,i);
151 slong ii=mpz_mod_ui(tmp,i,r->ch);
153 nmod_poly_set_coeff_ui(res,0,ii);
177 mpz_set_ui(result,m);
256 static const char*
Read(
const char * st, number *
a,
const coeffs r)
261 *a=(number)
omAlloc(
sizeof(nmod_poly_t));
264 if (*s==
'-') { neg=
TRUE; s++;}
268 s=
Eati((
char *)s, &z);
271 else if(strncmp(s,r->pParameterNames[0],strlen(r->pParameterNames[0]))==0)
274 s+=strlen(r->pParameterNames[0]);
303 if (ac>bc)
return TRUE;
304 else if (ac<bc)
return FALSE;
392 ii=mpz_mod_ui(tmp,i->z,dst->ch);
395 if (ii<0) ii+=dst->ch;
396 nmod_poly_set_coeff_ui(res,0,ii);
405 WerrorS(
"not yet: ChineseRemainder");
415 nmod_poly_set_coeff_ui(res,1,1);
425 WerrorS(
"not yet: ConvSingNFactoryN");
434 char *
buf=(
char*)
omAlloc(12+10 +strlen(r->pParameterNames[0]));
435 sprintf(buf,
"flintZ(%d,\"%s\")",r->ch,r->pParameterNames[0]);
442 int l=nmod_poly_length(aa);
444 for(
int i=l;
i>=0;
i--)
446 ulong ul=nmod_poly_get_coeff_ui(aa,
i);
447 fprintf(f,
"%lu ", ul);
457 for (
int i=l;
i>=0;
i--)
460 nmod_poly_set_coeff_ui(aa,
i,ul);
537 cf->iNumberOfParameters = 1;
538 char **pn=(
char**)
omAlloc0(
sizeof(
char*));
540 cf->pParameterNames = (
const char **)pn;
541 cf->has_simple_Inverse=
FALSE;
542 cf->has_simple_Alloc=
FALSE;
static void WriteShort(number a, const coeffs r)
static number Mult(number a, number b, const coeffs c)
nmod_poly_init(FLINTmipo, getCharacteristic())
const CanonicalForm int s
static void KillChar(coeffs r)
static number Sub(number a, number b, const coeffs c)
static const char * Read(const char *st, number *a, const coeffs r)
static BOOLEAN DBTest(number a, const char *f, const int l, const coeffs r)
static number Init(long i, const coeffs r)
static void Delete(number *a, const coeffs r)
number nvInvers(number c, const coeffs r)
static number Lcm(number a, number b, const coeffs r)
static number Farey(number p, number n, const coeffs)
static number ExtGcd(number a, number b, number *s, number *t, const coeffs r)
nmod_poly_clear(FLINTmipo)
static long Int(number &n, const coeffs r)
static BOOLEAN IsOne(number a, const coeffs r)
void WerrorS(const char *s)
static BOOLEAN CoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
static number InitMPZ(mpz_t i, const coeffs r)
static const char * Eati(const char *s, int *i)
static number IntMod(number a, number b, const coeffs c)
static number Init_bigint(number i, const coeffs dummy, const coeffs dst)
nmod_poly_struct * nmod_poly_ptr
static number ReadFd(s_buff f, const coeffs r)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static BOOLEAN Greater(number a, number b, const coeffs r)
static char CoeffName_flint_Zn[20]
static int Size(number n, const coeffs r)
static void Normalize(number &a, const coeffs r)
The main handler for Singular numbers which are suitable for Singular polynomials.
int status int void * buf
void StringAppendS(const char *st)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static int ParDeg(number x, const coeffs r)
static void Power(number a, int i, number *result, const coeffs r)
const char *const nDivBy0
static void WriteFd(number a, FILE *f, const coeffs)
static number ChineseRemainder(number *x, number *q, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs)
static void CoeffWrite(const coeffs r, BOOLEAN details)
static BOOLEAN GreaterZero(number k, const coeffs r)
static number Neg(number a, const coeffs r)
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
static number Parameter(const int i, const coeffs r)
static number ConvFactoryNSingN(const CanonicalForm n, const coeffs r)
static BOOLEAN IsZero(number a, const coeffs r)
static char * CoeffName(const coeffs r)
static char * CoeffString(const coeffs r)
long s_readlong(s_buff F)
static BOOLEAN IsMOne(number k, const coeffs r)
static number Add(number a, number b, const coeffs c)
static void MPZ(mpz_t result, number &n, const coeffs r)
static number Div(number a, number b, const coeffs c)
static number Invers(number a, const coeffs r)
static number Gcd(number a, number b, const coeffs r)
static CanonicalForm ConvSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
static void SetChar(const coeffs r)
static number ExactDiv(number a, number b, const coeffs c)
static nMapFunc SetMap(const coeffs src, const coeffs dst)
static number Copy(number a, const coeffs r)
static BOOLEAN Equal(number a, number b, const coeffs r)