Functions
flip.cc File Reference
#include <utility>
#include <kernel/GBEngine/kstd1.h>
#include <gfanlib/gfanlib_vector.h>
#include <callgfanlib_conversion.h>
#include <singularWishlist.h>
#include <initial.h>
#include <lift.h>

Go to the source code of this file.

Functions

std::pair< ideal, ring > flip (const ideal I, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal, const gfan::ZVector adjustedInteriorPoint, const gfan::ZVector adjustedFacetNormal)
 

Function Documentation

§ flip()

std::pair<ideal,ring> flip ( const ideal  I,
const ring  r,
const gfan::ZVector  interiorPoint,
const gfan::ZVector  facetNormal,
const gfan::ZVector  adjustedInteriorPoint,
const gfan::ZVector  adjustedFacetNormal 
)

Definition at line 18 of file flip.cc.

23 {
24  /* create a ring with weighted ordering */
25  bool ok;
26  ring sAdjusted = rCopy0(r);
27  int n = rVar(sAdjusted);
28  deleteOrdering(sAdjusted);
29  sAdjusted->order = (int*) omAlloc0(5*sizeof(int));
30  sAdjusted->block0 = (int*) omAlloc0(5*sizeof(int));
31  sAdjusted->block1 = (int*) omAlloc0(5*sizeof(int));
32  sAdjusted->wvhdl = (int**) omAlloc0(5*sizeof(int**));
33  sAdjusted->order[0] = ringorder_a;
34  sAdjusted->block0[0] = 1;
35  sAdjusted->block1[0] = n;
36  sAdjusted->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
37  sAdjusted->order[1] = ringorder_a;
38  sAdjusted->block0[1] = 1;
39  sAdjusted->block1[1] = n;
40  sAdjusted->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
41  sAdjusted->order[2] = ringorder_lp;
42  sAdjusted->block0[2] = 1;
43  sAdjusted->block1[2] = n;
44  sAdjusted->wvhdl[2] = ZVectorToIntStar(adjustedFacetNormal,ok);
45  sAdjusted->order[3] = ringorder_C;
46  rComplete(sAdjusted);
47  rTest(sAdjusted);
48  nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
49 
50  /* compute initial ideal and map it to the new ordering */
51  ideal inIr = initial(I,r,interiorPoint);
52  int k = IDELEMS(I); ideal inIsAdjusted = idInit(k);
53  for (int i=0; i<k; i++)
54  {
55  if (inIr->m[i]!=NULL)
56  {
57  inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
58  }
59  }
60  id_Delete(&inIr,r);
61 
62  /* compute Groebner basis of the initial ideal */
63  intvec* nullVector = NULL;
64  ring origin = currRing;
65  rChangeCurrRing(sAdjusted);
66  ideal inIsAdjustedGB = kStd(inIsAdjusted,currRing->qideal,testHomog,&nullVector);
67  ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
68  id_Delete(&inIsAdjusted,sAdjusted);
69  id_Delete(&inIsAdjustedGB,sAdjusted);
70 
71  ring s = rCopy0(r);
72  n = rVar(s);
73  deleteOrdering(s);
74  s->order = (int*) omAlloc0(5*sizeof(int));
75  s->block0 = (int*) omAlloc0(5*sizeof(int));
76  s->block1 = (int*) omAlloc0(5*sizeof(int));
77  s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
78  s->order[0] = ringorder_a;
79  s->block0[0] = 1;
80  s->block1[0] = n;
81  s->wvhdl[0] = ZVectorToIntStar(interiorPoint,ok);
82  s->order[1] = ringorder_a;
83  s->block0[1] = 1;
84  s->block1[1] = n;
85  s->wvhdl[1] = ZVectorToIntStar(facetNormal,ok);
86  s->order[2] = ringorder_lp;
87  s->block0[2] = 1;
88  s->block1[2] = n;
89  s->order[3] = ringorder_C;
90  rComplete(s);
91  rTest(s);
92  identity = n_SetMap(sAdjusted->cf,s->cf);
93  k = IDELEMS(IsAdjustedGB); ideal IsGB = idInit(k);
94  for (int i=0; i<k; i++)
95  {
96  if (IsAdjustedGB->m[i]!=NULL)
97  {
98  IsGB->m[i] = p_PermPoly(IsAdjustedGB->m[i],NULL,sAdjusted,s,identity,NULL,0);
99  }
100  }
101  id_Delete(&IsAdjustedGB,sAdjusted);
102  rDelete(sAdjusted);
103  rChangeCurrRing(origin);
104 
105  /* lift the Groebner basis of the initial ideal
106  * to a Groebner basis of the original ideal,
107  * the currRingChange is solely for sake of performance */
108 
109  return std::make_pair(IsGB,s);
110 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
int k
Definition: cfEzgcd.cc:93
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:26
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:32
const ring r
Definition: syzextra.cc:208
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:3938
Definition: intvec.h:14
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3351
void deleteOrdering(ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
#define rTest(r)
Definition: ring.h:775
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
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:725
void rChangeCurrRing(ring r)
Definition: polys.cc:12
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define omAlloc0(size)
Definition: omAllocDecl.h:211