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,FALSE,FALSE);
27  int n = rVar(sAdjusted);
28  sAdjusted->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
29  sAdjusted->block0 = (int*) omAlloc0(5*sizeof(int));
30  sAdjusted->block1 = (int*) omAlloc0(5*sizeof(int));
31  sAdjusted->wvhdl = (int**) omAlloc0(5*sizeof(int**));
32  sAdjusted->order[0] = ringorder_a;
33  sAdjusted->block0[0] = 1;
34  sAdjusted->block1[0] = n;
35  sAdjusted->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
36  sAdjusted->order[1] = ringorder_a;
37  sAdjusted->block0[1] = 1;
38  sAdjusted->block1[1] = n;
39  sAdjusted->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
40  sAdjusted->order[2] = ringorder_lp;
41  sAdjusted->block0[2] = 1;
42  sAdjusted->block1[2] = n;
43  sAdjusted->wvhdl[2] = ZVectorToIntStar(adjustedFacetNormal,ok);
44  sAdjusted->order[3] = ringorder_C;
45  rComplete(sAdjusted);
46  rTest(sAdjusted);
47  nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
48 
49  /* compute initial ideal and map it to the new ordering */
50  ideal inIr = initial(I,r,interiorPoint);
51  int k = IDELEMS(I); ideal inIsAdjusted = idInit(k);
52  for (int i=0; i<k; i++)
53  {
54  if (inIr->m[i]!=NULL)
55  {
56  inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
57  }
58  }
59  id_Delete(&inIr,r);
60 
61  /* compute Groebner basis of the initial ideal */
62  intvec* nullVector = NULL;
63  ring origin = currRing;
64  rChangeCurrRing(sAdjusted);
65  ideal inIsAdjustedGB = kStd(inIsAdjusted,currRing->qideal,testHomog,&nullVector);
66  ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
67  id_Delete(&inIsAdjusted,sAdjusted);
68  id_Delete(&inIsAdjustedGB,sAdjusted);
69 
70  ring s = rCopy0(r,FALSE,FALSE);
71  n = rVar(s);
72  s->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
73  s->block0 = (int*) omAlloc0(5*sizeof(int));
74  s->block1 = (int*) omAlloc0(5*sizeof(int));
75  s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
76  s->order[0] = ringorder_a;
77  s->block0[0] = 1;
78  s->block1[0] = n;
79  s->wvhdl[0] = ZVectorToIntStar(interiorPoint,ok);
80  s->order[1] = ringorder_a;
81  s->block0[1] = 1;
82  s->block1[1] = n;
83  s->wvhdl[1] = ZVectorToIntStar(facetNormal,ok);
84  s->order[2] = ringorder_lp;
85  s->block0[2] = 1;
86  s->block1[2] = n;
87  s->order[3] = ringorder_C;
88  rComplete(s);
89  rTest(s);
90  identity = n_SetMap(sAdjusted->cf,s->cf);
91  k = IDELEMS(IsAdjustedGB); ideal IsGB = idInit(k);
92  for (int i=0; i<k; i++)
93  {
94  if (IsAdjustedGB->m[i]!=NULL)
95  {
96  IsGB->m[i] = p_PermPoly(IsAdjustedGB->m[i],NULL,sAdjusted,s,identity,NULL,0);
97  }
98  }
99  id_Delete(&IsAdjustedGB,sAdjusted);
100  rDelete(sAdjusted);
101  rChangeCurrRing(origin);
102 
103  /* lift the Groebner basis of the initial ideal
104  * to a Groebner basis of the original ideal,
105  * the currRingChange is solely for sake of performance */
106 
107  return std::make_pair(IsGB,s);
108 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
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:3977
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:3356
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1323
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
rRingOrder_t
order stuff
Definition: ring.h:75
#define rTest(r)
Definition: ring.h:779
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:450
#define omAlloc0(size)
Definition: omAllocDecl.h:211