1 | #include "polys/monomials/p_polys.h" |
---|
2 | |
---|
3 | #include "witness.h" |
---|
4 | |
---|
5 | /*** |
---|
6 | * Suppose r and s are the same ring but with two adjacent orderings, |
---|
7 | * w is a weight vector in the relative interior of their common facet. |
---|
8 | * Given a standard basis of an ideal I with respect to the ordering of r, |
---|
9 | * a standard basis of its w-initial ideal inI with respect to |
---|
10 | * the ordering of s, computes a standard basis of I with respect to |
---|
11 | * the ordering of s. |
---|
12 | **/ |
---|
13 | // ideal lift(const ideal I, const ring r, const ideal inI, const ring s) |
---|
14 | // { |
---|
15 | // nMapFunc identity = n_SetMap(r->cf,s->cf); |
---|
16 | // int k = IDELEMS(I); ideal Is = idInit(k); |
---|
17 | // for (int i=0; i<k; i++) |
---|
18 | // Is->m[i] = p_PermPoly(I->m[i],NULL,r,s,identity,NULL,0); |
---|
19 | // ideal J = idInit(k); |
---|
20 | // for (int i=0; i<k; i++) |
---|
21 | // J->m[i] = witness(inI->m[i],Is,inI,s); |
---|
22 | // id_Delete(&Is,s); |
---|
23 | // return J; |
---|
24 | // } |
---|
25 | |
---|
26 | ideal lift(const ideal J, const ring r, const ideal inI, const ring s) |
---|
27 | { |
---|
28 | nMapFunc identity = n_SetMap(s->cf,r->cf); |
---|
29 | int k = IDELEMS(inI); ideal inIr = idInit(k); |
---|
30 | for (int i=0; i<k; i++) |
---|
31 | { |
---|
32 | if(inI->m[i]!=NULL) |
---|
33 | { |
---|
34 | inIr->m[i] = p_PermPoly(inI->m[i],NULL,s,r,identity,NULL,0); |
---|
35 | } |
---|
36 | } |
---|
37 | ideal Ir = witness(inIr,J,r); |
---|
38 | |
---|
39 | identity = n_SetMap(r->cf,s->cf); |
---|
40 | ideal Is = idInit(k); |
---|
41 | for (int i=0; i<k; i++) |
---|
42 | { |
---|
43 | if(Ir->m[i]!=NULL) |
---|
44 | { |
---|
45 | Is->m[i] = p_PermPoly(Ir->m[i],NULL,r,s,identity,NULL,0); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | id_Delete(&inIr,r); |
---|
50 | id_Delete(&Ir,r); |
---|
51 | return Is; |
---|
52 | } |
---|