MCPcopy Create free account
hub / github.com/Singular/Singular / maApplyFetch

Function maApplyFetch

Singular/maps_ip.cc:45–259  ·  view source on GitHub ↗

2 * maps the expression w to res, * switch what: MAP_CMD: use theMap for mapping, N for preimage ring * //FETCH_CMD: use pOrdPoly for mapping * IMAP_CMD: use perm for mapping, N for preimage ring * default: map only poly-structures, * use perm and par_perm, N and P, */

Source from the content-addressed store, hash-verified

43* use perm and par_perm, N and P,
44*/
45BOOLEAN maApplyFetch(int what,map theMap,leftv res, leftv w, ring preimage_r,
46 int *perm, int *par_perm, int P, nMapFunc nMap)
47{
48 BOOLEAN use_mult=FALSE;
49#ifdef HAVE_PLURAL
50 if ((what==IMAP_CMD)
51 && rIsPluralRing(currRing)
52 && rIsPluralRing(preimage_r))
53 {
54 assume(perm!=NULL);
55 int i=1;
56 while((i<preimage_r->N)&&(perm[i]==0)) i++;
57 if (i<preimage_r->N)
58 {
59 int prev_nonnull=i;
60 i++;
61 for(;i<=preimage_r->N;i++)
62 {
63 if (perm[prev_nonnull] > perm[i])
64 {
65 if (TEST_V_ALLWARN)
66 {
67 Warn("imap not usable for permuting variables, use map (%s <-> %s)", preimage_r->names[prev_nonnull-1],preimage_r->names[i-1]);
68 }
69 use_mult=TRUE;
70 break;
71 }
72 else
73 prev_nonnull=i;
74 }
75 }
76 }
77#endif
78 int i;
79 int N = preimage_r->N;
80#if 0
81 Print("N=%d what=%s ",N,Tok2Cmdname(what));
82 if (perm!=NULL) for(i=1;i<=N;i++) Print("%d -> %d ",i,perm[i]);
83 PrintS("\n");
84 Print("P=%d ",P);
85 if (par_perm!=NULL) for(i=0;i<P;i++) Print("%d -> %d ",i,par_perm[i]);
86 PrintS("\n");
87#endif
88
89 void *data=w->Data();
90 res->rtyp = w->rtyp;
91 switch (w->rtyp)
92 {
93 case NUMBER_CMD:
94 if (P!=0)
95 {
96// poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst);
97 res->data= (void *) n_PermNumber((number)data, par_perm, P, preimage_r, currRing);
98 res->rtyp=POLY_CMD;
99 if (nCoeff_is_algExt(currRing->cf))
100 res->data=(void *)p_MinPolyNormalize((poly)res->data, currRing);
101 pTest((poly) res->data);
102 }

Callers 4

jjFETCHFunction · 0.85
jjFETCH_MFunction · 0.85
iiMapFunction · 0.85
pSubstParFunction · 0.85

Calls 15

rIsPluralRingFunction · 0.85
WarnFunction · 0.85
PrintSFunction · 0.85
n_PermNumberFunction · 0.85
nCoeff_is_algExtFunction · 0.85
p_MinPolyNormalizeFunction · 0.85
nCoeff_is_ExtensionFunction · 0.85
n_NormalizeFunction · 0.85
rIsLPRingFunction · 0.85
prCopyRFunction · 0.85
sBucketPeekFunction · 0.85
p_PermPolyFunction · 0.85

Tested by

no test coverage detected