Loading...
Searching...
No Matches
bbcone.h File Reference
`#include "kernel/mod2.h"`
`#include "misc/intvec.h"`
`#include "coeffs/bigintmat.h"`
`#include "Singular/ipid.h"`
`#include "gfanlib/gfanlib.h"`

Go to the source code of this file.

## Functions

void | bbcone_setup (SModulFunctions *p)
std::string | toString (const gfan::ZCone *const c)
gfan::ZVector | randomPoint (const gfan::ZCone *zc, const int b=0)
gfan::ZCone | liftUp (const gfan::ZCone &zc)
gfan::ZMatrix | interiorPointsOfFacets (const gfan::ZCone &zc, const std::set< gfan::ZVector > &exceptThese=std::set< gfan::ZVector >())
std::pair< gfan::ZMatrix, gfan::ZMatrix > | interiorPointsAndNormalsOfFacets (const gfan::ZCone zc, const std::set< gfan::ZVector > &exceptThesePoints=std::set< gfan::ZVector >(), const bool onlyLowerHalfSpace=false)

## Variables

EXTERN_VAR int | coneID

## Function Documentation

## bbcone_setup()

void bbcone_setup | ( | SModulFunctions * | p | ) |

Definition at line 2101 of file bbcone.cc.

{
blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox));
// all undefined entries will be set to default in setBlackboxStuff
// the default Print is quite usefull,
// all other are simply error messages
b->blackbox_destroy=bbcone_destroy;
b->blackbox_String=bbcone_String;
// b->blackbox_Print=blackbox_default_Print;
b->blackbox_Init=bbcone_Init;
b->blackbox_Copy=bbcone_Copy;
b->blackbox_Assign=bbcone_Assign;
b->blackbox_Op2=bbcone_Op2;
b->blackbox_serialize=bbcone_serialize;
b->blackbox_deserialize=bbcone_deserialize;
p->iiAddCproc("gfan.lib","coneViaInequalitiesInternal",FALSE,coneViaNormals);
p->iiAddCproc("gfan.lib","coneViaPointsInternal",FALSE,coneViaRays);
p->iiAddCproc("","listContainsCone",FALSE,containsCone);
// iiAddCproc("gfan.lib","makePolytopeInternal",FALSE,coneToPolytope);
p->iiAddCproc("gfan.lib","ambientDimensionInternal",FALSE,ambientDimension);
p->iiAddCproc("gfan.lib","canonicalizeConeInternal",FALSE,canonicalizeCone);
p->iiAddCproc("gfan.lib","codimensionInternal",FALSE,codimension);
p->iiAddCproc("gfan.lib","coneLinkInternal",FALSE,coneLink);
p->iiAddCproc("gfan.lib","containsAsFaceInternal",FALSE,hasFace);
p->iiAddCproc("gfan.lib","containsInSupportInternal",FALSE,containsInSupport);
p->iiAddCproc("gfan.lib","containsPositiveVectorInternal",FALSE,containsPositiveVector);
p->iiAddCproc("gfan.lib","containsRelativelyInternal",FALSE,containsRelatively);
p->iiAddCproc("gfan.lib","convexHullInternal",FALSE,convexHull);
p->iiAddCproc("gfan.lib","convexIntersectionInternal",FALSE,intersectCones);
p->iiAddCproc("gfan.lib","dimensionInternal",FALSE,dimension);
p->iiAddCproc("gfan.lib","dualConeInternal",FALSE,dualCone);
p->iiAddCproc("gfan.lib","equationsInternal",FALSE,equations);
p->iiAddCproc("gfan.lib","facetsInternal",FALSE,facets);
p->iiAddCproc("gfan.lib","generatorsOfLinealitySpaceInternal",FALSE,generatorsOfLinealitySpace);
p->iiAddCproc("gfan.lib","generatorsOfSpanInternal",FALSE,generatorsOfSpan);
p->iiAddCproc("gfan.lib","getLinearFormsInternal",FALSE,getLinearForms);
p->iiAddCproc("gfan.lib","getMultiplicityInternal",FALSE,getMultiplicity);
p->iiAddCproc("gfan.lib","inequalitiesInternal",FALSE,inequalities);
p->iiAddCproc("gfan.lib","isFullSpaceInternal",FALSE,isFullSpace);
p->iiAddCproc("gfan.lib","isOriginInternal",FALSE,isOrigin);
p->iiAddCproc("gfan.lib","isSimplicialInternal",FALSE,isSimplicial);
p->iiAddCproc("gfan.lib","linealityDimensionInternal",FALSE,linealityDimension);
p->iiAddCproc("gfan.lib","linealitySpaceInternal",FALSE,linealitySpace);
p->iiAddCproc("gfan.lib","negatedConeInternal",FALSE,negatedCone);
p->iiAddCproc("gfan.lib","quotientLatticeBasisInternal",FALSE,quotientLatticeBasis);
p->iiAddCproc("gfan.lib","randomPointInternal",FALSE,randomPoint);
p->iiAddCproc("gfan.lib","raysInternal",FALSE,rays);
p->iiAddCproc("gfan.lib","relativeInteriorPointInternal",FALSE,relativeInteriorPoint);
p->iiAddCproc("gfan.lib","semigroupGeneratorInternal",FALSE,semigroupGenerator);
p->iiAddCproc("gfan.lib","setLinearFormsInternal",FALSE,setLinearForms);
p->iiAddCproc("gfan.lib","setMultiplicityInternal",FALSE,setMultiplicity);
p->iiAddCproc("gfan.lib","spanInternal",FALSE,impliedEquations);
p->iiAddCproc("gfan.lib","uniquePointInternal",FALSE,uniquePoint);
p->iiAddCproc("gfan.lib","faceContainingInternal",FALSE,faceContaining);
p->iiAddCproc("gfan.lib","onesVectorInternal",FALSE,onesVector);
p->iiAddCproc("gfan.lib","convexIntersectionOld",FALSE,convexIntersectionOld);
coneID=setBlackboxStuff(b,"cone");
}
FALSE
#define FALSE
Definition auxiliary.h:97
getMultiplicity
BOOLEAN getMultiplicity(leftv res, leftv args)
Definition bbcone.cc:850
isFullSpace
BOOLEAN isFullSpace(leftv res, leftv args)
Definition bbcone.cc:884
canonicalizeCone
BOOLEAN canonicalizeCone(leftv res, leftv args)
Definition bbcone.cc:1678
bbcone_deserialize
BOOLEAN bbcone_deserialize(blackbox **b, void **d, si_link f)
Definition bbcone.cc:1993
quotientLatticeBasis
BOOLEAN quotientLatticeBasis(leftv res, leftv args)
Definition bbcone.cc:689
bbcone_Init
void * bbcone_Init(blackbox *)
Definition bbcone.cc:80
onesVector
BOOLEAN onesVector(leftv res, leftv args)
Definition bbcone.cc:1776
convexIntersectionOld
BOOLEAN convexIntersectionOld(leftv res, leftv args)
Definition bbcone.cc:2010
getLinearForms
BOOLEAN getLinearForms(leftv res, leftv args)
Definition bbcone.cc:706
codimension
BOOLEAN codimension(leftv res, leftv args)
Definition bbcone.cc:791
bbcone_destroy
void bbcone_destroy(blackbox *, void *d)
Definition bbcone.cc:148
facets
BOOLEAN facets(leftv res, leftv args)
Definition bbcone.cc:594
impliedEquations
BOOLEAN impliedEquations(leftv res, leftv args)
Definition bbcone.cc:611
uniquePoint
BOOLEAN uniquePoint(leftv res, leftv args)
Definition bbcone.cc:1038
isSimplicial
BOOLEAN isSimplicial(leftv res, leftv args)
Definition bbcone.cc:901
ambientDimension
BOOLEAN ambientDimension(leftv res, leftv args)
Definition bbcone.cc:723
bbcone_Assign
BOOLEAN bbcone_Assign(leftv l, leftv r)
Definition bbcone.cc:85
coneLink
BOOLEAN coneLink(leftv res, leftv args)
Definition bbcone.cc:1484
containsCone
BOOLEAN containsCone(leftv res, leftv args)
Definition bbcone.cc:1696
negatedCone
BOOLEAN negatedCone(leftv res, leftv args)
Definition bbcone.cc:979
generatorsOfSpan
BOOLEAN generatorsOfSpan(leftv res, leftv args)
Definition bbcone.cc:628
equations
BOOLEAN equations(leftv res, leftv args)
Definition bbcone.cc:577
bbcone_String
char * bbcone_String(blackbox *, void *d)
Definition bbcone.cc:138
containsRelatively
BOOLEAN containsRelatively(leftv res, leftv args)
Definition bbcone.cc:1597
containsPositiveVector
BOOLEAN containsPositiveVector(leftv res, leftv args)
Definition bbcone.cc:928
semigroupGenerator
BOOLEAN semigroupGenerator(leftv res, leftv args)
Definition bbcone.cc:996
dimension
BOOLEAN dimension(leftv res, leftv args)
Definition bbcone.cc:757
coneViaNormals
BOOLEAN coneViaNormals(leftv res, leftv args)
Definition bbcone.cc:352
faceContaining
BOOLEAN faceContaining(leftv res, leftv args)
Definition bbcone.cc:1735
setMultiplicity
BOOLEAN setMultiplicity(leftv res, leftv args)
Definition bbcone.cc:1114
bbcone_serialize
BOOLEAN bbcone_serialize(blackbox *b, void *d, si_link f)
Definition bbcone.cc:1944
generatorsOfLinealitySpace
BOOLEAN generatorsOfLinealitySpace(leftv res, leftv args)
Definition bbcone.cc:645
containsInSupport
BOOLEAN containsInSupport(leftv res, leftv args)
Definition bbcone.cc:1533
bbcone_Copy
void * bbcone_Copy(blackbox *, void *d)
Definition bbcone.cc:157
dualCone
BOOLEAN dualCone(leftv res, leftv args)
Definition bbcone.cc:962
isOrigin
BOOLEAN isOrigin(leftv res, leftv args)
Definition bbcone.cc:867
randomPoint
gfan::ZVector randomPoint(const gfan::ZCone *zc, const int b)
Definition bbcone.cc:1069
inequalities
BOOLEAN inequalities(leftv res, leftv args)
Definition bbcone.cc:560
setLinearForms
BOOLEAN setLinearForms(leftv res, leftv args)
Definition bbcone.cc:1136
coneID
VAR int coneID
Definition bbcone.cc:25
linealityDimension
BOOLEAN linealityDimension(leftv res, leftv args)
Definition bbcone.cc:825
hasFace
BOOLEAN hasFace(leftv res, leftv args)
Definition bbcone.cc:1641
relativeInteriorPoint
BOOLEAN relativeInteriorPoint(leftv res, leftv args)
Definition bbcone.cc:1021
bbcone_Op2
static BOOLEAN bbcone_Op2(int op, leftv res, leftv i1, leftv i2)
Definition bbcone.cc:164
rays
BOOLEAN rays(leftv res, leftv args)
Definition bbcone.cc:662
linealitySpace
BOOLEAN linealitySpace(leftv res, leftv args)
Definition bbcone.cc:945
coneViaRays
BOOLEAN coneViaRays(leftv res, leftv args)
Definition bbcone.cc:523
intersectCones
BOOLEAN intersectCones(leftv res, leftv args)
Definition bbcone.cc:1209
setBlackboxStuff
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
Definition blackbox.cc:143
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
convexHull
Definition mpr_base.cc:250
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211

## interiorPointsAndNormalsOfFacets()

std::pair< gfan::ZMatrix, gfan::ZMatrix > interiorPointsAndNormalsOfFacets | ( | const gfan::ZCone | zc,
|  | const std::set< gfan::ZVector > & | exceptThesePoints = std::set< gfan::ZVector >(),
|  | const bool | onlyLowerHalfSpace = false )

Definition at line 1853 of file bbcone.cc.

{
gfan::ZMatrix inequalities = zc.getFacets();
gfan::ZMatrix equations = zc.getImpliedEquations();
int r = inequalities.getHeight();
int c = inequalities.getWidth();
/* our cone has r facets, if r==0 return empty matrices */
gfan::ZMatrix relativeInteriorPoints = gfan::ZMatrix(0,c);
gfan::ZMatrix outerFacetNormals = gfan::ZMatrix(0,c);
if (r==0)
return std::make_pair(relativeInteriorPoints,outerFacetNormals);
/* next we iterate over each of the r facets,
* build the respective cone and add it to the list
* this is the i=0 case */
gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
gfan::ZMatrix newEquations = equations;
newEquations.appendRow(inequalities[0]);
gfan::ZCone facet = gfan::ZCone(newInequalities,newEquations);
gfan::ZVector interiorPoint = facet.getRelativeInteriorPoint();
if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
{
if (exceptThesePoints.count(interiorPoint)==0)
{
relativeInteriorPoints.appendRow(interiorPoint);
outerFacetNormals.appendRow(-inequalities[0].toVector());
}
}
/* these are the cases i=1,...,r-2 */
for (int i=1; i<r-1; i++)
{
newInequalities = inequalities.submatrix(0,0,i,c);
newInequalities.append(inequalities.submatrix(i+1,0,r,c));
newEquations = equations;
newEquations.appendRow(inequalities[i]);
facet = gfan::ZCone(newInequalities,newEquations);
interiorPoint = facet.getRelativeInteriorPoint();
if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
{
if (exceptThesePoints.count(interiorPoint)==0)
{
relativeInteriorPoints.appendRow(interiorPoint);
outerFacetNormals.appendRow(-inequalities[i].toVector());
}
}
}
/* this is the i=r-1 case */
newInequalities = inequalities.submatrix(0,0,r-1,c);
newEquations = equations;
newEquations.appendRow(inequalities[r-1]);
facet = gfan::ZCone(newInequalities,newEquations);
interiorPoint = facet.getRelativeInteriorPoint();
if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
{
if (exceptThesePoints.count(interiorPoint)==0)
{
relativeInteriorPoints.appendRow(interiorPoint);
outerFacetNormals.appendRow(-inequalities[r-1].toVector());
}
}
return std::make_pair(relativeInteriorPoints,outerFacetNormals);
}
i
int i
Definition cfEzgcd.cc:132
facet
Definition gfan.h:47
sign
static int sign(int x)
Definition ring.cc:3504

## interiorPointsOfFacets()

gfan::ZMatrix interiorPointsOfFacets | ( | const gfan::ZCone & | zc,
|  | const std::set< gfan::ZVector > & | exceptThese = std::set< gfan::ZVector >() )

Definition at line 1799 of file bbcone.cc.

{
gfan::ZMatrix inequalities = zc.getFacets();
gfan::ZMatrix equations = zc.getImpliedEquations();
int r = inequalities.getHeight();
int c = inequalities.getWidth();
/* our cone has r facets, if r==0 return empty matrices */
gfan::ZMatrix relativeInteriorPoints = gfan::ZMatrix(0,c);
if (r==0) return relativeInteriorPoints;
/* next we iterate over each of the r facets,
* build the respective cone and add it to the list
* this is the i=0 case */
gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
gfan::ZMatrix newEquations = equations;
newEquations.appendRow(inequalities[0]);
gfan::ZCone facet = gfan::ZCone(newInequalities,newEquations);
facet.canonicalize();
gfan::ZVector interiorPoint = facet.getRelativeInteriorPoint();
if (exceptThese.count(interiorPoint)==0)
relativeInteriorPoints.appendRow(interiorPoint);
/* these are the cases i=1,...,r-2 */
for (int i=1; i<r-1; i++)
{
newInequalities = inequalities.submatrix(0,0,i,c);
newInequalities.append(inequalities.submatrix(i+1,0,r,c));
newEquations = equations;
newEquations.appendRow(inequalities[i]);
facet = gfan::ZCone(newInequalities,newEquations);
facet.canonicalize();
interiorPoint = facet.getRelativeInteriorPoint();
if (exceptThese.count(interiorPoint)==0)
relativeInteriorPoints.appendRow(interiorPoint);
}
/* this is the i=r-1 case */
newInequalities = inequalities.submatrix(0,0,r-1,c);
newEquations = equations;
newEquations.appendRow(inequalities[r-1]);
facet = gfan::ZCone(newInequalities,newEquations);
facet.canonicalize();
interiorPoint = facet.getRelativeInteriorPoint();
if (exceptThese.count(interiorPoint)==0)
relativeInteriorPoints.appendRow(interiorPoint);
return relativeInteriorPoints;
}

## liftUp()

gfan::ZCone liftUp | ( | const gfan::ZCone & | zc | ) |

Definition at line 1182 of file bbcone.cc.

{
gfan::ZMatrix ineq=zc.getInequalities();
gfan::ZMatrix eq=zc.getEquations();
gfan::ZCone zd(liftUp(ineq),liftUp(eq));
return zd;
}
liftUp
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition bbcone.cc:1170

## randomPoint()

gfan::ZVector randomPoint | ( | const gfan::ZCone * | zc,
|  | const int | b = 0 )

Definition at line 1069 of file bbcone.cc.

{
gfan::ZVector rp = gfan::ZVector(zc->ambientDimension());
gfan::ZMatrix rays = zc->extremeRays();
for (int i=0; i<rays.getHeight(); i++)
rp += siRandBound(b) * rays[i].toVector();
// gfan::ZMatrix lins = zc->generatorsOfLinealitySpace();
// for (int i=0; i<lins.getHeight(); i++)
// {
// int n = siRandBound(b);
// rp = rp + n * lins[i].toVector();
// }
return rp;
}
siRandBound
int siRandBound(const int b)
Definition bbcone.cc:1055

## toString()

std::string toString | ( | const gfan::ZCone *const | c | ) |

Definition at line 27 of file bbcone.cc.

{
std::stringstream s;
s<<"AMBIENT_DIM"<<std::endl;
s<<c->ambientDimension()<<std::endl;
gfan::ZMatrix i=c->getInequalities();
char* ineqs = toString(i);
if (c->areFacetsKnown())
s<<"FACETS"<<std::endl;
else
s<<"INEQUALITIES"<<std::endl;
if (ineqs!=NULL)
{
s<<ineqs<<std::endl;
omFree(ineqs);
}
gfan::ZMatrix e=c->getEquations();
char* eqs = toString(e);
if (c->areImpliedEquationsKnown())
s<<"LINEAR_SPAN"<<std::endl;
else
s<<"EQUATIONS"<<std::endl;
if (eqs!=NULL)
{
s<<eqs<<std::endl;
omFree(eqs);
}
if (c->areExtremeRaysKnown())
{
gfan::ZMatrix r=c->extremeRays();
char* rs = toString(r);
s<<"RAYS"<<std::endl;
if (rs!=NULL)
{
s<<rs<<std::endl;
omFree(rs);
}
gfan::ZMatrix l=c->generatorsOfLinealitySpace();
char* ls = toString(l);
s<<"LINEALITY_SPACE"<<std::endl;
if (ls!=NULL)
{
s<<ls<<std::endl;
omFree(ls);
}
}
return s.str();
}
toString
std::string toString(const gfan::ZCone *const c)
Definition bbcone.cc:27
l
int l
Definition cfEzgcd.cc:100
s
const CanonicalForm int s
Definition facAbsFact.cc:51
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
NULL
#define NULL
Definition omList.c:12

## Variable Documentation

## coneID

EXTERN_VAR int coneID

Definition at line 14 of file bbcone.h.