Loading...
Searching...
No Matches
preimage.h File Reference
`#include "polys/monomials/ring.h"`

Go to the source code of this file.

## Functions

ideal | maGetPreimage (ring theImageRing, map theMap, ideal id, const ring dst_r)

## Function Documentation

## maGetPreimage()

ideal maGetPreimage | ( | ring | theImageRing,
|  | map | theMap,
|  | ideal | id,
|  | const ring | dst_r )

TODO: there might be extreme cases where this doesn't hold...

Definition at line 57 of file preimage.cc.

{
ring sourcering = dst_r;
#ifdef HAVE_PLURAL
if (rIsPluralRing(theImageRing))
{
if ((rIsPluralRing(sourcering)) && (ncRingType(sourcering)!=nc_comm))
{
WerrorS("Sorry, not yet implemented for noncomm. rings");
return NULL;
}
}
#endif
int i,j;
poly p,/*pp,*/q;
ideal temp1;
ideal temp2;
int imagepvariables = rVar(theImageRing);
int N = rVar(dst_r)+imagepvariables;
ring tmpR;
if (rSumInternal(theImageRing,sourcering,tmpR,FALSE,2)!=1)
{
WerrorS("error in rSumInternal");
return NULL;
}
if (theImageRing->cf != dst_r->cf)
{
/// TODO: there might be extreme cases where this doesn't hold...
WerrorS("Coefficient fields/rings must be equal");
return NULL;
}
const ring save_ring = currRing; if (currRing!=tmpR) rChangeCurrRing(tmpR); // due to kStd
if (id==NULL)
j = 0;
else
j = IDELEMS(id);
int j0=j;
if (theImageRing->qideal!=NULL) j+=IDELEMS(theImageRing->qideal);
temp1 = idInit(sourcering->N+j,1);
for (i=0;i<sourcering->N;i++)
{
q = p_ISet(-1,tmpR);
p_SetExp(q,i+1+imagepvariables,1,tmpR);
p_Setm(q,tmpR);
if ((i<IDELEMS(theMap)) && (theMap->m[i]!=NULL))
{
p = p_SortMerge(
pChangeSizeOfPoly(theImageRing, theMap->m[i], 1, imagepvariables, tmpR),
tmpR);
p=p_Add_q(p,q,tmpR);
}
else
{
p = q;
}
temp1->m[i] = p;
}
id_Test(temp1, tmpR);
for (i=sourcering->N;i<sourcering->N+j0;i++)
{
temp1->m[i] = p_SortMerge(
pChangeSizeOfPoly(theImageRing, id->m[i-sourcering->N], 1, imagepvariables, tmpR),
tmpR);
}
for (i=sourcering->N+j0;i<sourcering->N+j;i++)
{
temp1->m[i] = p_SortMerge(
pChangeSizeOfPoly(theImageRing, theImageRing->qideal->m[i-sourcering->N-j0], 1, imagepvariables, tmpR),
tmpR);
}
// we ignore here homogeneity - may be changed later:
BITSET save;
SI_SAVE_OPT2(save);
temp2 = kStd2(temp1,NULL,isNotHomog,NULL,(bigintmat*)NULL);
SI_RESTORE_OPT2(save);
id_Delete(&temp1,tmpR);
for (i=0;i<IDELEMS(temp2);i++)
{
if (p_LowVar(temp2->m[i], currRing)<imagepvariables) p_Delete(&(temp2->m[i]),tmpR);
}
// let's get back to the original ring
//rChangeCurrRing(sourcering);
temp1 = idInit(5,1);
j = 0;
for (i=0;i<IDELEMS(temp2);i++)
{
p = temp2->m[i];
if (p!=NULL)
{
q = p_SortMerge(
pChangeSizeOfPoly(tmpR, p, imagepvariables+1, N, sourcering),
sourcering);
if (j>=IDELEMS(temp1))
{
pEnlargeSet(&(temp1->m),IDELEMS(temp1),5);
IDELEMS(temp1)+=5;
}
temp1->m[j] = q;
j++;
}
}
id_Delete(&temp2, tmpR);
idSkipZeroes(temp1);
if (currRing!=save_ring) rChangeCurrRing(save_ring);
rDelete(tmpR);
return temp1;
}
BITSET
#define BITSET
Definition auxiliary.h:85
FALSE
#define FALSE
Definition auxiliary.h:97
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
j
int j
Definition facHensel.cc:110
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
kStd2
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
nc_comm
@ nc_comm
Definition nc.h:17
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition nc.h:159
NULL
#define NULL
Definition omList.c:12
SI_SAVE_OPT2
#define SI_SAVE_OPT2(A)
Definition options.h:22
SI_RESTORE_OPT2
#define SI_RESTORE_OPT2(A)
Definition options.h:25
p_LowVar
int p_LowVar(poly p, const ring r)
the minimal index of used variables - 1
Definition p_polys.cc:4834
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_SetExp
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
Definition p_polys.h:490
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_SortMerge
static poly p_SortMerge(poly p, const ring r, BOOLEAN revert=FALSE)
Definition p_polys.h:1250
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pChangeSizeOfPoly
static poly pChangeSizeOfPoly(ring p_ring, poly p, int minvar, int maxvar, const ring dst_r)
Definition preimage.cc:23
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
rSumInternal
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering,...
Definition ring.cc:755
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
id_Test
#define id_Test(A, lR)
Definition simpleideals.h:89
isNotHomog
@ isNotHomog
Definition structs.h:32