source: git/Tst/Buch/Example_2_1_6.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: 748 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
23ring A=0,(x,y,z),dp;
24matrix M[3][3]=1,2,3,
25               4,5,6,
26               7,8,9;
27
28print(contraHom(M,2));
29
30proc coHom(matrix M,int s)
31{
32   int n=ncols(M);
33   int m=nrows(M);
34   int a,b,c;
35   matrix R[s*m][s*n];
36   for(b=1;b<=s;b++)
37   {
38      for(a=1;a<=m;a++)
39      {
40         for(c=1;c<=n;c++)
41         {
42            R[(a-1)*s+b,(c-1)*s+b]=M[a,c];
43         }
44      }
45   }
46   return(R);
47}
48
49print(coHom(M,2));
50
51tst_status(1);$
Note: See TracBrowser for help on using the repository browser.