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