spielwiese
Last change
on this file since 2567b5 was
891438c,
checked in by Gerhard Pfister <pfister@…>, 23 years ago
|
*GP: initial release
git-svn-id: file:///usr/local/Singular/svn/trunk@5579 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | LIB"matrix.lib"; |
---|
5 | proc tensorMaps(matrix M, matrix N) |
---|
6 | { |
---|
7 | int r=ncols(M); |
---|
8 | int s=nrows(M); |
---|
9 | int p=ncols(N); |
---|
10 | int q=nrows(N); |
---|
11 | int a,b,c,d; |
---|
12 | matrix R[s*q][r*p]; |
---|
13 | for(b=1;b<=p;b++) |
---|
14 | { |
---|
15 | for(d=1;d<=q;d++) |
---|
16 | { |
---|
17 | for(a=1;a<=r;a++) |
---|
18 | { |
---|
19 | for(c=1;c<=s;c++) |
---|
20 | { |
---|
21 | R[(c-1)*q+d,(a-1)*p+b]=M[c,a]*N[d,b]; |
---|
22 | } |
---|
23 | } |
---|
24 | } |
---|
25 | } |
---|
26 | return(R); |
---|
27 | } |
---|
28 | proc tensorMod(matrix Phi, matrix Psi) |
---|
29 | { |
---|
30 | int s=nrows(Phi); |
---|
31 | int q=nrows(Psi); |
---|
32 | matrix A=tensorMaps(unitmat(s),Psi); //Is tensor Psi |
---|
33 | matrix B=tensorMaps(Phi,unitmat(q)); //Phi tensor Iq |
---|
34 | matrix R=concat(A,B); //sum of A and B |
---|
35 | return(R); |
---|
36 | } |
---|
37 | |
---|
38 | proc Tor(int i, matrix Ps, matrix Ph) |
---|
39 | { |
---|
40 | if(i==0){return(module(tensorMod(Ps,Ph)));} |
---|
41 | //the tensor product |
---|
42 | list Phi = mres(Ph,i+1); // a resolution of Ph; |
---|
43 | module Im = tensorMaps(unitmat(nrows(Phi[i])),Ps); |
---|
44 | module f = tensorMaps(matrix(Phi[i]),unitmat(nrows(Ps))); |
---|
45 | module Im1 = tensorMaps(unitmat(ncols(Phi[i])),Ps); |
---|
46 | module Im2 = tensorMaps(matrix(Phi[i+1]),unitmat(nrows(Ps))); |
---|
47 | module ker = modulo(f,Im); |
---|
48 | module tor = modulo(ker,Im1+Im2); |
---|
49 | tor = prune(tor); |
---|
50 | return(tor); |
---|
51 | } |
---|
52 | |
---|
53 | ring A=0,(x,y),dp; |
---|
54 | matrix Ps[1][2]=x2,y; |
---|
55 | matrix Ph[1][1]=x; |
---|
56 | |
---|
57 | Tor(1,Ps,Ph); |
---|
58 | |
---|
59 | |
---|
60 | ideal I1=intersect(ideal(Ps),ideal(Ph)); |
---|
61 | ideal I2=ideal(Ps)*ideal(Ph); |
---|
62 | |
---|
63 | modulo(I1,I2); |
---|
64 | |
---|
65 | |
---|
66 | prune(modulo(I1,I2)); |
---|
67 | |
---|
68 | Tor(2,Ps,Ph); |
---|
69 | |
---|
70 | Tor(0,Ps,Ph); |
---|
71 | |
---|
72 | |
---|
73 | tst_status(1);$ |
---|
Note: See
TracBrowser
for help on using the repository browser.