My Project
Loading...
Searching...
No Matches
Functions
flip.cc File Reference
#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 17 of file flip.cc.

22{
23 /* create a ring with weighted ordering */
24 bool ok;
25 ring sAdjusted = rCopy0(r,FALSE,FALSE);
26 int n = rVar(sAdjusted);
27 sAdjusted->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
28 sAdjusted->block0 = (int*) omAlloc0(5*sizeof(int));
29 sAdjusted->block1 = (int*) omAlloc0(5*sizeof(int));
30 sAdjusted->wvhdl = (int**) omAlloc0(5*sizeof(int**));
31 sAdjusted->order[0] = ringorder_a;
32 sAdjusted->block0[0] = 1;
33 sAdjusted->block1[0] = n;
34 sAdjusted->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
35 sAdjusted->order[1] = ringorder_a;
36 sAdjusted->block0[1] = 1;
37 sAdjusted->block1[1] = n;
38 sAdjusted->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
39 sAdjusted->order[2] = ringorder_lp;
40 sAdjusted->block0[2] = 1;
41 sAdjusted->block1[2] = n;
42 sAdjusted->wvhdl[2] = ZVectorToIntStar(adjustedFacetNormal,ok);
43 sAdjusted->order[3] = ringorder_C;
44 rComplete(sAdjusted);
45 rTest(sAdjusted);
46 nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
47
48 /* compute initial ideal and map it to the new ordering */
49 ideal inIr = initial(I,r,interiorPoint);
50 int k = IDELEMS(I); ideal inIsAdjusted = idInit(k);
51 for (int i=0; i<k; i++)
52 {
53 if (inIr->m[i]!=NULL)
54 {
55 inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
56 }
57 }
58 id_Delete(&inIr,r);
59
60 /* compute Groebner basis of the initial ideal */
61 intvec* nullVector = NULL;
62 ring origin = currRing;
63 rChangeCurrRing(sAdjusted);
64 ideal inIsAdjustedGB = kStd(inIsAdjusted,currRing->qideal,testHomog,&nullVector);
65 ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
66 id_Delete(&inIsAdjusted,sAdjusted);
67 id_Delete(&inIsAdjustedGB,sAdjusted);
68
69 ring s = rCopy0(r,FALSE,FALSE);
70 n = rVar(s);
71 s->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
72 s->block0 = (int*) omAlloc0(5*sizeof(int));
73 s->block1 = (int*) omAlloc0(5*sizeof(int));
74 s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
75 s->order[0] = ringorder_a;
76 s->block0[0] = 1;
77 s->block1[0] = n;
78 s->wvhdl[0] = ZVectorToIntStar(interiorPoint,ok);
79 s->order[1] = ringorder_a;
80 s->block0[1] = 1;
81 s->block1[1] = n;
82 s->wvhdl[1] = ZVectorToIntStar(facetNormal,ok);
83 s->order[2] = ringorder_lp;
84 s->block0[2] = 1;
85 s->block1[2] = n;
86 s->order[3] = ringorder_C;
87 rComplete(s);
88 rTest(s);
89 identity = n_SetMap(sAdjusted->cf,s->cf);
90 k = IDELEMS(IsAdjustedGB); ideal IsGB = idInit(k);
91 for (int i=0; i<k; i++)
92 {
93 if (IsAdjustedGB->m[i]!=NULL)
94 {
95 IsGB->m[i] = p_PermPoly(IsAdjustedGB->m[i],NULL,sAdjusted,s,identity,NULL,0);
96 }
97 }
98 id_Delete(&IsAdjustedGB,sAdjusted);
99 rDelete(sAdjusted);
100 rChangeCurrRing(origin);
101
102 /* lift the Groebner basis of the initial ideal
103 * to a Groebner basis of the original ideal,
104 * the currRingChange is solely for sake of performance */
105
106 return std::make_pair(IsGB,s);
107}
#define FALSE
Definition: auxiliary.h:96
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
Definition: intvec.h:23
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:697
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
const CanonicalForm int s
Definition: facAbsFact.cc:51
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:30
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:2447
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition: lift.cc:26
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
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:4130
void rChangeCurrRing(ring r)
Definition: polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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:3450
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1421
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
rRingOrder_t
order stuff
Definition: ring.h:68
@ ringorder_lp
Definition: ring.h:77
@ ringorder_a
Definition: ring.h:70
@ ringorder_C
Definition: ring.h:73
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
#define rTest(r)
Definition: ring.h:782
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define IDELEMS(i)
Definition: simpleideals.h:23
@ testHomog
Definition: structs.h:38