Changeset 133ae7 in git
- Timestamp:
- Sep 27, 2019, 5:40:04 PM (5 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- 2e7edcbc061197869575d17124cb197dafd4ef45
- Parents:
- 50fb15949d9519d601bdaaa9bf8bbb49921c95a7
- git-author:
- Murray Heymann <heymann.murray@gmail.com>2019-09-27 17:40:04+02:00
- git-committer:
- Murray Heymann <heymann.murray@gmail.com>2019-09-27 17:40:07+02:00
- Files:
-
- 3 deleted
- 9 edited
- 20 moved
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r50fb159 r133ae7 123 123 .coverage 124 124 *.pyc 125 machine_learning/machine_learning-config.h -
Makefile.am
r50fb159 r133ae7 2 2 3 3 SUBDIRS = resources omalloc factory \ 4 libpolys machine_learninggfanlib IntegerProgramming \4 libpolys gfanlib IntegerProgramming \ 5 5 kernel Singular \ 6 6 dox emacs redhat desktop -
Singular/Makefile.am
r50fb159 r133ae7 137 137 138 138 libSingular_la_LDFLAGS =$(SINGULAR_LDFLAGS) ${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} -release ${PACKAGE_VERSION} $(CCLUSTER_LIBS) ${PTHREAD_LDFLAGS} -lpython2.7 139 libSingular_la_LIBADD =${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} ${BUILTIN_FLAGS} ${top_builddir}/kernel/libkernel.la ${PTHREAD_LIBS} ${top_builddir}/machine_learning/libmlearn.la139 libSingular_la_LIBADD =${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} ${BUILTIN_FLAGS} ${top_builddir}/kernel/libkernel.la ${PTHREAD_LIBS} 140 140 libSingular_includedir = ${includedir}/singular/Singular 141 141 nobase_libSingular_include_HEADERS = $(SingularHEADERS) -
Singular/dyn_modules/machinelearning/Makefile.am
r50fb159 r133ae7 16 16 17 17 ########################################################################## 18 AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/kernel -I${top_builddir}/kernel -I${top_srcdir}/libpolys -I${top_builddir}/libpolys $(FACTORY_INCLUDES) $(GMP_CPPFLAGS) $(NTL_CPPFLAGS) $(FLINT_CFLAGS) 18 AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/kernel \ 19 -I${top_builddir}/kernel -I${top_srcdir}/libpolys \ 20 -I${top_builddir}/libpolys $(FACTORY_INCLUDES) $(GMP_CPPFLAGS) \ 21 $(NTL_CPPFLAGS) $(FLINT_CFLAGS) -DDATA_PATH=\"$(datadir)\" \ 22 -DBIN_PATH=\"$(bindir)\" -I/usr/include/python2.7 19 23 20 machinelearning_la_SOURCES = machinelearning.cc 24 machinelearning_la_SOURCES = machinelearning.cc mlpredict.c 21 25 22 26 ### if HAVE_PYTHON??? … … 31 35 endif 32 36 endif 37 38 TESTS = test_bufsize test_init_ml 39 check_PROGRAMS = test_bufsize test_init_ml 40 41 #test_bufsize_LDFLAGS = -lpython3.6m 42 test_bufsize_LDFLAGS = -lpython2.7 43 test_bufsize_SOURCES = tests/test_bufsize.c mlpredict.c 44 test_bufsize_CFLAGS = -Wall -Wextra -I/usr/include/python2.7 45 46 #test_init_ml_LDFLAGS = -lpython3.6m 47 test_init_ml_LDFLAGS = -lpython2.7 48 test_init_ml_SOURCES = tests/test_init_ml.c mlpredict.c 49 test_init_ml_CFLAGS = -Wall -Wextra -I/usr/include/python2.7 50 51 52 nobase_dist_data_DATA = \ 53 ml_python/__init__.py \ 54 ml_python/predictor_runner.py \ 55 ml_python/common/__init__.py \ 56 ml_python/common/constants.py \ 57 ml_python/common/keyword_vector.py \ 58 ml_python/common/lookuptable.py \ 59 ml_python/model/__init__.py \ 60 ml_python/model/predictor.py \ 61 ml_singular/extract.lib -
Singular/dyn_modules/machinelearning/machinelearning.cc
r50fb159 r133ae7 1 #include "kernel/mod2.h" // general settings/macros 2 #include "Singular/ipid.h" // for SModulFunctions, leftv 3 BOOLEAN hello(leftv result, leftv arg) 1 #include <readline/history.h> 2 3 #include "kernel/mod2.h" 4 #include "Singular/ipid.h" 5 6 #include "mlpredict.h" 7 8 BOOLEAN predictHelp(leftv result, leftv arg) 4 9 { 5 result->rtyp=NONE; // set the result type 6 PrintS("hello world\n"); 7 return FALSE; // return FALSE: no error 10 char *buffer[5]; 11 int lengths[5]; 12 char filename[15] = "~/.history"; 13 int i; 14 lists L = (lists)omAllocBin(slists_bin); 15 16 buffer[0] = NULL; 17 buffer[1] = NULL; 18 buffer[2] = NULL; 19 buffer[3] = NULL; 20 buffer[4] = NULL; 21 22 if (write_history(NULL)) { 23 printf("Failed to write history\n"); 24 return TRUE; 25 } 26 27 if (!ml_initialise()) { 28 Print("Initialise of ml failed."); 29 PrintLn(); 30 /* Notify singular that an error occured */ 31 return TRUE; 32 } 33 34 ml_make_prediction(filename, buffer, lengths, _omStrDup); 35 36 L->Init(5); 37 38 for (i = 0; i < 5; i++) { 39 //printf("prediction %d: %s\n", i, buffer[i]); 40 L->m[i].rtyp = STRING_CMD; 41 L->m[i].data = buffer[i]; 42 } 43 44 // pass the resultant list to the res datastructure 45 result->rtyp=LIST_CMD; 46 result->data=(void *)L; 47 48 ml_finalise(); 49 return FALSE; 50 51 //result->rtyp=NONE; // set the result type 8 52 } 53 9 54 extern "C" int mod_init(SModulFunctions* psModulFunctions) 10 55 { 11 56 // this is the initialization routine of the module 12 // adding the routine hello:57 // adding the routine predictHelp: 13 58 psModulFunctions->iiAddCproc( 14 59 (currPack->libname? currPack->libname: ""), 15 // the library name, 16 // rely on the loader to set it in currPack->libname 17 "hello",// the name for the singular interpreter 60 "predictHelp",// for the singular interpreter 18 61 FALSE, // should enter the global name space 19 hello); // the C/C++ routine62 predictHelp); // the C/C++ routine 20 63 return 1; 21 64 } -
Singular/iparith.cc
r50fb159 r133ae7 50 50 #include "kernel/polys.h" 51 51 #include "kernel/ideals.h" 52 53 #include "machine_learning/mlpredict.h"54 52 55 53 #include "Singular/mod_lib.h" … … 7798 7796 return setOption(res,v); 7799 7797 } 7800 7801 7802 static BOOLEAN jjPREDHELP0(leftv res, leftv)7803 {7804 char *buffer[5];7805 int lengths[5];7806 char filename[15] = "~/.history";7807 int i;7808 lists L = (lists)omAllocBin(slists_bin);7809 7810 buffer[0] = NULL;7811 buffer[1] = NULL;7812 buffer[2] = NULL;7813 buffer[3] = NULL;7814 buffer[4] = NULL;7815 7816 if(write_history(NULL)) {7817 printf("Failed to write history\n");7818 return TRUE;7819 }7820 7821 if (!ml_initialise()) {7822 Print("Initialise of ml failed.");7823 PrintLn();7824 /* Notify singular that an error occured */7825 return TRUE;7826 }7827 7828 ml_make_prediction(filename, buffer, lengths, _omStrDup);7829 7830 L->Init(5);7831 7832 for (i = 0; i < 5; i++) {7833 //printf("prediction %d: %s\n", i, buffer[i]);7834 L->m[i].rtyp = STRING_CMD;7835 L->m[i].data = buffer[i];7836 }7837 7838 // pass the resultant list to the res datastructure7839 res->data=(void *)L;7840 7841 ml_finalise();7842 return FALSE;7843 }7844 7845 7846 7798 7847 7799 -
Singular/table.h
r50fb159 r133ae7 948 948 ,{D(jjCALL2ARG), CNUMBER_CMD, CNUMBER_CMD, 2 , ALLOW_NC |ALLOW_RING} 949 949 ,{D(jjOPTION_PL), OPTION_CMD, STRING_CMD/*or set by p*/,-1, ALLOW_NC |ALLOW_RING} 950 ,{D(jjPREDHELP0), PREDHELP_CMD, LIST_CMD, 0 , ALLOW_NC |ALLOW_RING}951 950 ,{D(jjCALL2ARG), REDUCE_CMD, IDEAL_CMD/*or set by p*/, 2, ALLOW_NC |ALLOW_RING} 952 951 ,{D(jjCALL3ARG), REDUCE_CMD, IDEAL_CMD/*or set by p*/, 3, ALLOW_NC |ALLOW_RING} … … 1157 1156 { "poly", 0, POLY_CMD , RING_DECL}, 1158 1157 { "polyBucket", 0, BUCKET_CMD , RING_DECL}, 1159 { "predictHelp", 0, PREDHELP_CMD , CMD_M},1160 1158 { "preimage", 0, PREIMAGE_CMD , CMD_13}, 1161 1159 { "prime", 0, PRIME_CMD , CMD_1}, -
Singular/tok.h
r50fb159 r133ae7 152 152 PARSTR_CMD, 153 153 PFAC_CMD, 154 PREDHELP_CMD,155 154 PRIME_CMD, 156 155 PRINT_CMD, -
configure.ac
r50fb159 r133ae7 232 232 233 233 AC_CONFIG_SUBDIRS([libpolys]) 234 235 AC_CONFIG_SUBDIRS([machine_learning])236 234 237 235 AC_CONFIG_FILES([Makefile])
Note: See TracChangeset
for help on using the changeset viewer.