source: git/Tst/Old/formmat.tst @ 2ff629

fieker-DuValspielwiese
Last change on this file since 2ff629 was 37cd955, checked in by Hans Schoenemann <hannes@…>, 14 years ago
pagelength removed git-svn-id: file:///usr/local/Singular/svn/trunk@13172 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.4 KB
Line 
1proc mrows
2{
3  string @rc;
4  for (int @i = 1; @i<=ncols(#[1]); @i=@i+1)
5  {
6    @rc = @rc + "m[" + string(#[2]) + "," + string(@i) + "],";
7  }
8  @rc = @rc[1,size(@rc)-1] + ";";
9  return (@rc);
10}
11ring r= 32003,(x,y,z),lp;
12matrix m[3][3] = 0;
13m[1,1] = 4x;
14m[1,2] = y5x;
15m[3,2] = y5x + 4xyz;
16m;
17string ss;
18for (int ii=1; ii<=nrows(m); ii=ii+1)
19{
20  ss;
21  ss = "ideal id(" + string(ii),")=";
22  ss;
23  ss = ss +  string(mrows(m,ii));
24  ss;
25  execute(ss);
26  id(ii);
27}
28listvar(all);
29"id(1) : ";id(1);
30"elem 2 of id(1) : ";id(1)[2];
31id(1)[3] = (2*id(1)[2])^4;
32id(1);
33string(id(1)[3]);
34proc formmat
35{
36  int @elems = 0;
37  int @mlen  = 0;
38  int @slen  = 0;
39  int @c;
40  for (int @r=1; @r<=nrows(#[1]); @r=@r+1)
41  {
42    for (@c=1; @c<=ncols(#[1]); @c=@c+1)
43    {
44      @elems = @elems + 1;
45      string @s(@elems) = string(#[1][@r,@c]);
46      @slen = size(@s(@elems));
47      if (@slen > @mlen) { @mlen = @slen; }
48    }
49  }
50  @elems = 0;
51  string @aus;
52  string @fill = "                                                ";
53  string @sep = " ";
54  pagewidth = 30;
55  if (@mlen * ncols(#[1]) >= pagewidth)
56  {
57    @sep = NL;
58  }
59  for (@r=1; @r<=nrows(#[1]); @r=@r+1)
60  {
61    @aus = "";
62    for (@c=1; @c<=ncols(#[1]); @c=@c+1)
63    {
64      @elems = @elems + 1;
65      @slen = size(@s(@elems));
66      @aus = @aus + @s(@elems) + @fill[1,@mlen-@slen+1] + @sep;
67    }
68    @aus;
69  }
70}
71formmat(m);
72LIB "tst.lib";tst_status(1);$
Note: See TracBrowser for help on using the repository browser.