 |
My Project
UNKNOWN_GIT_VERSION
|
Go to the documentation of this file.
28 #define HAVE_MAP_OPTIMIZE 1
36 int n_max_map_monomials, ring map_r,
39 int n =
si_min(pi_r->N, n_max_map_monomials);
41 unsigned long e_i, e_j;
43 poly map_j =
p_Init(map_r);
45 for (
i=1;
i <= n;
i++)
49 m_i = max_map_monomials[
i-1];
52 for (
j = 1;
j<= map_r->N;
j++)
64 static unsigned long maGetMaxExp(ideal pi_id, ring pi_r, ideal map_id, ring map_r)
67 poly* max_map_monomials = (poly*)
omAlloc(
IDELEMS(map_id)*
sizeof(poly));
68 poly max_pi_i, max_map_i;
82 if (temp >
max){
max=temp; }
104 p_wrp(monomial->src, src_r);
105 printf(
" ref:%d", monomial->ref);
109 p_wrp(monomial->dest, dest_r);
111 if (monomial->f1!=
NULL) { printf(
" f1:%lx", (
long)monomial->f1->src);
114 if (monomial->f2!=
NULL) { printf(
" f2:%lx",(
long)monomial->f2->src);
123 while (mpoly !=
NULL)
148 mp->coeff->bucket = bucket;
160 if (mp->coeff !=
NULL)
170 if (mp->dest !=
NULL)
220 iter->ref += what->ref;
224 while (coeff->next !=
NULL) coeff = coeff->next;
225 coeff->next =
iter->coeff;
226 iter->coeff = what->coeff;
264 for (
i=0;
i<mideal->n;
i++)
266 if (map_id->m[
i] !=
NULL)
282 ideal image_id, ring image_r,
283 ring &src_r, ring &dest_r,
BOOLEAN &simple)
286 int* weights = (
int*)
omAlloc0(map_r->N*
sizeof(
int));
300 unsigned long maxExp =
maGetMaxExp(map_id, map_r, image_id, image_r);
301 if (maxExp <= 1) maxExp = 2;
302 else if (maxExp > (
unsigned long) image_r->bitmask)
303 maxExp = (
unsigned long) image_r->bitmask;
314 if (image_r != dest_r)
328 for (
int i= 0;
i < m_id->n;
i++)
330 if (m_id->buckets[
i]!=
NULL)
367 if (dest_r != image_r)
382 Print(
"map[%ld:%d]{%d:", dest_r->bitmask, dest_r->ExpL_Size,
length);
386 #if HAVE_MAP_OPTIMIZE > 0
405 if (dest_r != image_r)
415 res_image_id = res_dest_id;
463 for(
i=1;
i<=src_r->N;
i++)
498 if ((root!=
NULL) && (root->next!=
NULL))
514 int next_print_cost = total_cost;
529 if (
p->f1->ref>0) f1=
p_Copy(f1,dest_r);
535 if (
p->f2->ref>0) f2=
p_Copy(f2,dest_r);
559 if (cost > next_print_cost)
562 next_print_cost += total_cost;
586 static poly
maEggT(
const poly m1,
const poly m2, poly &q1, poly &q2,
const ring r)
595 for (
i=1;
i<=r->N;
i++)
599 if (e1 > 0 && e2 > 0)
601 unsigned long em = (e1 > e2 ? e2 : e1);
656 if ((tmp_deg=
p_Deg(q,r)) > ggt_deg)
static int si_min(const int a, const int b)
static BOOLEAN Equal(number a, number b, const coeffs r)
static poly maPoly_EvalMon(poly src, ring src_r, poly *dest_id, ring dest_r)
static poly maEggT(const poly m1, const poly m2, poly &q1, poly &q2, const ring r)
class maideal_s * maideal
ideal maIdeal_2_Ideal(maideal m_id, ring)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
void maMap_CreateRings(ideal map_id, ring map_r, ideal image_id, ring image_r, ring &src_r, ring &dest_r, BOOLEAN &simple)
void maMonomial_Destroy(mapoly mp, ring src_r, ring dest_r)
static BOOLEAN rField_is_Domain(const ring r)
void maPoly_Out(mapoly mpoly, ring src_ring, ring dest_r=NULL)
#define omGetSpecBin(size)
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
static unsigned long maGetMaxExp(ideal pi_id, ring pi_r, ideal map_id, ring map_r)
ideal idrShallowCopyR(ideal id, ring src_r, ring dest_r)
void rKillModifiedRing(ring r)
static BOOLEAN length(leftv result, leftv arg)
void p_wrp(poly p, ring lmRing, ring tailRing)
void maPoly_Optimize(mapoly mpoly, ring src_r)
void id_ShallowDelete(ideal *h, ring r)
Shallowdeletes an ideal/matrix.
static mapoly maFindBestggT(mapoly mp, mapoly &choice, mapoly &fp, mapoly &fq, 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 pLength(poly a)
static bool Greater(mono_type m1, mono_type m2)
static poly p_Copy(poly p, const ring r)
returns a copy of p
ring rModifyRing_Wp(ring r, int *weights)
construct Wp, C ring
static void maMap_KillRings(ring map_r, ring image_r, ring src_r, ring dest_r)
static BOOLEAN p_IsConstantComp(const poly p, const ring r)
ring rModifyRing_Simple(ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
void PrintS(const char *s)
#define omFreeSize(addr, size)
void sBucket_Add_p(sBucket_pt bucket, poly p, int length)
adds poly p to bucket destroys p!
static int maPoly_Substitute(macoeff c, poly p, ring dest_r)
mapoly maMonomial_Create(poly p, ring, sBucket_pt bucket)
static BOOLEAN rField_is_Ring(const ring r)
sBucket_pt sBucketCreate(const ring r)
static int max(int a, int b)
poly prShallowCopyR_NoSort(poly p, ring r, ring dest_r)
static poly p_Init(const ring r, omBin bin)
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0,...
void maMonomial_Out(mapoly monomial, ring src_r, ring dest_r=NULL)
#define __pp_Mult_nn(p, n, r)
ideal fast_map_common_subexp(const ideal map_id, const ring map_r, const ideal image_id, const ring image_r)
static void p_LmFree(poly p, ring)
#define p_LmCmpAction(p, q, r, actionE, actionG, actionS)
long p_Deg(poly a, const ring r)
static void p_Delete(poly *p, const ring r)
mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r)
void maPoly_GetLength(mapoly mp, int &length)
mapoly maMonomial_Free(mapoly monomial, ring src_r, ring dest_r=NULL)
void maPoly_Eval(mapoly root, ring src_r, ideal dest_id, ring dest_r, int total_cost)
ideal idInit(int idsize, int rank)
initialise an ideal / module
static void maPoly_InsertPoly(mapoly &into, poly what, ring src_r, sBucket_pt bucket)
class macoeff_s * macoeff
static long p_AddExp(poly p, int v, long ee, ring r)
static poly maGetMaxExpP(poly *max_map_monomials, int n_max_map_monomials, ring map_r, poly pi_m, ring pi_r)
static void p_Setm(poly p, const ring r)
static long p_Totaldegree(poly p, const ring r)
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
static poly p_Mult_q(poly p, poly q, const ring r)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define omFreeBin(addr, bin)
void maMap_CreatePolyIdeal(ideal map_id, ring map_r, ring src_r, ring dest_r, mapoly &mp, maideal &mideal)
poly prShallowCopyR(poly p, ring r, ring dest_r)
void rKillModified_Wp_Ring(ring r)