Loading...
Searching...
No Matches
flip.cc
Go to the documentation of this file.
#include "kernel/GBEngine/kstd1.h"
#include "gfanlib/gfanlib_vector.h"
#include "callgfanlib_conversion.h"
#include "singularWishlist.h"
#include "initial.h"
#include "lift.h"
/***
* Given a Groebner basis I of an ideal in r, an interior Point
* on a face of the maximal Groebner cone associated to the ordering on r,
* and a vector pointing outwards from it,
* returns a pair (Is,s) such that:
* (1) s is the same mathematical ring as r, but with a new ordering such that
* the interior point lies on the intersection of both maximal Groebner cones
* (2) Is is a Groebner basis of the same ideal with respect to the ordering on s
**/
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)
{
/* create a ring with weighted ordering */
bool ok;
ring sAdjusted = rCopy0(r,FALSE,FALSE);
int n = rVar(sAdjusted);
sAdjusted->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
sAdjusted->block0 = (int*) omAlloc0(5*sizeof(int));
sAdjusted->block1 = (int*) omAlloc0(5*sizeof(int));
sAdjusted->wvhdl = (int**) omAlloc0(5*sizeof(int**));
sAdjusted->order[0] = ringorder_a;
sAdjusted->block0[0] = 1;
sAdjusted->block1[0] = n;
sAdjusted->wvhdl[0] = ZVectorToIntStar(adjustedInteriorPoint,ok);
sAdjusted->order[1] = ringorder_a;
sAdjusted->block0[1] = 1;
sAdjusted->block1[1] = n;
sAdjusted->wvhdl[1] = ZVectorToIntStar(adjustedFacetNormal,ok);
sAdjusted->order[2] = ringorder_lp;
sAdjusted->block0[2] = 1;
sAdjusted->block1[2] = n;
sAdjusted->wvhdl[2] = ZVectorToIntStar(adjustedFacetNormal,ok);
sAdjusted->order[3] = ringorder_C;
rComplete(sAdjusted);
rTest(sAdjusted);
nMapFunc identity = n_SetMap(r->cf,sAdjusted->cf);
/* compute initial ideal and map it to the new ordering */
ideal inIr = initial(I,r,interiorPoint);
int k = IDELEMS(I); ideal inIsAdjusted = idInit(k);
for (int i=0; i<k; i++)
{
if (inIr->m[i]!=NULL)
{
inIsAdjusted->m[i] = p_PermPoly(inIr->m[i],NULL,r,sAdjusted,identity,NULL,0);
}
}
id_Delete(&inIr,r);
/* compute Groebner basis of the initial ideal */
intvec* nullVector = NULL;
ring origin = currRing;
rChangeCurrRing(sAdjusted);
ideal inIsAdjustedGB = kStd2(inIsAdjusted,currRing->qideal,testHomog,&nullVector,
NULL);
ideal IsAdjustedGB = lift(I,r,inIsAdjustedGB,sAdjusted);
id_Delete(&inIsAdjusted,sAdjusted);
id_Delete(&inIsAdjustedGB,sAdjusted);
ring s = rCopy0(r,FALSE,FALSE);
n = rVar(s);
s->order = (rRingOrder_t*) omAlloc0(5*sizeof(rRingOrder_t));
s->block0 = (int*) omAlloc0(5*sizeof(int));
s->block1 = (int*) omAlloc0(5*sizeof(int));
s->wvhdl = (int**) omAlloc0(5*sizeof(int**));
s->order[0] = ringorder_a;
s->block0[0] = 1;
s->block1[0] = n;
s->wvhdl[0] = ZVectorToIntStar(interiorPoint,ok);
s->order[1] = ringorder_a;
s->block0[1] = 1;
s->block1[1] = n;
s->wvhdl[1] = ZVectorToIntStar(facetNormal,ok);
s->order[2] = ringorder_lp;
s->block0[2] = 1;
s->block1[2] = n;
s->order[3] = ringorder_C;
rComplete(s);
rTest(s);
identity = n_SetMap(sAdjusted->cf,s->cf);
k = IDELEMS(IsAdjustedGB); ideal IsGB = idInit(k);
for (int i=0; i<k; i++)
{
if (IsAdjustedGB->m[i]!=NULL)
{
IsGB->m[i] = p_PermPoly(IsAdjustedGB->m[i],NULL,sAdjusted,s,identity,NULL,0);
}
}
id_Delete(&IsAdjustedGB,sAdjusted);
rDelete(sAdjusted);
rChangeCurrRing(origin);
/* lift the Groebner basis of the initial ideal
* to a Groebner basis of the original ideal,
* the currRingChange is solely for sake of performance */
return std::make_pair(IsGB,s);
}
FALSE
#define FALSE
Definition auxiliary.h:97
ZVectorToIntStar
int * ZVectorToIntStar(const gfan::ZVector &v, bool &overflow)
Definition callgfanlib_conversion.cc:110
callgfanlib_conversion.h
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
intvec
Definition intvec.h:24
n_SetMap
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:703
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
s
const CanonicalForm int s
Definition facAbsFact.cc:51
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 flip.cc:17
initial
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
initial.h
kStd2
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
kstd1.h
lift
ideal lift(const ideal J, const ring r, const ideal inI, const ring s)
Definition lift.cc:26
lift.h
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
p_PermPoly
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:4256
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
rComplete
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:3527
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1427
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
rRingOrder_t
rRingOrder_t
order stuff
Definition ring.h:69
ringorder_lp
@ ringorder_lp
Definition ring.h:78
ringorder_a
@ ringorder_a
Definition ring.h:71
ringorder_C
@ ringorder_C
Definition ring.h:74
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
rTest
#define rTest(r)
Definition ring.h:794
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
singularWishlist.h
testHomog
@ testHomog
Definition structs.h:34