Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346#ifndef POLYMAKEDATA1#define POLYMAKEDATA 123#include "loadgap.h"45#include <polymake/Main.h>6#include <polymake/Matrix.h>7#include <polymake/IncidenceMatrix.h>8#include <polymake/Rational.h>9#include <polymake/common/lattice_tools.h>1011#include <iostream>12#include <map>13#include <utility>1415using std::cerr;16using std::endl;17using std::string;18using std::map;19using std::pair;2021extern Obj TheTypeExternalPolymakeCone;22extern Obj TheTypeExternalPolymakeFan;23extern Obj TheTypeExternalPolymakePolytope;24extern Obj TheTypeExternalPolymakeTropicalHypersurface;25extern Obj TheTypeExternalPolymakeTropicalPolytope;2627typedef pair<int, pm::perl::Object*> object_pair;28typedef pm::perl::Object perlobj;29typedef map<int, pm::perl::Object*>::iterator iterator;3031struct Polymake_Data {32bool initialized;33polymake::Main *main_polymake_session;34polymake::perl::Scope *main_polymake_scope;35map<int, pm::perl::Object*> *polymake_objects;36int new_polymake_object_number;37};3839#define POLYMAKEOBJ_SET_PERLOBJ(o, p) (ADDR_OBJ(o)[1] = reinterpret_cast<Obj>(p))40#define PERLOBJ_POLYMAKEOBJ(o) (reinterpret_cast<perlobj*>(ADDR_OBJ(o)[1]))4142#define IS_POLYMAKE_CONE(o) ((UInt)(ADDR_OBJ(o)[0])==(UInt)TheTypeExternalPolymakeCone)43#define IS_POLYMAKE_POLYTOPE(o) ((UInt)(ADDR_OBJ(o)[0])==(UInt)TheTypeExternalPolymakePolytope)44#define IS_POLYMAKE_FAN(o) ((UInt)(ADDR_OBJ(o)[0])==(UInt)TheTypeExternalPolymakeFan)45#define IS_POLYMAKE_TROPICAL_HYPERSURFACE(o) ((UInt)(ADDR_OBJ(o)[0])==(UInt)TheTypeExternalPolymakeTropicalHypersurface)46#define IS_POLYMAKE_TROPICAL_POLYTOPE(o) ((UInt)(ADDR_OBJ(o)[0])==(UInt)TheTypeExternalPolymakeTropicalPolytope)47#define IS_POLYMAKE_OBJECT(o) ((IS_POLYMAKE_CONE(o))||(IS_POLYMAKE_POLYTOPE(o))||(IS_POLYMAKE_FAN(o))||(IS_POLYMAKE_TROPICAL_HYPERSURFACE(o))||(IS_POLYMAKE_TROPICAL_POLYTOPE(o)))4849enum polymake_object_type {50T_POLYMAKE_EXTERNAL_CONE,51T_POLYMAKE_EXTERNAL_FAN,52T_POLYMAKE_EXTERNAL_POLYTOPE,53T_POLYMAKE_EXTERNAL_TROPICAL_HYPERSURFACE,54T_POLYMAKE_EXTERNAL_TROPICAL_POLYTOPE55};56Obj NewPolymakeExternalObject(enum polymake_object_type t);57void ExternalPolymakeObjectFreeFunc(Obj o);58Obj ExternalPolymakeObjectTypeFunc(Obj o);5960void polymake_start( Polymake_Data* );616263// Obj x = NewPolymakeExternalObject(T_POLYMAKE_EXTERNAL_CONE);64// POLYMAKEOBJ_SET_PERLOBJ(x, p);6566#define POLYMAKE_GAP_CATCH \67catch( std::exception& err ){ \68cerr << "Polymake error: " << endl << err.what( ) << endl; \69ErrorMayQuit("during polymake computation.",0,0); \70}7172#endif737475