Annotation of OpenXM_contrib/PHC/Ada/Main/mainphc.adb, Revision 1.1.1.1
1.1 maekawa 1: with text_io,integer_io; use text_io,integer_io;
2: with Communications_with_User; use Communications_with_User;
3: with Timing_Package; use Timing_Package;
4: with Standard_Complex_Numbers; use Standard_Complex_Numbers;
5: with Standard_Complex_Vectors; use Standard_Complex_Vectors;
6: with Standard_Complex_Polynomials; use Standard_Complex_Polynomials;
7: with Standard_Complex_Poly_Systems; use Standard_Complex_Poly_Systems;
8: with Standard_Complex_Poly_Systems_io; use Standard_Complex_Poly_Systems_io;
9: with Standard_Complex_Solutions; use Standard_Complex_Solutions;
10: with Homotopy;
11: with Drivers_for_Scaling; use Drivers_for_Scaling;
12: with Drivers_for_Reduction; use Drivers_for_Reduction;
13: with Drivers_for_Poly_Continuation; use Drivers_for_Poly_Continuation;
14: with Driver_for_Root_Counts;
15: with Drivers_for_Homotopy_Creation; use Drivers_for_Homotopy_Creation;
16: with Driver_for_Root_Refining;
17: with Bye_Bye_Message;
18:
19: procedure mainphc ( infilename,outfilename : in string ) is
20:
21: outpt : file_type;
22: lp : Link_to_Poly_Sys := null;
23: timer : timing_widget;
24:
25: procedure Display_Options is
26:
27: -- DESCRIPTION :
28: -- Displays an overview of all options on screen.
29:
30: o : array(1..8) of string(1..65);
31:
32: begin
33: put_line("Running in full mode. Note also the following options:");
34: o(1) := " phc -s : Equation and variable Scaling on system and solutions ";
35: o(2) := " phc -d : Linear and nonlinear Reduction w.r.t. the total degree";
36: o(3) := " phc -r : Root counting and Construction of start systems ";
37: o(4) := " phc -m : Mixed-Volume Computation by four lifting strategies ";
38: o(5) := " phc -p : Polynomial Continuation by a homotopy in one parameter";
39: o(6) := " phc -v : Validation, refinement and purification of solutions ";
40: o(7) := " phc -e : SAGBI/Pieri homotopies to intersect linear subspaces ";
41: o(8) := " phc -b : Batch or black-box processing ";
42: for i in o'range loop
43: put_line(o(i));
44: end loop;
45: end Display_Options;
46:
47: procedure Read_System ( filename : in string ) is
48:
49: file : file_type;
50: n : natural;
51:
52: begin
53: if filename /= ""
54: then Open_Input_File(file,filename);
55: get(file,n);
56: lp := new Poly_Sys(1..n);
57: get(file,n,lp.all);
58: Close(file);
59: end if;
60: exception
61: when others =>
62: new_line;
63: put("Could not open file with name "); put_line(filename);
64: lp := null; return;
65: end Read_System;
66:
67: begin
68: new_line;
69: Display_Options;
70:
71: -- READ THE INPUT SYSTEM AND OUTPUT FILE
72:
73: Read_System(infilename);
74: if lp = null
75: then new_line; get(lp);
76: end if;
77:
78: Create_Output_File(outpt,outfilename);
79: put(outpt,lp'last,lp.all);
80:
81: tstart(timer);
82:
83: declare
84:
85: p,q,scalp,projp : Poly_Sys(lp'range);
86: target : Complex_Number;
87: basis,roco : natural;
88: scalvec : Link_to_Vector;
89: sols : Solution_List;
90: proj : boolean;
91:
92: begin
93:
94: p := lp.all; Copy(p,scalp);
95:
96: -- PREPROCESSING : SCALING AND REDUCTION
97:
98: Driver_for_Scaling(outpt,scalp,basis,scalvec);
99: Driver_for_Reduction(outpt,scalp,roco,true);
100:
101: -- APPLY ROOT COUNTING METHODS TO CONSTRUCT A START SYSTEM
102:
103: Copy(scalp,projp);
104: Driver_for_Root_Counts(outpt,projp,q,true,sols,roco);
105:
106: if Length_Of(sols) > 0
107: then
108:
109: -- CONSTRUCTION OF THE HOMOTOPY
110:
111: Driver_for_Homotopy_Construction(outpt,projp,q,sols,target);
112:
113: -- CONTINUATION
114:
115: proj := (Number_of_Unknowns(p(p'first)) > p'last);
116: if Head_Of(sols).t /= Create(0.0)
117: then Set_Continuation_Parameter(sols,Create(0.0));
118: end if;
119: Driver_for_Polynomial_Continuation(outpt,sols,proj,target);
120:
121: -- ROOT REFINING
122:
123: Driver_for_Root_Refining(outpt,scalp,p,basis,scalvec,sols);
124: end if;
125:
126: end;
127:
128: tstop(timer);
129: new_line(outpt);
130: print_times(outpt,timer,"solving the polynomial system");
131: new_line(outpt);
132: put(outpt,Bye_Bye_Message);
133: Close(outpt);
134:
135: end mainphc;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>