Skip to content

Commit

Permalink
new: containsAsFace for polytopes; fix: canonicalize() in gfanlib
Browse files Browse the repository at this point in the history
  • Loading branch information
Yue Ren committed May 9, 2012
1 parent f991eb3 commit d16d283
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
16 changes: 15 additions & 1 deletion callgfanlib/bbcone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,22 @@ BOOLEAN hasFace(leftv res, leftv args)
return FALSE;
}
}
if ((u != NULL) && (u->Typ() == polytopeID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == polytopeID))
{
gfan::ZCone* zc = (gfan::ZCone*)u->Data();
gfan::ZCone* zd = (gfan::ZCone*)v->Data();
bool b = zc->hasFace(*zd);
int bb = (int) b;
res->rtyp = INT_CMD;
res->data = (char*) bb;
return FALSE;
}
}
WerrorS("hasFace: unexpected parameters");
return TRUE;
return TRUE;
}

BOOLEAN canonicalizeCone(leftv res, leftv args)
Expand Down
1 change: 1 addition & 0 deletions callgfanlib/bbpolytope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ void bbpolytope_setup()
// iiAddCproc("","getLinearForms",FALSE,getLinearForms);
// iiAddCproc("","setMultiplicity",FALSE,setMultiplicity);
// iiAddCproc("","getMultiplicity",FALSE,getMultiplicity);
// iiAddCproc("","hasFace",FALSE,hasFace);
/***************************************************************/
// iiAddCproc("","getEquations",FALSE,getEquations);
// iiAddCproc("","getInequalities",FALSE,getInequalities);
Expand Down
13 changes: 5 additions & 8 deletions gfanlib/gfanlib_zcone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ void ZCone::ensureStateAsMinimum(int s)const
{
QMatrix m=ZToQMatrix(equations);
m.reduce();
m.REformToRREform();
ZMatrix inequalities2(0,equations.getWidth());
for(int i=0;i<inequalities.getHeight();i++)
{
Expand All @@ -709,6 +710,7 @@ void ZCone::ensureStateAsMinimum(int s)const
{
QMatrix equations2=ZToQMatrix(equations);
equations2.reduce(false,false,true);
equations2.REformToRREform();

for(int i=0;i<inequalities.getHeight();i++)
{
Expand Down Expand Up @@ -1299,16 +1301,11 @@ std::string toString(ZCone const &c)
bool ZCone::hasFace(ZCone const &f)const
{
if(!contains(f.getRelativeInteriorPoint()))return false;
ZCone temp=faceContaining(f.getRelativeInteriorPoint());
temp.canonicalize();
ZCone temp1=faceContaining(f.getRelativeInteriorPoint());
temp1.canonicalize();
ZCone temp2=f;
temp2.canonicalize();
if(temp.dimension()==temp2.dimension())
{
return !(temp2!=temp);
}
else
return false;
return !(temp2!=temp1);
}

ZCone ZCone::faceContaining(ZVector const &v)const
Expand Down

0 comments on commit d16d283

Please sign in to comment.