source: git/Tst/Old/fetch.tst @ 4173c7

spielwiese
Last change on this file since 4173c7 was 4173c7, checked in by Hans Schoenemann <hannes@…>, 13 years ago
use div instead of /, part 1 git-svn-id: file:///usr/local/Singular/svn/trunk@14191 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.6 KB
Line 
1proc generate_ring_str(int n, string r_name, string ostring)
2{
3  return ("ring "+r_name+" = 32003,x(1.." + string(n) + ")," + ostring + ";");
4}
5
6proc generate_polys_str(int n)
7{
8  string polystr = "poly p = ";
9  int i;
10
11  for (i=1; i<=n; i = i + (i div 10) + 1)
12  {
13    polystr = polystr + "x(" + string(i) + ") + ";
14  }
15  return (polystr + "1; poly p1 = p^2+p; vector p2 = (p^2+p)*(gen(2) + gen(3)); vector p3 = (p^2+p)*(gen(2) + gen(3))+ p^2 + p; vector p4 = p3 + p^3;p; p1; p2; p3; p4");
16}
17
18proc generate_weight_str(int j)
19{
20  int i;
21  string res_str = "(";
22 
23  for (i=1; i<j; i++)
24  {
25    res_str = res_str + string(i) + ",";
26  }
27  return (res_str + string(j) + ")");
28}
29
30
31list orderings = "lp", "dp", "Dp", "ls", "ds", "Ds";
32
33list l = "dp";
34
35proc extend_orderings(list olist, int j)
36{
37  int i;
38  int c1;
39  int c2;
40  string o1;
41  string o2;
42  string o3;
43  list nl;
44  string weight_string = generate_weight_str(j);
45  o1 = olist[1];
46  if (size(olist) > 1)
47  {
48    o2 = olist[2];
49    if (size(olist) > 2)
50    {
51      o3 = olist[3];
52    }
53    else
54    {
55      o3 = olist[2];
56    }
57  }
58  else
59  {
60    o2 = o1;
61    o3 = o1;
62  }
63     
64  // add weight orderings
65  olist = olist + list("Wp" + weight_string, "wp" + weight_string);
66
67   
68  for (i=1; i<=size(olist); i++)
69  {
70    nl = nl + list(olist[i], "(C," + olist[i] + ")", "(c," + olist[i] + ")",
71                   "(" + olist[i] + ",C)", "(" + olist[i] + ",c)");
72  }
73
74  // add product orderings
75  if (j > 1)
76  {
77    c1 = j div 2;
78    if (c1 + c1 == j)
79    {
80      c2 = c1;
81    }
82    else
83    {
84      c2 = c1 + 1;
85    }
86    nl = nl + list("(" + o1 + "(" + string(c1) + "),"+ o2 + "(" + string(c2) + "))", "(" + o1 + "(" + string(c1) + "),"+ o3 + "(" + string(c2) + "))");
87    // and, extra weight vector
88    nl = nl + list("(a" + weight_string + "," + o2 + "(" + string(c1) + "),"+ o3 + "(" + string(c2) + "))", "(a" + generate_weight_str(j-1)+ "," + o3 + "(" + string(c1) + "),"+ o1 + "(" + string(c2) + "))");
89  }
90
91  // and, last but not least, a Matrix ordering
92  nl = nl + list("M(m)");
93 
94  return (nl);
95}
96   
97proc check_fetch(int n, list olist)
98{
99  int i;
100  int j;
101  list e_olist;
102 
103  for (j=1; j<=n; j = j + (j div 10) + 1)
104  {
105    e_olist = extend_orderings(olist, j);
106    execute(generate_ring_str(j, "r", e_olist[1]));
107    execute(generate_polys_str(j));
108    intmat m[j][j];
109    m = m + 1;
110    for (i=1; i<=size(e_olist); i++)
111    {
112      execute(generate_ring_str(j, "r1", e_olist[i]));
113      fetch(r, p);
114      fetch(r, p1);
115      fetch(r, p2);
116      fetch(r, p3);
117      fetch(r, p4);
118      r1;
119      kill r1;
120    }
121    kill r;
122    kill m;
123  }
124}
125
126check_fetch(15, orderings);
127
128LIB "tst.lib";tst_status(1);$
Note: See TracBrowser for help on using the repository browser.