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#include "polymake_fktn.h"123Obj REAL_IS_SIMPLICIAL_OBJECT( Polymake_Data* data, Obj cone ){45#ifdef MORE_TESTS6if(! IS_POLYMAKE_OBJECT(cone) ){7ErrorMayQuit(" parameter is not a polymake object.",0,0);8return NULL;9}10#endif1112perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );13data->main_polymake_session->set_application_of(*coneobj);14bool i;15try{16coneobj->give("SIMPLICIAL") >> i;17}1819POLYMAKE_GAP_CATCH2021if(i) return True; return False;2223}242526Obj REAL_IS_LATTICE_OBJECT( Polymake_Data* data, Obj cone ){2728#ifdef MORE_TESTS29if(! IS_POLYMAKE_OBJECT(cone) ){30ErrorMayQuit(" parameter is not a polymake object.",0,0);31return NULL;32}33#endif3435perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );36data->main_polymake_session->set_application_of(*coneobj);3738bool i;39try{40coneobj->give("LATTICE") >> i;41}4243POLYMAKE_GAP_CATCH4445if(i) return True; return False;4647}484950Obj REAL_IS_NORMAL_OBJECT( Polymake_Data* data, Obj cone ){5152#ifdef MORE_TESTS53if(! IS_POLYMAKE_OBJECT(cone) ){54ErrorMayQuit(" parameter is not a polymake object.",0,0);55return NULL;56}57#endif5859perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );60data->main_polymake_session->set_application_of(*coneobj);6162bool i;63try{64coneobj->give("NORMAL") >> i;65}6667POLYMAKE_GAP_CATCH6869if(i) return True; return False;7071}727374Obj REAL_IS_SMOOTH_OBJECT( Polymake_Data* data, Obj cone ){7576#ifdef MORE_TESTS77if(! IS_POLYMAKE_OBJECT(cone) ){78ErrorMayQuit(" parameter is not a polymake object.",0,0);79return NULL;80}81#endif8283perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );84data->main_polymake_session->set_application_of(*coneobj);8586bool i;87try{88coneobj->give("SMOOTH") >> i;89}9091POLYMAKE_GAP_CATCH9293if(i) return True; return False;9495}969798Obj REAL_IS_VERYAMPLE_OBJECT( Polymake_Data* data, Obj cone ){99100#ifdef MORE_TESTS101if(! IS_POLYMAKE_OBJECT(cone) ){102ErrorMayQuit(" parameter is not a polymake object.",0,0);103return NULL;104}105#endif106107perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );108data->main_polymake_session->set_application_of(*coneobj);109110bool i;111try{112coneobj->give("VERY_AMPLE") >> i;113}114115POLYMAKE_GAP_CATCH116117if(i) return True; return False;118119}120121122Obj REAL_OBJECT_HAS_PROPERTY( Polymake_Data* data, Obj cone, const char* prop ){123124#ifdef MORE_TESTS125if(! IS_POLYMAKE_OBJECT(cone) ){126ErrorMayQuit(" parameter is not a polymake object.",0,0);127return NULL;128}129#endif130131perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );132data->main_polymake_session->set_application_of(*coneobj);133134bool i;135try{136coneobj->give(prop) >> i;137}138139POLYMAKE_GAP_CATCH140141if(i) return True; return False;142143}144145Obj REAL_OBJECT_HAS_INT_PROPERTY( Polymake_Data* data, Obj cone, const char* prop ){146147#ifdef MORE_TESTS148if(! IS_POLYMAKE_OBJECT(cone) ){149ErrorMayQuit(" parameter is not a polymake object.",0,0);150return NULL;151}152#endif153154perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );155data->main_polymake_session->set_application_of(*coneobj);156157int i;158try{159coneobj->give(prop) >> i;160}161162POLYMAKE_GAP_CATCH163164return INTOBJ_INT( i );165}166167168Obj REAL_POLYMAKE_DRAW( Polymake_Data* data, Obj cone ){169170#ifdef MORE_TESTS171if(! IS_POLYMAKE_OBJECT(cone) ){172ErrorMayQuit(" parameter is not a polymake object.",0,0);173return NULL;174}175#endif176177perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );178data->main_polymake_session->set_application_of(*coneobj);179try{180coneobj->VoidCallPolymakeMethod("VISUAL");181}182183POLYMAKE_GAP_CATCH184185return True;186187}188189190void REAL_SET_PROPERTY_TRUE( Polymake_Data* data, Obj conv, const char* prop){191192#ifdef MORE_TESTS193if(! IS_POLYMAKE_OBJECT(conv) ){194ErrorMayQuit(" parameter is not a polymake object.",0,0);195return;196}197#endif198199perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( conv );200data->main_polymake_session->set_application_of(*coneobj);201try{202coneobj->take(prop) << true;203}204205POLYMAKE_GAP_CATCH206207}208209Obj REAL_POLYMAKE_SKETCH( Polymake_Data* data, Obj cone ){210211#ifdef MORE_TESTS212if(! IS_POLYMAKE_OBJECT(cone) ){213ErrorMayQuit(" parameter is not a polymake object.",0,0);214return NULL;215}216#endif217218perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );219data->main_polymake_session->set_application_of(*coneobj);220try{221VoidCallPolymakeFunction( "sketch", coneobj->CallPolymakeMethod("VISUAL") );222}223224POLYMAKE_GAP_CATCH225226return True;227228}229230Obj REAL_POLYMAKE_SKETCH_WITH_OPTIONS( Polymake_Data* data, Obj cone, Obj filename, Obj options ){231#ifdef MORE_TESTS232if(! IS_POLYMAKE_OBJECT(cone) ){233ErrorMayQuit(" parameter is not a polymake object.",0,0);234return NULL;235}236#endif237perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );238data->main_polymake_session->set_application_of(*coneobj);239pm::perl::Hash sketch_options;240if( IS_STRING( filename ) ){241sketch_options["File"] << CSTR_STRING( filename );242}243244pm::perl::Hash visual_options;245if( IS_PLIST( options ) ){246for( int i = 1; i <= LEN_PLIST( options ); i++ ){247Obj current_option = ELM_PLIST( options, i );248Obj description = ELM_PLIST( current_option, 1 );249if( ! IS_STRING( description ) ){250ErrorMayQuit("first entry in option entry is not a string",0,0);251return NULL;252}253Obj content = ELM_PLIST( current_option, 2 );254if( IS_STRING( content ) ){255visual_options[ CSTR_STRING( description ) ] << CSTR_STRING( content );256}else{257if( IS_PLIST( content ) ){258pm::Integer* cont = new pm::Integer[ LEN_PLIST( content ) ];259for( int j = 1; j <= LEN_PLIST( content ); j++ ){260Obj elem = ELM_PLIST( content, j );261if( ! IS_INTOBJ( elem ) ){262ErrorMayQuit("entry of option array is not an integer",0,0);263return NULL;264}265cont[ j - 1 ] = INT_INTOBJ( elem );266}267visual_options[ CSTR_STRING( description ) ] << cont;268}269}270}271}272try{273VoidCallPolymakeFunction( "sketch", coneobj->CallPolymakeMethod("VISUAL", visual_options), sketch_options );274}275276POLYMAKE_GAP_CATCH277278return True;279280}281282Obj REAL_POLYMAKE_PROPERTIES( Polymake_Data* data, Obj cone ){283284#ifdef MORE_TESTS285if(! IS_POLYMAKE_OBJECT(cone) ){286ErrorMayQuit(" parameter is not a polymake object.",0,0);287return NULL;288}289#endif290291perlobj* coneobj = PERLOBJ_POLYMAKEOBJ( cone );292data->main_polymake_session->set_application_of(*coneobj);293try{294coneobj->VoidCallPolymakeMethod("properties");295}296297POLYMAKE_GAP_CATCH298299return True;300301}302303304