source: git/Tst/Buch/Example_7_1_5.tst @ 2567b5

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 
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}
28proc 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
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),dp;
54matrix  Ps[1][2]=x2,y;
55matrix  Ph[1][1]=x;
56
57Tor(1,Ps,Ph);
58
59
60ideal I1=intersect(ideal(Ps),ideal(Ph));
61ideal I2=ideal(Ps)*ideal(Ph);
62
63modulo(I1,I2);
64
65
66prune(modulo(I1,I2));   
67
68Tor(2,Ps,Ph);
69
70Tor(0,Ps,Ph);   
71
72
73tst_status(1);$
Note: See TracBrowser for help on using the repository browser.