source: git/Tst/Buch/Example_2_7_5.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: 572 bytes
Line 
1LIB "tst.lib";
2tst_init();
3
4proc tensorMaps(matrix M, matrix N)
5{
6   int r=ncols(M);
7   int s=nrows(M);
8   int p=ncols(N);
9   int q=nrows(N);
10   int a,b,c,d;
11   matrix R[s*q][r*p];
12   for(b=1;b<=p;b++)
13   {
14      for(d=1;d<=q;d++)
15      {
16         for(a=1;a<=r;a++)
17         {
18            for(c=1;c<=s;c++)
19            {
20               R[(c-1)*q+d,(a-1)*p+b]=M[c,a]*N[d,b];
21            }
22         }
23      }
24   }
25   return(R);
26}
27
28ring A=0,(x,y,z),dp;
29matrix M[3][3]=1,2,3,4,5,6,7,8,9;
30matrix N[2][2]=x,y,0,z;
31print(M);
32
33print(N);
34
35print(tensorMaps(M,N));
36
37
38tst_status(1);$
Note: See TracBrowser for help on using the repository browser.