Annotation of OpenXM_contrib/PHC/Ada/Main/bablvali.adb, Revision 1.1.1.1
1.1 maekawa 1: with text_io,integer_io; use text_io,integer_io;
2: with Timing_Package; use Timing_Package;
3: with Communications_with_User; use Communications_with_User;
4: with File_Scanning; use File_Scanning;
5: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
6: with Standard_Floating_Numbers_io; use Standard_Floating_Numbers_io;
7: with Numbers_io; use Numbers_io;
8: with Standard_Complex_Poly_Systems; use Standard_Complex_Poly_Systems;
9: with Standard_Complex_Poly_Systems_io; use Standard_Complex_Poly_Systems_io;
10: with Standard_Complex_Solutions; use Standard_Complex_Solutions;
11: with Standard_Complex_Solutions_io; use Standard_Complex_Solutions_io;
12: with Standard_Root_Refiners; use Standard_Root_Refiners;
13:
14: procedure bablvali ( infilename,outfilename : in string ) is
15:
16: timer : timing_widget;
17: lp : Link_to_Poly_Sys;
18: infile,outfile : file_type;
19: ans : character;
20: n : natural;
21: sysonfile,found : boolean;
22: sols : Solution_List;
23:
24: procedure Read_System ( file : in out file_type; filename : in string ) is
25: begin
26: if filename /= ""
27: then Open(file,in_file,filename);
28: get(file,lp);
29: sysonfile := true;
30: else sysonfile := false;
31: end if;
32: exception
33: when others => put_line("Something is wrong with argument file...");
34: sysonfile := false;
35: lp := null; return;
36: end Read_System;
37:
38: procedure Refine_Roots is
39:
40: epsxa,epsfa : constant double_float := 10.0**(-8);
41: tolsing : constant double_float := 10.0**(-8);
42: maxit : constant natural := 3;
43: numb : natural := 0;
44: refsols : Solution_List;
45:
46: begin
47: new_line(outfile);
48: put_line(outfile,"ROOT REFINING PARAMETERS");
49: put(outfile," tolerance for error on the root : ");
50: put(outfile,epsxa,2,3,3); new_line(outfile);
51: put(outfile," tolerance for residual : ");
52: put(outfile,epsfa,2,3,3); new_line(outfile);
53: put(outfile," tolerance for singular roots : ");
54: put(outfile,tolsing,2,3,3); new_line(outfile);
55: put(outfile," maximum number of iterations : ");
56: put(outfile,maxit,2); new_line(outfile);
57: tstart(timer);
58: Reporting_Root_Refiner
59: (outfile,lp.all,sols,refsols,epsxa,epsfa,tolsing,numb,maxit,false);
60: tstop(timer);
61: new_line(outfile);
62: put_line(outfile,"THE SOLUTIONS :");
63: put(outfile,Length_Of(refsols),Head_Of(refsols).n,refsols);
64: new_line(outfile);
65: print_times(outfile,timer,"Root refining");
66: end Refine_Roots;
67:
68: begin
69: Read_System(infile,infilename);
70: if lp = null
71: then
72: new_line;
73: put("Is the system on file ? (y/n) ");
74: Ask_Yes_or_No(ans);
75: if ans = 'y'
76: then put_line("Reading the name of the input file.");
77: Read_Name_and_Open_File(infile);
78: get(infile,lp);
79: sysonfile := true;
80: else put("Give the dimension : "); get(n);
81: lp := new Poly_Sys(1..n);
82: put("Give "); put(n,1); put(" "); put(n,1);
83: put_line("-variate polynomials :");
84: get(n,lp.all);
85: skip_line;
86: sysonfile := false;
87: end if;
88: end if;
89:
90: Create_Output_File(outfile,outfilename);
91: put(outfile,lp.all);
92:
93: if sysonfile
94: then Scan_and_Skip(infile,"SOLUTIONS",found);
95: if found
96: then get(infile,sols);
97: end if;
98: Close(infile);
99: else found := false;
100: end if;
101: if not found
102: then new_line; Read(sols);
103: end if;
104:
105: Refine_Roots;
106: end bablvali;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>