Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Implift/power_lists.adb, Revision 1.1.1.1
1.1 maekawa 1: with Standard_Integer_Vectors; use Standard_Integer_Vectors;
2:
3: package body Power_Lists is
4:
5: function Create ( p : Standard_Complex_Polynomials.Poly ) return List is
6:
7: res,res_last : List;
8:
9: procedure Visit_Term ( t : in Standard_Complex_Polynomials.Term;
10: cont : out boolean ) is
11:
12: h : Link_to_Vector;
13:
14: begin
15: h := new Standard_Integer_Vectors.Vector(t.dg'range);
16: for j in h'range loop
17: h(j) := t.dg(j);
18: end loop;
19: Append(res,res_last,h);
20: cont := true;
21: end Visit_Term;
22: procedure Visit_Terms is
23: new Standard_Complex_Polynomials.Visiting_Iterator(Visit_Term);
24:
25: begin
26: Visit_Terms(p);
27: return res;
28: end Create;
29:
30: function Create ( p : Standard_Complex_Laur_Polys.Poly ) return List is
31:
32: res,res_last : List;
33:
34: procedure Visit_Term ( t : in Standard_Complex_Laur_Polys.Term;
35: cont : out boolean ) is
36:
37: h : Link_to_Vector;
38:
39: begin
40: h := new Standard_Integer_Vectors.Vector(t.dg'range);
41: for j in h'range loop
42: h(j) := t.dg(j);
43: end loop;
44: Append(res,res_last,h);
45: cont := true;
46: end Visit_Term;
47: procedure Visit_Terms is
48: new Standard_Complex_Laur_Polys.Visiting_Iterator(Visit_Term);
49:
50: begin
51: Visit_Terms(p);
52: return res;
53: end Create;
54:
55: function Select_Terms ( p : Standard_Complex_Polynomials.Poly; l : List )
56: return Standard_Complex_Polynomials.Poly is
57:
58: res : Standard_Complex_Polynomials.Poly
59: := Standard_Complex_Polynomials.Null_Poly;
60:
61: procedure Select_Term ( t : in Standard_Complex_Polynomials.Term;
62: cont : out boolean ) is
63:
64: v : Standard_Integer_Vectors.Vector(t.dg'range);
65:
66: begin
67: for i in v'range loop
68: v(i) := t.dg(i);
69: end loop;
70: if Is_In(l,v)
71: then Add(res,t);
72: end if;
73: cont := true;
74: end Select_Term;
75: procedure Select_Poly is
76: new Standard_Complex_Polynomials.Visiting_Iterator ( Select_Term );
77:
78: begin
79: Select_Poly(p);
80: return res;
81: end Select_Terms;
82:
83: function Select_Terms ( p : Standard_Complex_Laur_Polys.Poly; l : List )
84: return Standard_Complex_Laur_Polys.Poly is
85:
86: res : Standard_Complex_Laur_Polys.Poly
87: := Standard_Complex_Laur_Polys.Null_Poly;
88:
89: procedure Select_Term ( t : in Standard_Complex_Laur_Polys.Term;
90: cont : out boolean ) is
91:
92: v : Standard_Integer_Vectors.Vector(t.dg'range);
93:
94: begin
95: for i in v'range loop
96: v(i) := t.dg(i);
97: end loop;
98: if Is_In(l,v)
99: then Add(res,t);
100: end if;
101: cont := true;
102: end Select_Term;
103: procedure Select_Poly is
104: new Standard_Complex_Laur_Polys.Visiting_Iterator ( Select_Term );
105:
106: begin
107: Select_Poly(p);
108: return res;
109: end Select_Terms;
110:
111: function Create ( p : Poly_Sys ) return Array_of_Lists is
112:
113: res : Array_of_Lists(p'range);
114:
115: begin
116: for i in p'range loop
117: res(i) := Create(p(i));
118: end loop;
119: return res;
120: end Create;
121:
122: function Create ( p : Laur_Sys ) return Array_of_Lists is
123:
124: res : Array_of_Lists(p'range);
125:
126: begin
127: for i in p'range loop
128: res(i) := Create(p(i));
129: end loop;
130: return res;
131: end Create;
132:
133: function Select_Terms ( p : Poly_Sys; al : Array_of_Lists )
134: return Poly_Sys is
135:
136: res : Poly_Sys(p'range);
137:
138: begin
139: for i in p'range loop
140: res(i) := Select_Terms(p(i),al(i));
141: end loop;
142: return res;
143: end Select_Terms;
144:
145: function Select_Terms ( p : Laur_Sys; al : Array_of_Lists )
146: return Laur_Sys is
147:
148: res : Laur_Sys(p'range);
149:
150: begin
151: for i in p'range loop
152: res(i) := Select_Terms(p(i),al(i));
153: end loop;
154: return res;
155: end Select_Terms;
156:
157: end Power_Lists;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>