15#if __FLINT_RELEASE >= 20500
50#if __FLINT_RELEASE > 20502
71#if __FLINT_RELEASE > 20502
82 fmpq_get_mpz_frac(a,
b,
f);
83 if (mpz_cmp_si(
b,1L)!=0)
109#if __FLINT_RELEASE > 20502
116 fmpz_get_mpz((mpz_ptr)z,
f);
122 long i=fmpz_get_si(
f);
143#if __FLINT_RELEASE > 20502
144 if (fmpz_is_one(fmpq_denref(
f)))
146 if (fmpz_fits_si(fmpq_numref(
f)))
148 long i=fmpz_get_si(fmpq_numref(
f));
157 if (fmpz_is_one(fmpq_denref(
f)))
160 fmpz_get_mpz(z->z,fmpq_numref(
f));
166 fmpq_get_mpz_frac(z->z,z->n,
f);
184 fmpz_set_mpz(
f,(mpz_ptr)n);
196 fmpz_set_mpz(fmpq_numref(
f), n->z);
197 fmpz_set_mpz(fmpq_denref(
f), n->n);
201 fmpz_set_mpz(fmpq_numref(
f), n->z);
202 fmpz_set_si(fmpq_denref(
f), 1);
211 number nn=nMap(n,
cf,QQ);
225 fmpz_set_mpz(fmpq_numref(
f), n->z);
226 fmpz_set_mpz(fmpq_denref(
f), n->n);
231 mpz_init_set_si(one,1);
232 fmpz_set_mpz(fmpq_numref(
f), n->z);
233 fmpz_set_mpz(fmpq_denref(
f), one);
256 fmpq_poly_init2(
res,d+1);
257 _fmpq_poly_set_length (
res, d + 1);
272 fmpq_poly_init2(
res,d+1);
273 _fmpq_poly_set_length (
res, d + 1);
288 if (fmpq_poly_is_zero(
f))
return NULL;
289 int d=fmpq_poly_length(
f);
293 for(
int i=0;
i<=d;
i++)
295 fmpq_poly_get_coeff_fmpq(c,
f,
i);
311void convSingPFlintnmod_poly_t(nmod_poly_t
result,
const poly
p,
const ring r)
319 nmod_poly_set_coeff_ui(
result,0,0);
326void convSingMFlintFq_nmod_mat(
matrix m, fq_nmod_mat_t
M,
const fq_nmod_ctx_t
fq_con,
const ring r)
334 convSingPFlintnmod_poly_t (
M->rows[
i-1]+
j-1,
MATELEM(
m,
i,
j),r);
339poly convFlintFq_nmodSingP(
const fq_nmod_t Fp,
const fq_nmod_ctx_t ctx,
const ring r)
343 for (
int i= 0;
i < nmod_poly_length (Fp);
i++)
345 ulong coeff= nmod_poly_get_coeff_ui (Fp,
i);
358matrix convFlintFq_nmod_matSingM(fq_nmod_mat_t
m,
const fq_nmod_ctx_t
fq_con,
const ring r)
366 MATELEM(
M,
i,
j)=convFlintFq_nmodSingP(fq_nmod_mat_entry (
m,
i-1,
j-1),
411 fmpq_mat_init(FLINTM,r,c);
424 WerrorS(
"matrix for rref is not constant");
430 fmpq_mat_rref(FLINTM,FLINTM);
439 fmpq_mat_clear(FLINTM);
447 long rk= nmod_mat_rref (FLINTM);
450 nmod_mat_clear(FLINTM);
454 WerrorS(
"not implemented for these coefficients");
468 fmpq_mat_init(FLINTM,r,c);
479 WerrorS(
"smatrix for rref is not constant");
485 fmpq_mat_rref(FLINTM,FLINTM);
499 fmpq_mat_clear(FLINTM);
504 nmod_mat_init(FLINTM,r,c,
rChar(
R));
515 WerrorS(
"smatrix for rref is not constant");
521 nmod_mat_rref(FLINTM);
526 number n=
n_Init(nmod_mat_entry(FLINTM,
i-1,
j),
R->cf);
535 nmod_mat_clear(FLINTM);
539 WerrorS(
"not implemented for these coefficients");
555 long rk= nmod_mat_nullspace(FLINTX,FLINTM);
556 nmod_mat_clear(FLINTM);
559 nmod_mat_clear(FLINTX);
563 WerrorS(
"not implemented for these coefficients");
578 nmod_mat_init(FLINTM,r,c,
rChar(
R));
579 nmod_mat_init(FLINTX,r,c,
rChar(
R));
590 WerrorS(
"smatrix for rref is not constant");
596 nmod_mat_nullspace(FLINTX,FLINTM);
597 nmod_mat_clear(FLINTM);
602 number n=
n_Init(nmod_mat_entry(FLINTX,
i-1,
j),
R->cf);
611 nmod_mat_clear(FLINTX);
615 WerrorS(
"not implemented for these coefficients");
625 fmpz_mat_t
M, Transf;
626 fmpz_mat_init(
M, r, c);
629 fmpz_mat_init(Transf,
T->rows(),
T->rows());
641 fmpz_set(fmpz_mat_entry(
M,
i-1,
j-1), dummy);
647 for(
i=
T->rows();
i>0;
i--)
649 for(
j=
T->rows();
j>0;
j--)
654 fmpz_set(fmpz_mat_entry(Transf,
i-1,
j-1), dummy);
660 fmpz_lll_context_init_default(fl);
662 fmpz_lll(
M, Transf, fl);
664 fmpz_lll(
M,
NULL, fl);
677 for(
i=
T->rows();
i>0;
i--)
679 for(
j=
T->cols();
j>0;
j--)
697 fmpz_mat_init(
M, r, c);
699 fmpz_mat_init(Transf, r, r);
707 fmpz_set(fmpz_mat_entry(
M,
i-1,
j-1), dummy);
713 for(
i=
T->rows();
i>0;
i--)
715 for(
j=
T->rows();
j>0;
j--)
718 fmpz_set(fmpz_mat_entry(Transf,
i-1,
j-1), dummy);
724 fmpz_lll_context_init_default(fl);
726 fmpz_lll(
M, Transf, fl);
728 fmpz_lll(
M,
NULL, fl);
738 for(
i=Transf->r;
i>0;
i--)
740 for(
j=Transf->r;
j>0;
j--)
#define BIMATELEM(M, I, J)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
@ n_Q
rational (GMP) numbers
static FORCE_INLINE void n_MPZ(mpz_t result, number &n, const coeffs r)
conversion of n to a GMP integer; 0 if not possible
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
@ n_rep_gmp
(mpz_ptr), see rmodulon,h
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
void nKillChar(coeffs r)
undo all initialisations
void WerrorS(const char *s)
This file is work in progress and currently not part of the official Singular.
void convSingPFlintP(fmpq_poly_t res, poly p, const ring r)
void convSingNFlintN(fmpz_t f, mpz_t z)
matrix convFlintNmod_matSingM(nmod_mat_t m, const ring r)
void convSingNFlintNN(fmpq_t re, fmpq_t im, number n, const coeffs cf)
void convSingIFlintI(fmpz_t f, int p)
matrix singflint_kernel(matrix m, const ring R)
void convSingNFlintN_QQ(fmpq_t f, number n)
void convFlintNSingN(mpz_t z, fmpz_t f)
matrix singflint_rref(matrix m, const ring R)
poly convFlintPSingP(fmpq_poly_t f, const ring r)
void convSingImPFlintP(fmpq_poly_t res, poly p, const ring r)
int convFlintISingI(fmpz_t f)
number convFlintNSingN_QQ(fmpq_t f, const coeffs cf)
bigintmat * singflint_LLL(bigintmat *A, bigintmat *T)
void convSingMFlintNmod_mat(matrix m, nmod_mat_t M, const ring r)
#define IMATELEM(M, I, J)
void nlMPZ(mpz_t m, number &n, const coeffs r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
#define MATELEM(mat, i, j)
1-based access to matrix
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
The main handler for Singular numbers which are suitable for Singular polynomials.
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
long p_Deg(poly a, const ring r)
static poly p_Add_q(poly p, poly q, const ring r)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static void p_Setm(poly p, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
static poly p_Init(const ring r, omBin bin)
static long p_Totaldegree(poly p, const ring r)
static BOOLEAN rField_is_Zp(const ring r)
static BOOLEAN rField_is_Q(const ring r)
number nrzInit(long i, const coeffs r)
ideal idInit(int idsize, int rank)
initialise an ideal / module