source: git/Tst/Long/fetch_l.tst @ 0bc5ed4

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