source: git/standalone.test/tt.cc @ f5d2647

spielwiese
Last change on this file since f5d2647 was dc4782, checked in by Hans Schoenemann <hannes@…>, 10 years ago
chg: factory/libfac is not optional, removing HAVE_FACTORY/HAVE_LIBFAC
  • Property mode set to 100644
File size: 1.1 KB
Line 
1// Example program how to use libsingular
2
3#include <Singular/libsingular.h>
4#include <unistd.h>
5
6int mmInit(void) {return 1; } // ? due to SINGULAR!!!...???
7
8
9int main( int, char *argv[] ) 
10{
11  feInitResources(argv[0]);
12
13  StringSetS("ressources in use (as reported by feStringAppendResources(0):\n");
14  feStringAppendResources(0);
15   
16  { StringAppendS("\n"); char* s = StringEndS(); PrintS(s); omFree(s); }
17   
18//  // init path names etc.
19//  siInit(argv[0]);
20
21
22  // construct the ring Z/32003[x,y,z]
23  // the variable names
24  char **n=(char**)omalloc(3*sizeof(char*));
25  n[0]=omStrDup("x");
26  n[1]=omStrDup("y");
27  n[2]=omStrDup("z2");
28
29  ring R=rDefault(32003,3,n);
30  // make R the default ring:
31  rChangeCurrRing(R);
32
33  // create the polynomial 1
34  poly p1=p_ISet(1,R);
35
36  // create tthe polynomial 2*x^3*z^2
37  poly p2=p_ISet(2,R);
38  pSetExp(p2,1,3);
39  pSetExp(p2,3,2);
40  pSetm(p2);
41
42  // print p1 + p2
43  pWrite(p1); printf(" + \n"); pWrite(p2); printf("\n");
44
45  // compute p1+p2
46  p1=p_Add_q(p1,p2,R); p2=NULL;
47  pWrite(p1); 
48
49//   sleep(120);
50
51  // cleanup:
52  pDelete(&p1);
53  rKill(R);
54}
Note: See TracBrowser for help on using the repository browser.