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