source: git/Tst/Buch/Example_7_5_2.tst @ bf8015

spielwiese
Last change on this file since bf8015 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.6 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4LIB"matrix.lib";
5proc 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
29proc tensorMod(matrix Phi, matrix Psi)
30{
31   int s=nrows(Phi);
32   int q=nrows(Psi);
33   matrix A=tensorMaps(unitmat(s),Psi);  //Is tensor Psi
34   matrix B=tensorMaps(Phi,unitmat(q));  //Phi tensor Iq
35   matrix R=concat(A,B);                 //sum of A and B
36   return(R);     
37}
38proc 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
53ring A=0,(x,y,z,t),dp;
54ideal I0=x3y+yz2,xy3+x2z;
55ideal I=homog(I0,t);
56
57ideal J=quotient(I,t);
58prune(modulo(J,I));
59
60ideal I1=std(I0);
61ideal Ih=homog(I1,t);
62ideal L=quotient(Ih,t);
63
64prune(modulo(L,J));
65
66
67matrix Ph=t;
68matrix Ps[1][2]=I;
69
70Tor(1,Ps,Ph); 
71
72matrix Pl[1][4]=J;
73
74Tor(1,Pl,Ph);
75
76tst_status(1);$
Note: See TracBrowser for help on using the repository browser.