source: git/HOWTO-libsingular @ 3ce617

fieker-DuValspielwiese
Last change on this file since 3ce617 was 3ce617, checked in by Hans Schoenemann <hannes@…>, 13 years ago
include example for libsingular git-svn-id: file:///usr/local/Singular/svn/trunk@14223 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
Line 
1export CC="gcc -fpic -DPIC -DLIBSINGULAR"
2export CXX="g++ -fpic -DPIC -DLIBSINGULAR"
3./configure
4make install-libsingular
5
6---------------------------------------
7how to compile and run the the example:
8g++ -I......include -o tt tt.cc -L..../Singular -lsingular
9export LD_LIBRARY_PATH=...../Singular
10./tt
11--------------------------------------
12the example:
13#include <libsingular.h>
14void main()
15{
16  // init path names etc.
17  siInit((char *)"/home/hannes/singular-gap/Singular/p_Procs_FieldZp.so");
18
19  // construct the ring Z/32003[x,y,z]
20  // the variable names
21  char **n=(char**)omalloc(3*sizeof(char*));
22  n[0]=omStrDup("x");
23  n[1]=omStrDup("y");
24  n[2]=omStrDup("z");
25
26  ring R=rDefault(32003,3,n);
27  // make R the default ring:
28  rChangeCurrRing(R);
29
30  // create the polynomial 1
31  poly p1=p_ISet(1,R);
32
33  // create tthe polynomial 2*x^3*z^2
34  poly p2=p_ISet(2,R);
35  pSetExp(p2,1,3);
36  pSetExp(p2,3,2);
37  pSetm(p2);
38
39  // print p1 + p2
40  pWrite(p1); printf(" + \n"); pWrite(p2); printf("\n");
41
42  // compute p1+p2
43  p1=p_Add_q(p1,p2,R); p2=NULL;
44  pWrite(p1);
45
46  // cleanup:
47  pDelete(&p1);
48  rKill(R);
49}
Note: See TracBrowser for help on using the repository browser.