source: git/Tst/Buch/Example_2_1_25.tst @ 1ebec3

spielwiese
Last change on this file since 1ebec3 was 15bd61f, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes: branch, GP corr, new Ex 7.9.6 git-svn-id: file:///usr/local/Singular/svn/trunk@5625 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 962 bytes
Line 
1LIB "tst.lib";
2tst_init();
3
4proc contraHom(matrix M,int s)
5{
6   int n=ncols(M);
7   int m=nrows(M);
8   int a,b,c;
9   matrix R[s*n][s*m];
10   for(b=1;b<=m;b++)
11   {
12      for(a=1;a<=s;a++)
13      {
14         for(c=1;c<=n;c++)
15         {
16            R[(a-1)*n+c,(a-1)*m+b]=M[b,c];
17         }
18      }
19   }
20   return(R);
21}
22
23proc coHom(matrix M,int s)
24{
25   int n=ncols(M);
26   int m=nrows(M);
27   int a,b,c;
28   matrix R[s*m][s*n];
29   for(b=1;b<=s;b++)
30   {
31      for(a=1;a<=m;a++)
32      {
33         for(c=1;c<=n;c++)
34         {
35            R[(a-1)*s+b,(c-1)*s+b]=M[a,c];
36         }
37      }
38   }
39   return(R);
40}
41
42proc Hom(matrix M, matrix N)
43{
44  matrix A = contraHom(M,nrows(N));
45  matrix B = coHom(N,ncols(M));
46  matrix C = coHom(N,nrows(M));
47  matrix D = modulo(A,B);
48  matrix E = modulo(D,C);
49  return(E);
50}
51
52ring A=0,(x,y,z),dp;
53matrix M[3][3]=1,2,3,
54               4,5,6,
55               7,8,9;
56matrix N[2][2]=x,y,
57               z,0;
58
59print(Hom(M,N));
60
61
62tst_status(1);$
Note: See TracBrowser for help on using the repository browser.