source: git/Tst/Short/minor_s.tst @ bf5c59f

spielwiese
Last change on this file since bf5c59f was 728478, checked in by Olaf Bachmann <obachman@…>, 26 years ago
* minor bug fixes git-svn-id: file:///usr/local/Singular/svn/trunk@2334 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.4 KB
Line 
1LIB "tst.lib";
2tst_init();
3//
4// test script for minor command
5//
6pagelength = 10000;
7ring r1 = 32003,(x,y,z),(c,dp);
8r1;
9
10proc pmat (matrix m,list #)
11{
12  if ( size(#) == 0)
13  {
14//------------- main case: input is a matrix, no second argument---------------
15    int @elems;
16    int @mlen;
17    int @slen;
18    int @c;
19    int @r;
20//-------------- count maximal size of each column, and sum up ----------------
21
22    for ( @c=1; @c<=ncols(m); @c=@c+1)
23    {  int @len(@c);
24      for (@r=1; @r<=nrows(m); @r=@r+1)
25      {
26        @elems = @elems + 1;
27        string @s(@elems) = string(m[@r,@c])+",";
28        @slen = size(@s(@elems));
29        if (@slen > @len(@c))
30        {
31          @len(@c) = @slen;
32        }
33      }
34      @mlen = @mlen + @len(@c);
35    }
36//---------------------- print all - except last - rows -----------------------
37
38    string @aus;
39    string @sep = " ";
40    if (@mlen >= pagewidth)
41    {
42      @sep = newline;
43    }
44
45    for (@r=1; @r<nrows(m); @r=@r+1)
46    {
47      @elems = @r;
48      @aus = "";
49      for (@c=1; @c<=ncols(m); @c=@c+1)
50      {
51        @aus = @aus + @s(@elems)[1,@len(@c)] + @sep;
52        @elems = @elems + nrows(m);
53      }
54      @aus;
55    }
56//--------------- print last row (no comma after last entry) ------------------
57
58    @aus = "";
59    @elems = nrows(m);
60    for (@c=1; @c<ncols(m); @c=@c+1)
61    {
62      @aus = @aus + @s(@elems)[1,@len(@c)] + @sep;
63      @elems = @elems + nrows(m);
64    }
65    @aus = @aus + string(m[nrows(m),ncols(m)]);
66    @aus;
67    return();
68  }
69//--------- second case: input is a matrix, second argument is given ----------
70
71  if ( size(#) == 1 )
72  {
73    if ( typeof(#[1]) == "int" )
74    {
75      string @aus;
76      string @tmp;
77      int @ll;
78      int @c;
79      int @r;
80      for ( @r=1; @r<=nrows(m); @r=@r+1)
81      {
82        @aus = "";
83        for (@c=1; @c<=ncols(m); @c=@c+1)
84        {
85          @tmp = string(m[@r,@c]);
86          @aus = @aus + @tmp[1,#[1]] + " ";
87        }
88        @aus;
89      }
90    }
91  }
92}
93
94"-------------------------------";
95matrix m1[3][3]=maxideal(2);
96pmat(m1);
97minor(m1,3);
98"---------------------------------";
99ring r2=0,(x(1..9)),(dp);
100matrix m2[3][3]=maxideal(1);
101pmat(m2);
102minor(m2,2);
103"---------------------------------";
104ring r3=0,(x(1..64)),ds;
105matrix m3[8][8]= maxideal(1);
106pmat(m3);
107minor(m3,1);
108"----------------------------------";
109matrix m4[8][8]=maxideal(2);
110pmat(m4);
111minor(m4,1);
112"----------------------------------";
113listvar(all);
114kill r1,r2,r3;
115tst_status(1);$;
Note: See TracBrowser for help on using the repository browser.