[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323
Bernhard R. Link
brlink at debian.org
Tue Apr 24 15:53:32 UTC 2012
The following commit has been merged in the cleanedupstream branch:
commit 7e14cfc86a7ba03ecdf124ee38b7566290eae469
Author: Yue Ren <ren at mathematik.uni-kl.de>
Date: Wed Feb 15 11:27:04 2012 +0100
moved gfanlib<->Singular libraries, fixed headers for blackbox
moved all things in Singular regarding gfanlib to folder "callgfanlib",
however still need configure file for that folder.
fixed headers for blackbox: <omalloc.h> -> <omalloc/omalloc.h>
diff --git a/Singular/Makefile.in b/Singular/Makefile.in
index c6a3ecb..f73705c 100644
--- a/Singular/Makefile.in
+++ b/Singular/Makefile.in
@@ -228,9 +228,13 @@ CXXSOURCES=grammar.cc scanner.cc attrib.cc \
MinorProcessor.cc \
MinorInterface.cc \
bigintm.cc pyobject_setup.cc \
- bbcone.cc bbpolytope.cc bbfan.cc denom_list.cc \
+ denom_list.cc \
minpoly.cc
+ifdef HAVE_FANS
+CXXSOURCES+= bbcone.cc bbpolytope.cc bbfan.cc
+endif
+
# stuff for MP
MPSR_SOURCES = mpsr_Put.cc mpsr_PutPoly.cc mpsr_GetPoly.cc mpsr_sl.cc\
mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \
diff --git a/Singular/blackbox.h b/Singular/blackbox.h
index 6da22fb..408858c 100644
--- a/Singular/blackbox.h
+++ b/Singular/blackbox.h
@@ -1,6 +1,6 @@
#ifndef BLACKBOX_H
#define BLACKBOX_H
-#include <omalloc.h>
+#include <omalloc/omalloc.h>
#include <kernel/structs.h>
#include <kernel/febase.h>
#include <Singular/silink.h>
diff --git a/Singular/tesths.cc b/Singular/tesths.cc
index 05001ca..5ec59c7 100644
--- a/Singular/tesths.cc
+++ b/Singular/tesths.cc
@@ -36,9 +36,9 @@
#include <omalloc/omalloc.h>
#ifdef HAVE_FANS
-#include <kernel/bbcone.h>
-#include <kernel/bbpolytope.h>
-#include <kernel/bbfan.h>
+#include <callgfanlib/bbcone.h>
+#include <callgfanlib/bbpolytope.h>
+#include <callgfanlib/bbfan.h>
#endif
#ifdef HAVE_FACTORY
diff --git a/callgfanlib/Makefile b/callgfanlib/Makefile
new file mode 100755
index 0000000..b9ddc90
--- /dev/null
+++ b/callgfanlib/Makefile
@@ -0,0 +1,12 @@
+all: gfanlib
+
+gfanlib:
+ g++ -o bbcone.o -fpic -I/home/ren/Sources/ -c -g bbcone.cc
+ g++ -o bbfan.o -fpic -I/home/ren/Sources/ -c -g bbfan.cc
+ g++ -o bbpolytope.o -fpic -I/home/ren/Sources/ -c -g bbpolytope.cc
+ g++ -o gfanlib.o -fpic -I/home/ren/Sources/ -c -g gfanlib.cc
+ g++ -shared -o gfanlib.so bbcone.o bbfan.o bbpolytope.o gfanlib.o -L/usr/local/lib -lcddgmp -lgmpxx ../gfanlib/*.o
+
+clean:
+ rm *.so *.o
+
diff --git a/Singular/bbcone.cc b/callgfanlib/bbcone.cc
similarity index 99%
rename from Singular/bbcone.cc
rename to callgfanlib/bbcone.cc
index b2e9826..942a7c5 100644
--- a/Singular/bbcone.cc
+++ b/callgfanlib/bbcone.cc
@@ -13,9 +13,9 @@
#include <kernel/intvec.h>
#include <sstream>
-#include <kernel/bbcone.h>
-#include <kernel/bbfan.h>
-#include <kernel/bbpolytope.h>
+#include <callgfanlib/bbcone.h>
+#include <callgfanlib/bbfan.h>
+#include <callgfanlib/bbpolytope.h>
int coneID;
diff --git a/kernel/bbcone.h b/callgfanlib/bbcone.h
similarity index 96%
rename from kernel/bbcone.h
rename to callgfanlib/bbcone.h
index c3e67fc..50dd871 100755
--- a/kernel/bbcone.h
+++ b/callgfanlib/bbcone.h
@@ -3,6 +3,7 @@
#ifdef HAVE_FANS
#include <gfanlib/gfanlib.h>
+#include <kernel/intvec.h>
extern int coneID;
diff --git a/Singular/bbfan.cc b/callgfanlib/bbfan.cc
similarity index 99%
rename from Singular/bbfan.cc
rename to callgfanlib/bbfan.cc
index 866a50d..ea56ec6 100644
--- a/Singular/bbfan.cc
+++ b/callgfanlib/bbfan.cc
@@ -7,13 +7,14 @@
#include <kernel/febase.h>
#include <kernel/longrat.h>
#include <Singular/subexpr.h>
-#include <kernel/bbfan.h>
-#include <kernel/bbcone.h>
#include <Singular/ipshell.h>
#include <kernel/intvec.h>
#include <sstream>
#include <gfanlib/gfanlib.h>
+#include <callgfanlib/bbfan.h>
+#include <callgfanlib/bbcone.h>
+
int fanID;
void *bbfan_Init(blackbox *b)
diff --git a/kernel/bbfan.h b/callgfanlib/bbfan.h
similarity index 100%
rename from kernel/bbfan.h
rename to callgfanlib/bbfan.h
diff --git a/Singular/bbpolytope.cc b/callgfanlib/bbpolytope.cc
similarity index 99%
rename from Singular/bbpolytope.cc
rename to callgfanlib/bbpolytope.cc
index 9e1faff..0a615c5 100644
--- a/Singular/bbpolytope.cc
+++ b/callgfanlib/bbpolytope.cc
@@ -9,13 +9,13 @@
#include <kernel/longrat.h>
#include <Singular/subexpr.h>
#include <gfanlib/gfanlib.h>
-#include <kernel/bbcone.h>
#include <Singular/ipshell.h>
#include <kernel/intvec.h>
#include <kernel/ring.h>
#include <kernel/polys.h>
#include <sstream>
+#include <callgfanlib/bbcone.h>
int polytopeID;
diff --git a/kernel/bbpolytope.h b/callgfanlib/bbpolytope.h
similarity index 100%
rename from kernel/bbpolytope.h
rename to callgfanlib/bbpolytope.h
diff --git a/callgfanlib/gfanlib.cc b/callgfanlib/gfanlib.cc
new file mode 100644
index 0000000..8286785
--- /dev/null
+++ b/callgfanlib/gfanlib.cc
@@ -0,0 +1,16 @@
+#include <Singular/mod2.h>
+#include <callgfanlib/bbcone.h>
+#include <callgfanlib/bbfan.h>
+#include <callgfanlib/bbpolytope.h>
+
+template class gfan::Vector<gfan::Integer>;
+template class gfan::Vector<gfan::Rational>;
+template class gfan::Matrix<gfan::Integer>;
+template class gfan::Matrix<gfan::Rational>;
+
+extern "C" int mod_init(void* gfanlibsingular)
+{
+ bbcone_setup();
+ bbfan_setup();
+ bbpolytope_setup();
+}
diff --git a/callpolymake/polymake.cc b/callpolymake/polymake.cc
index 645802b..4ac5f6d 100755
--- a/callpolymake/polymake.cc
+++ b/callpolymake/polymake.cc
@@ -25,6 +25,9 @@
using namespace polymake;
+
+polymake::Main* init_polymake=NULL;
+
/* Functions for converting Integers, Rationals and their Matrices
in between C++, gfan, polymake and singular */
@@ -379,19 +382,20 @@ BOOLEAN PMisBounded(leftv res, leftv args)
if ((u != NULL) && (u->Typ() == polytopeID))
{
gfan::ZCone* zp = (gfan::ZCone*)u->Data();
+ bool b;
try
{
polymake::perl::Object p = ZPolytope2PmPolytope(zp);
- bool b = p.give("BOUNDED");
- res->rtyp = INT_CMD;
- res->data = (char*) (int) b;
- return FALSE;
+ b = p.give("BOUNDED");
}
catch (const std::exception& ex)
{
std::cerr << "ERROR: " << ex.what() << endl;
return TRUE;
}
+ res->rtyp = INT_CMD;
+ res->data = (char*) (int) b;
+ return FALSE;
}
WerrorS("isBounded: unexpected parameters");
return TRUE;
@@ -404,19 +408,20 @@ BOOLEAN PMisReflexive(leftv res, leftv args)
if ((u != NULL) && (u->Typ() == polytopeID))
{
gfan::ZCone* zp = (gfan::ZCone*)u->Data();
+ bool b;
try
{
polymake::perl::Object p = ZPolytope2PmPolytope(zp);
- bool b = p.give("REFLEXIVE");
- res->rtyp = INT_CMD;
- res->data = (char*) (int) b;
- return FALSE;
+ b = p.give("REFLEXIVE");
}
catch (const std::exception& ex)
{
std::cerr << "ERROR: " << ex.what() << endl;
return TRUE;
}
+ res->rtyp = INT_CMD;
+ res->data = (char*) (int) b;
+ return FALSE;
}
WerrorS("isReflexive: unexpected parameters");
return TRUE;
@@ -429,19 +434,20 @@ BOOLEAN PMisGorenstein(leftv res, leftv args)
if ((u != NULL) && (u->Typ() == polytopeID))
{
gfan::ZCone* zp = (gfan::ZCone*)u->Data();
+ bool b;
try
{
polymake::perl::Object p = ZPolytope2PmPolytope(zp);
- bool b = p.give("GORENSTEIN");
- res->rtyp = INT_CMD;
- res->data = (char*) (int) b;
- return FALSE;
+ b = p.give("GORENSTEIN");
}
catch (const std::exception& ex)
{
std::cerr << "ERROR: " << ex.what() << endl;
return TRUE;
}
+ res->rtyp = INT_CMD;
+ res->data = (char*) (int) b;
+ return FALSE;
}
WerrorS("isGorenstein: unexpected parameters");
return TRUE;
@@ -466,15 +472,15 @@ BOOLEAN PMgorensteinIndex(leftv res, leftv args)
WerrorS("overflow while converting polymake::Integer to int");
return TRUE;
}
+ res->rtyp = INT_CMD;
+ res->data = (char*) (int) gi;
+ return FALSE;
}
catch (const std::exception& ex)
{
std::cerr << "ERROR: " << ex.what() << endl;
return TRUE;
}
- res->rtyp = INT_CMD;
- res->data = (char*) (int) gi;
- return FALSE;
}
WerrorS("gorensteinIndex: unexpected parameters");
return TRUE;
@@ -1187,7 +1193,7 @@ BOOLEAN PMminkowskiSum(leftv res, leftv args)
polymake::perl::Object pq = ZPolytope2PmPolytope(zq);
polymake::perl::Object pms;
CallPolymakeFunction("minkowski_sum", pp, pq) >> pms;
- gfan::ZCone* ms = new gfan::ZCone(PmPolytope2ZPolytope(&pms));
+ ms = new gfan::ZCone(PmPolytope2ZPolytope(&pms));
}
catch (const std::exception& ex)
{
@@ -1241,7 +1247,7 @@ BOOLEAN PMmaximalFace(leftv res, leftv args)
p.take("LP") << o;
polymake::Set<polymake::Integer> mf = p.give("LP.MAXIMAL_FACE");
polymake::Matrix<polymake::Integer> rays = raysOf(&p,&mf);
- intvec* maxface = new intvec(PmMatrixInteger2Intvec(&rays));
+ maxface = new intvec(PmMatrixInteger2Intvec(&rays));
}
catch (const std::exception& ex)
{
@@ -1277,7 +1283,7 @@ BOOLEAN PMminimalFace(leftv res, leftv args)
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));
+ minface = new intvec(PmMatrixInteger2Intvec(&rays));
}
catch (const std::exception& ex)
{
@@ -1315,7 +1321,7 @@ BOOLEAN PMmaximalValue(leftv res, leftv args)
p.take("LP") << o;
polymake::Integer mv = p.give("LP.MAXIMAL_VALUE");
bool ok = true;
- int m = PmInteger2Int(mv,ok);
+ m = PmInteger2Int(mv,ok);
if (!ok)
{
WerrorS("overflow while converting polymake::Integer to int");
@@ -1358,7 +1364,7 @@ BOOLEAN PMminimalValue(leftv res, leftv args)
p.take("LP") << o;
polymake::Integer mv = p.give("LP.MINIMAL_VALUE");
bool ok = true;
- int m = PmInteger2Int(mv,ok);
+ m = PmInteger2Int(mv,ok);
if (!ok)
{
WerrorS("overflow while converting polymake::Integer to int");
@@ -1383,7 +1389,7 @@ BOOLEAN PMminimalValue(leftv res, leftv args)
BOOLEAN visual(leftv res, leftv args)
{
leftv u = args;
- if ((u != NULL) && (u->Typ() == coneID))
+ if ((u != NULL) && (u->Typ() == polytopeID))
{
gfan::ZCone* zc = (gfan::ZCone*)u->Data();
gfan::ZMatrix rays = zc->extremeRays();
@@ -1448,7 +1454,7 @@ BOOLEAN normalFan(leftv res, leftv args)
res->data = (char*) zf;
return FALSE;
}
- WerrorS("normal_fan: unexpected parameters");
+ WerrorS("normalFan: unexpected parameters");
return TRUE;
}
@@ -1544,17 +1550,18 @@ BOOLEAN normalFan(leftv res, leftv args)
BOOLEAN testingvisuals(leftv res, leftv args) // for testing purposes
{ // testing visualization of fans
try{ // exactly same as smalltest
- perl::Object p("Polytope<Rational>");
- p = CallPolymakeFunction("cube",3);
- // Matrix<Integer> zm=(unit_matrix<Integer>(3));
- // p.take("INPUT_RAYS") << zm;
- // Set<int> s;
- // s = s+0;
- // s = s+1;
- // s = s+2;
- // Array<Set<int> > ar(1);
- // ar[0]=s;
- // p.take("INPUT_CONES") << ar;
+ // perl::Object p("Polytope<Rational>");
+ // p = CallPolymakeFunction("cube",3);
+ perl::Object p("PolyhedralFan");
+ Matrix<Integer> zm=(unit_matrix<Integer>(3));
+ p.take("INPUT_RAYS") << zm;
+ Set<int> s;
+ s = s+0;
+ s = s+1;
+ s = s+2;
+ Array<Set<int> > ar(1);
+ ar[0]=s;
+ p.take("INPUT_CONES") << ar;
VoidCallPolymakeFunction("jreality",p.CallPolymakeMethod("VISUAL"));
res->rtyp = NONE;
res->data = NULL;
@@ -1613,8 +1620,9 @@ BOOLEAN testingstrings(leftv res, leftv args)
extern "C" int mod_init(void* polymakesingular)
{
- polymake::Main init_polymake;
- init_polymake.set_application("fan");
+ if (init_polymake==NULL)
+ {init_polymake = new polymake::Main();}
+ init_polymake->set_application("fan");
// iiAddCproc("","cube",FALSE,cube);
// iiAddCproc("","cross",FALSE,cross);
iiAddCproc("","isBounded",FALSE,PMisBounded);
diff --git a/kernel/gfan.h b/kernel/gfan.h
index b4ab7bd..19de342 100644
--- a/kernel/gfan.h
+++ b/kernel/gfan.h
@@ -16,8 +16,8 @@ $Id: gfan.h 14338 2011-07-18 12:05:21Z hannes $
#include <setoper.h>
#include <cdd.h>
#include <cddmp.h>
-#include <kernel/bbfan.h>
-#include <kernel/bbcone.h>
+#include <callgfanlib/bbfan.h>
+#include <callgfanlib/bbcone.h>
extern int gfanHeuristic;
#ifndef USE_ZFAN
--
an open source computer algebra system
More information about the debian-science-commits
mailing list