[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323
Bernhard R. Link
brlink at debian.org
Tue Apr 24 15:53:01 UTC 2012
The following commit has been merged in the cleanedupstream branch:
commit cece91c0a9ebcc36b3db1e3ca4f5bb5331241603
Author: Yue Ren <ren at mathematik.uni-kl.de>
Date: Wed Feb 8 18:13:55 2012 +0100
fixed a typo
diff --git a/callpolymake/polymake.cc b/callpolymake/polymake.cc
index 98eb346..577ab97 100755
--- a/callpolymake/polymake.cc
+++ b/callpolymake/polymake.cc
@@ -3,7 +3,7 @@
#include </usr/local/include/polymake/Rational.h>
#include </usr/local/include/polymake/Integer.h>
#include </usr/local/include/polymake/perl/macros.h>
-#include </usr/local/include/polymake/next/Set.h>
+#include </usr/local/include/polymake/Set.h>
#include </usr/local/include/polymake/next/IncidenceMatrix.h>
#include </usr/local/include/gfanlib.h>
@@ -934,7 +934,7 @@ BOOLEAN PMminkowskiSum(leftv res, leftv args)
gfan::ZCone* zq = (gfan::ZCone*)v->Data();
polymake::perl::Object pq = ZPolytope2PmPolytope(zq);
polymake::perl::Object pms;
- CallPolymakeFunction("mikowski_sum", pp, pq) >> pms;
+ CallPolymakeFunction("minkowski_sum", pp, pq) >> pms;
gfan::ZCone* ms = new gfan::ZCone(PmPolytope2ZPolytope(&pms));
res->rtyp = polytopeID;
res->data = (char*) ms;
@@ -946,6 +946,24 @@ BOOLEAN PMminkowskiSum(leftv res, leftv args)
}
+polymake::Matrix<polymake::Integer> raysOf(const polymake::perl::Object* zf,
+ const polymake::Set<polymake::Integer>* s)
+{
+ polymake::Matrix<polymake::Integer> allrays = zf->give("RAYS");
+ polymake::Matrix<polymake::Integer> wantedrays;
+ bool ok = true;
+ for(Entire<Set<Integer> >::const_iterator i=polymake::entire(*s); !i.at_end(); i++)
+ {
+ wantedrays = wantedrays / allrays.row(PmInteger2Int(*i,ok));
+ }
+ if (!ok)
+ {
+ WerrorS("overflow while converting polymake::Integer to int in raysOf");
+ }
+ return wantedrays;
+}
+
+
BOOLEAN PMmaximalFace(leftv res, leftv args)
{
leftv u = args;
@@ -961,7 +979,8 @@ BOOLEAN PMmaximalFace(leftv res, leftv args)
o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
p.take("LP") << o;
polymake::Set<polymake::Integer> mf = p.give("LP.MAXIMAL_FACE");
- intvec* maxface = new intvec(PmSetInteger2Intvec(&mf));
+ polymake::Matrix<polymake::Integer> rays = raysOf(&p,&mf);
+ intvec* maxface = new intvec(PmMatrixInteger2Intvec(&rays));
res->rtyp = INTVEC_CMD;
res->data = (char*) maxface;
return FALSE;
@@ -976,23 +995,24 @@ BOOLEAN PMminimalFace(leftv res, leftv args)
{
leftv u = args;
if ((u != NULL) && (u->Typ() == polytopeID))
+ {
+ leftv v = u->next;
+ if ((v != NULL) && (v->Typ() == INTVEC_CMD))
{
- leftv v = u->next;
- if ((v != NULL) && (v->Typ() == INTVEC_CMD))
- {
- gfan::ZCone* zp = (gfan::ZCone*)u->Data();
- polymake::perl::Object p = ZPolytope2PmPolytope(zp);
- intvec* iv = (intvec*) v->Data();
- polymake::perl::Object o("LinearProgram<Rational>");
- o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
- p.take("LP") << o;
- polymake::Set<polymake::Integer> mf = p.give("LP.MINIMAL_FACE");
- intvec* maxface = new intvec(PmSetInteger2Intvec(&mf));
- res->rtyp = INTVEC_CMD;
- res->data = (char*) maxface;
- return FALSE;
- }
+ gfan::ZCone* zp = (gfan::ZCone*)u->Data();
+ polymake::perl::Object p = ZPolytope2PmPolytope(zp);
+ intvec* iv = (intvec*) v->Data();
+ polymake::perl::Object o("LinearProgram<Rational>");
+ o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
+ p.take("LP") << o;
+ polymake::Set<polymake::Integer> mf = p.give("LP.MINIMAL_FACE");
+ polymake::Matrix<polymake::Integer> rays = raysOf(&p,&mf);
+ intvec* minface = new intvec(PmMatrixInteger2Intvec(&rays));
+ res->rtyp = INTVEC_CMD;
+ res->data = (char*) minface;
+ return FALSE;
}
+ }
WerrorS("minimalFace: unexpected parameters");
return TRUE;
}
@@ -1244,6 +1264,19 @@ BOOLEAN testingvisuals(leftv res, leftv args) // for testing purposes
}
+BOOLEAN testingstrings(leftv res, leftv args)
+{
+ leftv u = args;
+ gfan::ZFan* zf = (gfan::ZFan*) u->Data();
+ std::string zs = zf->toString();
+ std::istringstream s(zs);
+ gfan::ZFan* zg = new gfan::ZFan(s);
+ res->rtyp = fanID;
+ res->data = (char*) zg;
+ return FALSE;
+}
+
+
extern "C" int mod_init(void* polymakesingular)
{
@@ -1292,5 +1325,6 @@ extern "C" int mod_init(void* polymakesingular)
// iiAddCproc("","testingpolytopes",FALSE,testingpolytopes);
// iiAddCproc("","testingfans",FALSE,testingfans);
iiAddCproc("","testingvisuals",FALSE,testingvisuals);
+ iiAddCproc("","testingstrings",FALSE,testingstrings);
}
--
an open source computer algebra system
More information about the debian-science-commits
mailing list