Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: coding C++ and calling singular routines
PostPosted: Wed Mar 15, 2017 6:35 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
Can I write a C++ code, and then link to some kind of Singular library so I can call Singular functions to solve my sets of polynomials from within my C++ code? Is there some manual somewhere to explain me how to do it?
If not, is there any other "system of polynomials solving" software that I can do this? I am currently looking into PHCpack which seems to be offer this possibility, but it's not straightforward. Are there any others? Bertini? Hompack? Macaulay2?

Cheers,

Machiel


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: coding C++ and calling singular routines
PostPosted: Thu Mar 16, 2017 6:18 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 177
Examples of using libSingular can be found at:
https://github.com/Singular/Sources/blo ... g-test1.cc
https://github.com/Singular/Sources/blo ... g-test2.cc
The comment at the beginning are for version 3.x.x,
for version 4.x.x use the output of libsingular-config
(resp. pkg-config).
To find the functions to call see
https://www.singular.uni-kl.de/dox/html/
(doxygen output from the sources)
and
http://www.mathematik.uni-kl.de/ftp/pub ... natomy.tgz


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: coding C++ and calling singular routines
PostPosted: Mon Mar 20, 2017 5:43 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
Hi,

Thanks for your reply.
I tried doing what you suggested.
I.e., I downloaded the source code for Singular from https://github.com/Singular/Sources
Then I compiled, using:
Quote:
source autogen.sh
./configure
make

Next, in my a subroutine, "mywork", where I copied the file
Quote:
"https://github.com/Singular/Sources/blob/master/libsing-test1.cc"


To compile this, I had to link to numerous include and lib directories, like this:
Quote:
g++ -I../Singular/ -I../ -I../libpolys/ -I../factory/include/ -o libsing_test1 libsing-test1.cc -L../Singular/.libs/ -lSingular


However, this gives me the error:

Quote:
/usr/bin/ld: /tmp/ccWfd0mN.o: undefined reference to symbol '_Z6p_ISetlP8ip_sring'
//home/mkolstein/Singular/Sources-spielwiese/libpolys/polys/.libs/libpolys-4.0.3.so: error adding symbols: DSO missing from command line

Do you have any suggestions, how to fix this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: coding C++ and calling singular routines
PostPosted: Mon Mar 20, 2017 6:45 pm 

Joined: Thu Mar 09, 2017 5:30 pm
Posts: 11
To answer my own question, to compile, I needed the following command:
Quote:
g++ -I../Singular/ -I../ -I../libpolys/ -I../factory/include/ -o libsing_test1 libsing-test1.cc -L../Singular/.libs/ -lSingular -L../libpolys/polys/.libs/ -lpolys -L../resources/.libs/ -lsingular_resources -L../omalloc/.libs/ -lomalloc


Later, to run the executable "libsing_test1", I needed to set the following environments:
Quote:
export SINGULAR_BASE=/home/mkolstein/Singular/Sources-spielwiese/
export SINGULAR_LIB_DIR=$SINGULAR_BASE/Singular/.libs/
export SINGULAR_LIB_2=$SINGULAR_BASE/libpolys/polys/.libs/
export SINGULAR_LIB_3=$SINGULAR_BASE/resources/.libs/
export SINGULAR_LIB_4=$SINGULAR_BASE/omalloc/.libs/

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SINGULAR_LIB_DIR:$SINGULAR_LIB_2:$SINGULAR_LIB_3:$SINGULAR_LIB_4


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Tue Oct 17, 2017 11:42 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group