[BACK]Return to bablphc.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Main

Annotation of OpenXM_contrib/PHC/Ada/Main/bablphc.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io;                            use text_io;
                      2: with Communications_with_User;           use Communications_with_User;
                      3: with Timing_Package;                     use Timing_Package;
                      4: with Standard_Complex_Poly_Systems;      use Standard_Complex_Poly_Systems;
                      5: with Standard_Complex_Poly_Systems_io;   use Standard_Complex_Poly_Systems_io;
                      6: with Standard_Complex_Solutions;         use Standard_Complex_Solutions;
                      7: with Scaling;                            use Scaling;
                      8: with Black_Box_Root_Counting;
                      9: with Black_Polynomial_Continuations;     use Black_Polynomial_Continuations;
                     10:
                     11: procedure bablphc ( infilename,outfilename : in string ) is
                     12:
                     13:   procedure Read_System ( file : in out file_type; filename : in string;
                     14:                           p : in out Link_to_Poly_Sys ) is
                     15:   begin
                     16:     if filename /= ""
                     17:      then Open_Input_File(file,filename);
                     18:           get(file,p);
                     19:     end if;
                     20:   exception
                     21:     when others => put_line("Something is wrong with argument file...");
                     22:                    p := null; return;
                     23:   end Read_System;
                     24:
                     25:   procedure Timing_Summary ( file : in file_type;
                     26:                              roco,hoco,poco,total : in duration ) is
                     27:
                     28:     b0 : constant string :=
                     29:      "  ---------------------------------------------------------------------";
                     30:     b1 : constant string :=
                     31:      "  |                    TIMING INFORMATION SUMMARY                     |";
                     32:     b2 : constant string :=
                     33:      "  |   root counts  |  start system  |  continuation  |   total time   |";
                     34:
                     35:   begin
                     36:     put_line(file,b0);
                     37:     put_line(file,b1);
                     38:     put_line(file,b0);
                     39:     put_line(file,b2);
                     40:     put_line(file,b0);
                     41:     put(file,"  | ");
                     42:     print_hms(file,roco); put(file," | ");
                     43:     print_hms(file,hoco); put(file," | ");
                     44:     print_hms(file,poco); put(file," | ");
                     45:     print_hms(file,total); put_line(file," |");
                     46:     put_line(file,b0);
                     47:   end Timing_Summary;
                     48:
                     49:   procedure Main is
                     50:
                     51:     timer : timing_widget;
                     52:     infile,outfile : file_type;
                     53:     p,q : Link_to_Poly_Sys;
                     54:     rc : natural;
                     55:     sols : Solution_List;
                     56:     roco,hoco,poco,total : duration;
                     57:
                     58:   begin
                     59:     Read_System(infile,infilename,p);
                     60:     if p = null
                     61:      then new_line; get(p);
                     62:     end if;
                     63:     Create_Output_File(outfile,outfilename);
                     64:     put(outfile,p'last,p.all);
                     65:     q := new Poly_Sys(p'range);
                     66:     tstart(timer);
                     67:     declare
                     68:       pp : Poly_Sys(p'range) := p.all;
                     69:     begin
                     70:       Black_Box_Root_Counting(outfile,pp,rc,q.all,sols,roco,hoco);
                     71:       if rc /= 0
                     72:        then
                     73:          Scale(pp);
                     74:          Black_Box_Polynomial_Continuation(outfile,pp,q.all,sols,poco);
                     75:        end if;
                     76:     end;
                     77:     tstop(timer);
                     78:     total := Elapsed_User_Time(timer);
                     79:     Close(infile);
                     80:     new_line(outfile);
                     81:     print_times(outfile,timer,"Solving the polynomial system");
                     82:     new_line(outfile);
                     83:     Timing_Summary(outfile,roco,hoco,poco,total);
                     84:     Close(outfile);
                     85:   end Main;
                     86:
                     87: begin
                     88:   Main;
                     89: end bablphc;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>