Macros | Functions
maps_ip.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <coeffs/numbers.h>
#include <coeffs/coeffs.h>
#include <polys/monomials/ring.h>
#include <polys/monomials/maps.h>
#include <polys/matpol.h>
#include <polys/prCopy.h>
#include <polys/ext_fields/transext.h>
#include <kernel/GBEngine/kstd1.h>
#include "maps_ip.h"
#include "ipid.h"
#include "lists.h"
#include "tok.h"
#include "ipshell.h"

Go to the source code of this file.

Macros

#define TRANSEXT_PRIVATES
 

Functions

BOOLEAN maApplyFetch (int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
 
poly pSubstPar (poly p, int par, poly image)
 
ideal idSubstPar (ideal id, int n, poly e)
 
poly pSubstPoly (poly p, int var, poly image)
 
ideal idSubstPoly (ideal id, int n, poly e)
 

Macro Definition Documentation

#define TRANSEXT_PRIVATES

Definition at line 7 of file maps_ip.cc.

Function Documentation

ideal idSubstPar ( ideal  id,
int  n,
poly  e 
)

Definition at line 356 of file maps_ip.cc.

357 {
358  int k=MATROWS((matrix)id)*MATCOLS((matrix)id);
360 
361  res->rank = id->rank;
362  for(k--;k>=0;k--)
363  {
364  res->m[k]=pSubstPar(id->m[k],n,e);
365  }
366  return res;
367 }
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int k
Definition: cfEzgcd.cc:93
poly res
Definition: myNF.cc:322
poly * m
Definition: matpol.h:19
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:236
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define MATCOLS(i)
Definition: matpol.h:28
#define MATROWS(i)
Definition: matpol.h:27
long rank
Definition: matpol.h:20
ideal idSubstPoly ( ideal  id,
int  n,
poly  e 
)

Definition at line 423 of file maps_ip.cc.

424 {
425 
426 #ifdef HAVE_PLURAL
427  if (rIsPluralRing(currRing))
428  {
429  int k=MATROWS((matrix)id)*MATCOLS((matrix)id);
431  res->rank = id->rank;
432  for(k--;k>=0;k--)
433  {
434  res->m[k]=pSubst(pCopy(id->m[k]),n,e);
435  }
436  return res;
437  }
438 #endif
439  map theMap=(map)idMaxIdeal(1);
440  theMap->preimage=NULL;
441  pDelete(&(theMap->m[n-1]));
442  theMap->m[n-1]=pCopy(e);
443 
445  sleftv tmpW;
446  memset(&tmpW,0,sizeof(sleftv));
447  tmpW.rtyp=IDEAL_CMD;
448  tmpW.data=id;
449  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing,NULL,NULL,0,
450  n_SetMap(currRing->cf, currRing->cf)))
451  {
452  WerrorS("map failed");
453  v->data=NULL;
454  }
455  ideal res=(ideal)(v->data);
456  idDelete((ideal *)(&theMap));
458  return res;
459 }
#define pSubst(p, n, e)
Definition: polys.h:337
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:55
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly * m
Definition: matpol.h:19
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
omBin sleftv_bin
Definition: subexpr.cc:50
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
#define MATROWS(i)
Definition: matpol.h:27
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
long rank
Definition: matpol.h:20
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
BOOLEAN maApplyFetch ( int  what,
map  theMap,
leftv  res,
leftv  w,
ring  preimage_r,
int perm,
int par_perm,
int  P,
nMapFunc  nMap 
)

Definition at line 55 of file maps_ip.cc.

57 {
58  int i;
59  int N = preimage_r->N;
60 #if 0
61  Print("N=%d what=%s ",N,Tok2Cmdname(what));
62  if (perm!=NULL) for(i=1;i<=N;i++) Print("%d -> %d ",i,perm[i]);
63  PrintS("\n");
64  Print("P=%d ",P);
65  if (par_perm!=NULL) for(i=0;i<P;i++) Print("%d -> %d ",i,par_perm[i]);
66  PrintS("\n");
67 #endif
68 
69  void *data=w->Data();
70  res->rtyp = w->rtyp;
71  switch (w->rtyp)
72  {
73  case NUMBER_CMD:
74  if (P!=0)
75  {
76 // WerrorS("Sorry 'napPermNumber' was lost in the refactoring process (due to Frank): needs to be fixed");
77 // return TRUE;
78 #if 1
79 // poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst);
80  res->data= (void *) n_PermNumber((number)data, par_perm, P, preimage_r, currRing);
81 #endif
82  res->rtyp=POLY_CMD;
84  res->data=(void *)p_MinPolyNormalize((poly)res->data, currRing);
85  pTest((poly) res->data);
86  }
87  else
88  {
89  assume( nMap != NULL );
90 
91  number a = nMap((number)data, preimage_r->cf, currRing->cf);
92 
93 
95  {
96  n_Normalize(a, currRing->cf); // ???
97 /*
98  number a = (number)res->data;
99  number one = nInit(1);
100  number product = nMult(a, one );
101  nDelete(&one);
102  nDelete(&a);
103  res->data=(void *)product;
104  */
105  }
106  #ifdef LDEBUG
107  n_Test(a, currRing->cf);
108  #endif
109  res->data=(void *)a;
110 
111  }
112  break;
113  case POLY_CMD:
114  case VECTOR_CMD:
115  if ((what==FETCH_CMD)&& (preimage_r->cf==currRing->cf))
116  res->data=(void *)prCopyR( (poly)data, preimage_r, currRing);
117  else
118  if ( (what==IMAP_CMD) || /*(*/ (what==FETCH_CMD) /*)*/) /* && (nMap!=nCopy)*/
119  res->data=(void *)p_PermPoly((poly)data,perm,preimage_r,currRing, nMap,par_perm,P);
120  else /*if (what==MAP_CMD)*/
121  {
122  p_Test((poly)data,preimage_r);
123  matrix s=mpNew(N,maMaxDeg_P((poly)data, preimage_r));
124  res->data=(void *)maEval(theMap, (poly)data, preimage_r, nMap, (ideal)s, currRing);
125  idDelete((ideal *)&s);
126  }
127  if (nCoeff_is_Extension(currRing->cf))
128  res->data=(void *)p_MinPolyNormalize((poly)res->data, currRing);
129  pTest((poly)res->data);
130  break;
131  case MODUL_CMD:
132  case MATRIX_CMD:
133  case IDEAL_CMD:
134  case MAP_CMD:
135  {
136  int C=((matrix)data)->cols();
137  int R;
138  if (w->rtyp==MAP_CMD) R=1;
139  else R=((matrix)data)->rows();
140  matrix m=mpNew(R,C);
141  char *tmpR=NULL;
142  if(w->rtyp==MAP_CMD)
143  {
144  tmpR=((map)data)->preimage;
145  ((matrix)data)->rank=((matrix)data)->rows();
146  }
147  if ((what==FETCH_CMD)&& (preimage_r->cf == currRing->cf))
148  {
149  for (i=R*C-1;i>=0;i--)
150  {
151  m->m[i]=prCopyR(((ideal)data)->m[i], preimage_r, currRing);
152  pTest(m->m[i]);
153  }
154  }
155  else
156  if ( (what==IMAP_CMD) || /*(*/ (what==FETCH_CMD) /*)*/) /* && (nMap!=nCopy)*/
157  {
158  for (i=R*C-1;i>=0;i--)
159  {
160  m->m[i]=p_PermPoly(((ideal)data)->m[i],perm,preimage_r,currRing,
161  nMap,par_perm,P);
162  pTest(m->m[i]);
163  }
164  }
165  else /* if(what==MAP_CMD) */
166  {
167  matrix s=mpNew(N,maMaxDeg_Ma((ideal)data,preimage_r));
168  for (i=R*C-1;i>=0;i--)
169  {
170  m->m[i]=maEval(theMap, ((ideal)data)->m[i], preimage_r, nMap, (ideal)s, currRing);
171  pTest(m->m[i]);
172  }
173  idDelete((ideal *)&s);
174  }
175  if (nCoeff_is_Extension(currRing->cf))
176  {
177  for (i=R*C-1;i>=0;i--)
178  {
179  m->m[i]=p_MinPolyNormalize(m->m[i], currRing);
180  pTest(m->m[i]);
181  }
182  }
183  if(w->rtyp==MAP_CMD)
184  {
185  ((map)data)->preimage=tmpR;
186  ((map)m)->preimage=omStrDup(tmpR);
187  }
188  else
189  {
190  m->rank=((matrix)data)->rank;
191  }
192  res->data=(char *)m;
193  idTest((ideal) m);
194  break;
195  }
196 
197  case LIST_CMD:
198  {
199  lists l=(lists)data;
201  ml->Init(l->nr+1);
202  for(i=0;i<=l->nr;i++)
203  {
204  if (((l->m[i].rtyp>BEGIN_RING)&&(l->m[i].rtyp<END_RING))
205  ||(l->m[i].rtyp==LIST_CMD))
206  {
207  if (maApplyFetch(what,theMap,&ml->m[i],&l->m[i],
208  preimage_r,perm,par_perm,P,nMap))
209  {
210  ml->Clean();
212  res->rtyp=0;
213  return TRUE;
214  }
215  }
216  else
217  {
218  ml->m[i].Copy(&l->m[i]);
219  }
220  }
221  res->data=(char *)ml;
222  break;
223  }
224  default:
225  {
226  return TRUE;
227  }
228  }
229  return FALSE;
230 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
const poly a
Definition: syzextra.cc:212
#define Print
Definition: emacs.cc:83
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define pTest(p)
Definition: polys.h:387
const ideal
Definition: gb_hack.h:42
int maMaxDeg_Ma(ideal a, ring preimage_r)
Definition: maps.cc:258
#define TRUE
Definition: auxiliary.h:144
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:55
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:577
void * ADDRESS
Definition: auxiliary.h:161
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly * m
Definition: matpol.h:19
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
ip_smatrix * matrix
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:918
void Copy(leftv e)
Definition: subexpr.cc:637
int m
Definition: cfEzgcd.cc:119
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define p_Test(p, r)
Definition: p_polys.h:160
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
poly p_MinPolyNormalize(poly p, const ring r)
Definition: maps.cc:328
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
Definition: p_polys.cc:3787
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
#define R
Definition: sirandom.c:26
int rtyp
Definition: subexpr.h:92
int maMaxDeg_P(poly p, ring preimage_r)
Definition: maps.cc:296
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:839
kBucketDestroy & P
Definition: myNF.cc:191
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int l
Definition: cfEzgcd.cc:94
poly maEval(map theMap, poly p, ring preimage_r, nMapFunc nMap, ideal s, const ring dst_r)
Definition: maps.cc:121
long rank
Definition: matpol.h:20
#define idTest(id)
Definition: ideals.h:63
#define omStrDup(s)
Definition: omAllocDecl.h:263
poly pSubstPar ( poly  p,
int  par,
poly  image 
)

Definition at line 236 of file maps_ip.cc.

237 {
238  const ring R = currRing->cf->extRing;
239  ideal theMapI = idInit(rPar(currRing),1);
240  nMapFunc nMap = n_SetMap(R->cf, currRing->cf);
241  int i;
242  for(i = rPar(currRing);i>0;i--)
243  {
244  if (i != par)
245  theMapI->m[i-1]= p_NSet(n_Param(i, currRing), currRing);
246  else
247  theMapI->m[i-1] = p_Copy(image, currRing);
248  p_Test(theMapI->m[i-1],currRing);
249  }
250  //iiWriteMatrix((matrix)theMapI,"map:",1,currRing,0);
251 
252  map theMap=(map)theMapI;
253  theMap->preimage=NULL;
254 
256  sleftv tmpW;
257  poly res=NULL;
258 
260  if (currRing->cf->rep==n_rep_rat_fct )
261  {
262  while (p!=NULL)
263  {
264  memset(v,0,sizeof(sleftv));
265 
266  number d = n_GetDenom(p_GetCoeff(p, currRing), currRing);
267  p_Test((poly)NUM(d), R);
268 
269  if ( n_IsOne (d, currRing->cf) )
270  {
271  n_Delete(&d, currRing); d = NULL;
272  }
273  else if (!p_IsConstant((poly)NUM(d), R))
274  {
275  WarnS("ignoring denominators of coefficients...");
276  n_Delete(&d, currRing); d = NULL;
277  }
278 
280  memset(&tmpW,0,sizeof(sleftv));
281  tmpW.rtyp = POLY_CMD;
282  p_Test((poly)NUM(num), R);
283 
284  tmpW.data = NUM (num); // a copy of this poly will be used
285 
286  p_Normalize(NUM(num),R);
287  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,R,NULL,NULL,0,nMap))
288  {
289  WerrorS("map failed");
290  v->data=NULL;
291  }
292  n_Delete(&num, currRing);
293  //TODO check for memory leaks
294  poly pp = pHead(p);
295  //PrintS("map:");pWrite(pp);
296  if( d != NULL )
297  {
298  pSetCoeff(pp, n_Invers(d, currRing->cf));
299  n_Delete(&d, currRing); // d = NULL;
300  }
301  else
302  pSetCoeff(pp, nInit(1));
303 
304  //PrintS("->");pWrite((poly)(v->data));
305  poly ppp = pMult((poly)(v->data),pp);
306  //PrintS("->");pWrite(ppp);
307  res=pAdd(res,ppp);
308  pIter(p);
309  }
310  }
311  else if (currRing->cf->rep==n_rep_poly )
312  {
313  while (p!=NULL)
314  {
315  memset(v,0,sizeof(sleftv));
316 
317  number num = n_GetNumerator(p_GetCoeff(p, currRing), currRing);
318  memset(&tmpW,0,sizeof(sleftv));
319  tmpW.rtyp = POLY_CMD;
320  p_Test((poly)num, R);
321 
322 
323  p_Normalize((poly)num,R);
324  if (num==NULL) num=(number)R->qideal->m[0];
325  tmpW.data = num; // a copy of this poly will be used
326  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,R,NULL,NULL,0,nMap))
327  {
328  WerrorS("map failed");
329  v->data=NULL;
330  }
331  if (num!=(number)R->qideal->m[0]) n_Delete(&num, currRing);
332  //TODO check for memory leaks
333  poly pp = pHead(p);
334  //PrintS("map:");pWrite(pp);
335  pSetCoeff(pp,n_Init(1,currRing));
336  //PrintS("cf->");pWrite((poly)(v->data));
337  poly ppp = pMult((poly)(v->data),pp);
338  //PrintS("->");pWrite(ppp);
339  res=pAdd(res,ppp);
340  pIter(p);
341  }
342  }
343  else
344  {
345  WerrorS("cannot apply subst for these coeffcients");
346  }
347  idDelete((ideal *)(&theMap));
349  return res;
350 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n) ...
Definition: coeffs.h:607
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define pAdd(p, q)
Definition: polys.h:174
CanonicalForm num(const CanonicalForm &f)
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:537
const ideal
Definition: gb_hack.h:42
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:55
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
(fraction), see transext.h
Definition: coeffs.h:112
#define WarnS
Definition: emacs.cc:81
int int kStrategy strat if(h==NULL) return NULL
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
poly pp
Definition: myNF.cc:296
(poly), see algext.h
Definition: coeffs.h:111
void * data
Definition: subexpr.h:89
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1..n_NumberOfParameters(...)
Definition: coeffs.h:799
#define pIter(p)
Definition: monomials.h:44
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1781
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible ...
Definition: coeffs.h:563
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
#define p_Test(p, r)
Definition: p_polys.h:160
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3584
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define pMult(p, q)
Definition: polys.h:178
#define R
Definition: sirandom.c:26
int rtyp
Definition: subexpr.h:92
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1) ...
Definition: coeffs.h:602
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define nInit(i)
Definition: numbers.h:24
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
poly pSubstPoly ( poly  p,
int  var,
poly  image 
)

Definition at line 373 of file maps_ip.cc.

374 {
375  if (p==NULL) return NULL;
376 #ifdef HAVE_PLURAL
377  if (rIsPluralRing(currRing))
378  {
379  return pSubst(pCopy(p),var,image);
380  }
381 #endif
382  map theMap=(map)idMaxIdeal(1);
383  theMap->preimage=NULL;
384  pDelete(&(theMap->m[var-1]));
385  theMap->m[var-1]=pCopy(image);
386 
387  poly res=NULL;
388 #ifdef FAST_MAP
389  if (pGetComp(p)==0)
390  {
391  ideal src_id=idInit(1,1);
392  src_id->m[0]=p;
393  ideal res_id=fast_map(src_id,currRing,(ideal)theMap,currRing);
394  res=res_id->m[0];
395  res_id->m[0]=NULL; idDelete(&res_id);
396  src_id->m[0]=NULL; idDelete(&src_id);
397  }
398  else
399 #endif
400  {
401  sleftv tmpW;
402  memset(&tmpW,0,sizeof(sleftv));
403  tmpW.rtyp=POLY_CMD;
404  tmpW.data=p;
406  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,currRing,NULL,NULL,0,
407  n_SetMap(currRing->cf, currRing->cf)))
408  {
409  WerrorS("map failed");
410  v->data=NULL;
411  }
412  res=(poly)(v->data);
414  }
415  idDelete((ideal *)(&theMap));
416  return res;
417 }
#define pSubst(p, n, e)
Definition: polys.h:337
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:55
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
#define pGetComp(p)
Component.
Definition: polys.h:37
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
omBin sleftv_bin
Definition: subexpr.cc:50
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r)
Definition: fast_maps.cc:354
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156