Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Stalift/bkk_bound_computations.adb, Revision 1.1.1.1
1.1 maekawa 1: with integer_io; use integer_io;
2: with Standard_Integer_Vectors; use Standard_Integer_Vectors;
3: with Lists_of_Integer_Vectors; use Lists_of_Integer_Vectors;
4: with Arrays_of_Integer_Vector_Lists; use Arrays_of_Integer_Vector_Lists;
5: with Standard_Complex_Laur_Systems; use Standard_Complex_Laur_Systems;
6: with Standard_Poly_Laur_Convertors; use Standard_Poly_Laur_Convertors;
7: with Power_Lists; use Power_Lists;
8: with Trees_of_Vectors; use Trees_of_Vectors;
9: with Trees_of_Vectors_io; use Trees_of_Vectors_io;
10: with Volumes;
11: with Mixed_Homotopy_Continuation;
12: with Integer_Lifting_Utilities; use Integer_Lifting_Utilities;
13: with Mixed_Volume_Computation;
14: with Integer_Mixed_Subdivisions; use Integer_Mixed_Subdivisions;
15: with Integer_Mixed_Subdivisions_io; use Integer_Mixed_Subdivisions_io;
16: with Integer_Polyhedral_Continuation; use Integer_Polyhedral_Continuation;
17:
18: package body BKK_Bound_Computations is
19:
20: function BKK_by_Implicit_Lifting ( p : Poly_Sys ) return natural is
21:
22: n : constant natural := p'length;
23: supports : Array_of_Lists(p'range) := Create(p);
24: bkk : constant natural := Volumes.Mixed_Volume(n,supports);
25:
26: begin
27: Deep_Clear(supports);
28: return bkk;
29: end BKK_by_Implicit_Lifting;
30:
31: function BKK_by_Implicit_Lifting ( file : file_type; p : Poly_Sys )
32: return natural is
33: n : constant natural := p'length;
34: supports : Array_of_Lists(p'range) := Create(p);
35: tv : Tree_of_Vectors;
36: bkk : natural;
37:
38: begin
39: Volumes.Mixed_Volume(n,supports,tv,bkk);
40: new_line(file);
41: put_line(file,"The tree of useful directions : "); put(file,tv);
42: new_line(file);
43: Deep_Clear(supports); Clear(tv);
44: return bkk;
45: end BKK_by_Implicit_Lifting;
46:
47: function BKK_by_Static_Lifting ( p : Poly_Sys ) return natural is
48:
49: n : constant natural := p'length;
50: supports : Array_of_Lists(p'range) := Create(p);
51: bkk : constant natural := Mixed_Volume_Computation.Mixed_Volume(n,supports);
52:
53: begin
54: Deep_Clear(supports);
55: return bkk;
56: end BKK_by_Static_Lifting;
57:
58: function BKK_by_Static_Lifting ( file : file_type; p : Poly_Sys )
59: return natural is
60:
61: n : constant natural := p'length;
62: supports : Array_of_Lists(p'range) := Create(p);
63: bkk : constant natural
64: := Mixed_Volume_Computation.Mixed_Volume(file,n,supports);
65:
66: begin
67: Deep_Clear(supports);
68: return bkk;
69: end BKK_by_Static_Lifting;
70:
71: function Solve_by_Implicit_Lifting ( p : Poly_Sys ) return Solution_List is
72:
73: n : constant natural := p'length;
74: supports : Array_of_Lists(p'range) := Create(p);
75: tv : Tree_of_Vectors;
76: bkk : natural;
77: lp : Laur_Sys(p'range) := Polynomial_to_Laurent_System(p);
78: sols : Solution_List;
79:
80: begin
81: Volumes.Mixed_Volume(n,supports,tv,bkk);
82: Deep_Clear(supports);
83: Mixed_Homotopy_Continuation.Solve(Standard_Output,lp,tv,bkk,sols);
84: Clear(tv); Clear(lp);
85: return sols;
86: end Solve_by_Implicit_Lifting;
87:
88: function Solve_by_Implicit_Lifting ( file : file_type; p : Poly_Sys )
89: return Solution_List is
90:
91: n : constant natural := p'length;
92: supports : Array_of_Lists(p'range) := Create(p);
93: tv : Tree_of_Vectors;
94: bkk : natural;
95: lp : Laur_Sys(p'range) := Polynomial_to_Laurent_System(p);
96: sols : Solution_List;
97:
98: begin
99: Volumes.Mixed_Volume(n,supports,tv,bkk);
100: Deep_Clear(supports);
101: new_line(file);
102: put(file,"The BKK bound equals "); put(file,bkk,1); new_line(file);
103: put_line(file," with tree of useful directions : "); put(file,tv);
104: new_line(file);
105: Mixed_Homotopy_Continuation.Solve(file,lp,tv,bkk,sols);
106: Clear(tv); Clear(lp);
107: return sols;
108: end Solve_by_Implicit_Lifting;
109:
110: function Solve_by_Static_Lifting ( p : Poly_Sys ) return Solution_List is
111:
112: n : constant natural := p'length;
113: supports : Array_of_Lists(p'range) := Create(p);
114: mv : natural;
115: sols : Solution_List;
116: mix,per : Link_to_Vector;
117: mixsub : Mixed_Subdivision;
118: permp : Poly_Sys(p'range);
119: lp,pp : Laur_Sys(p'range);
120:
121: use Mixed_Volume_Computation;
122:
123: begin
124: Compute_Mixture(supports,mix,per);
125: permp := Permute(p,per); Clear(per);
126: declare
127: lifted : Array_of_Lists(mix'range);
128: begin
129: Mixed_Volume(n,mix.all,supports,lifted,mixsub,mv);
130: pp := Polynomial_to_Laurent_System(p);
131: lp := Perform_Lifting(n,mix.all,lifted,pp);
132: Mixed_Solve(lp,mix.all,mixsub,sols);
133: Deep_Clear(lifted);
134: end;
135: Clear(pp); Clear(lp);
136: Deep_Clear(supports);
137: Deep_Clear(mixsub);
138: Clear(mix);
139: return sols;
140: end Solve_by_Static_Lifting;
141:
142: function Solve_by_Static_Lifting ( file : file_type; p : Poly_Sys )
143: return Solution_List is
144:
145: n : constant natural := p'length;
146: supports : Array_of_Lists(p'range) := Create(p);
147: mv : natural;
148: sols : Solution_List;
149: mix,per : Link_to_Vector;
150: mixsub : Mixed_Subdivision;
151: permp : Poly_Sys(p'range);
152: lp,pp : Laur_Sys(p'range);
153:
154: use Mixed_Volume_Computation;
155:
156: begin
157: Compute_Mixture(supports,mix,per);
158: permp := Permute(p,per); Clear(per);
159: declare
160: lifted : Array_of_Lists(mix'range);
161: begin
162: Mixed_Volume(file,n,mix.all,supports,lifted,mixsub,mv);
163: put_line(file,"THE MIXED SUBDIVISION :");
164: put(file,n,mix.all,mixsub);
165: pp := Polynomial_to_Laurent_System(p);
166: lp := Perform_Lifting(n,mix.all,lifted,pp);
167: new_line(file); put_line(file,"POLYHEDRAL HOMOTOPY CONTINUATION");
168: Mixed_Solve(file,lp,mix.all,mixsub,sols);
169: Deep_Clear(lifted);
170: end;
171: Clear(pp); Clear(lp);
172: Deep_Clear(supports);
173: Deep_Clear(mixsub);
174: Clear(mix);
175: return sols;
176: end Solve_by_Static_Lifting;
177:
178: end BKK_Bound_Computations;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>