Changeset 3ce617 in git


Ignore:
Timestamp:
May 18, 2011, 11:04:25 AM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3857cbd54ecdd34fa283e966babea53e8987186e
Parents:
2eb19e15c7ab2ab85c2f409c83aa5a1eb5941c2c
Message:
include example for libsingular

git-svn-id: file:///usr/local/Singular/svn/trunk@14223 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • HOWTO-libsingular

    r2eb19e r3ce617  
    44make install-libsingular
    55
     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 TracChangeset for help on using the changeset viewer.