Annotation of OpenXM_contrib/PHC/Ada/Main/mainvali.adb, Revision 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 Multprec_Floating_Numbers; use Multprec_Floating_Numbers;
! 8: with Multprec_Floating_Numbers_io; use Multprec_Floating_Numbers_io;
! 9: with Standard_Complex_Numbers; use Standard_Complex_Numbers;
! 10: with Standard_Complex_Numbers_io; use Standard_Complex_Numbers_io;
! 11: with Numbers_io; use Numbers_io;
! 12: with Standard_Complex_Vectors; use Standard_Complex_Vectors;
! 13: with Standard_Complex_Vectors_io; use Standard_Complex_Vectors_io;
! 14: with Standard_Complex_Poly_Systems; use Standard_Complex_Poly_Systems;
! 15: with Standard_Complex_Poly_Systems_io; use Standard_Complex_Poly_Systems_io;
! 16: with Standard_to_Multprec_Convertors; use Standard_to_Multprec_Convertors;
! 17: with Multprec_Complex_Poly_Systems; use Multprec_Complex_Poly_Systems;
! 18: with Multprec_Complex_Poly_SysFun; use Multprec_Complex_Poly_SysFun;
! 19: with Standard_Complex_Solutions;
! 20: with Standard_Complex_Solutions_io; use Standard_Complex_Solutions_io;
! 21: with Multprec_Complex_Solutions;
! 22: with Multprec_Complex_Solutions_io; use Multprec_Complex_Solutions_io;
! 23: with Standard_Root_Refiners; use Standard_Root_Refiners;
! 24: with Multprec_Root_Refiners; use Multprec_Root_Refiners;
! 25: with Multprec_Residual_Evaluations; use Multprec_Residual_Evaluations;
! 26: with Symmetry_Group; use Symmetry_Group;
! 27: with Symbolic_Symmetry_Group_io; use Symbolic_Symmetry_Group_io;
! 28: with Drivers_for_Symmetry_Group_io; use Drivers_for_Symmetry_Group_io;
! 29: with Drivers_for_Orbits_of_Solutions; use Drivers_for_Orbits_of_Solutions;
! 30: with Driver_for_Winding_Numbers;
! 31: with valipoco;
! 32: with Bye_Bye_Message;
! 33:
! 34: procedure mainvali ( infilename,outfilename : in string ) is
! 35:
! 36: procedure Display_Validation_Info is
! 37:
! 38: -- DESCRIPTION :
! 39: -- Displays information about available validation methods on screen.
! 40:
! 41: i : array(1..9) of string(1..65);
! 42:
! 43: begin
! 44: i(1):="Basic validation consists in the application of Newton's method";
! 45: i(2):="on the list of solutions. There are facilities to extract the";
! 46: i(3):="generating solutions when the symmetry group is submitted. ";
! 47: i(4):=" Winding numbers can be computed by homotopy continuation";
! 48: i(5):="methods. The user must provide a start system with solutions at";
! 49: i(6):="t < 1. ";
! 50: i(7):=" Polyhedral validation is based on the output file of poco,";
! 51: i(8):="where the polyhedral end game was turned on. This validation";
! 52: i(9):="puts up a frequency table of computed path directions. ";
! 53: for k in i'range loop
! 54: put_line(i(k));
! 55: end loop;
! 56: end Display_Validation_Info;
! 57:
! 58: -- READING THE INPUT :
! 59:
! 60: procedure Scan_System
! 61: ( file : in out file_type; filename : in string;
! 62: lp : in out Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 63: sysonfile : out boolean ) is
! 64:
! 65: -- DESCRIPTION :
! 66: -- Checks whether the given file name corresponds to a file with
! 67: -- a polynomial system in a correct format.
! 68: -- If this is the case, then sysonfile is true on return and lp
! 69: -- contains the system.
! 70:
! 71: begin
! 72: if filename /= ""
! 73: then Open(file,in_file,filename);
! 74: get(file,lp);
! 75: sysonfile := true;
! 76: else sysonfile := false;
! 77: end if;
! 78: exception
! 79: when others =>
! 80: new_line;
! 81: put("Could not open file with name "); put_line(filename);
! 82: lp := null;
! 83: sysonfile := false;
! 84: return;
! 85: end Scan_System;
! 86:
! 87: procedure Read_System
! 88: ( file : in out file_type; filename : in string;
! 89: lp : in out Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 90: sysonfile : out boolean ) is
! 91:
! 92: -- DESCRIPTION :
! 93: -- Searches first the system on file, using the given filename.
! 94: -- If necessary other files will be openend.
! 95:
! 96: ans : character;
! 97: n : natural;
! 98:
! 99: begin
! 100: Scan_System(file,filename,lp,sysonfile);
! 101: if lp = null
! 102: then loop
! 103: new_line;
! 104: put("Is the system on a file ? (y/n/i=info) ");
! 105: Ask_Alternative(ans,"yni");
! 106: if ans = 'i'
! 107: then new_line;
! 108: Standard_Complex_Poly_Systems_io.Display_Format;
! 109: new_line;
! 110: end if;
! 111: exit when ans /= 'i';
! 112: end loop;
! 113: new_line;
! 114: if ans = 'y'
! 115: then put_line("Reading the name of the input file.");
! 116: Read_Name_and_Open_File(file);
! 117: get(file,lp);
! 118: sysonfile := true;
! 119: n := lp'length;
! 120: else put("Give the dimension : "); get(n);
! 121: lp := new Standard_Complex_Poly_Systems.Poly_Sys(1..n);
! 122: put("Give "); put(n,1); put(" "); put(n,1);
! 123: put_line("-variate polynomials :");
! 124: get(n,lp.all);
! 125: skip_line; -- skip end_of_line symbol
! 126: sysonfile := false;
! 127: end if;
! 128: end if;
! 129: end Read_System;
! 130:
! 131: procedure Scan_Solutions
! 132: ( file : in out file_type; sysonfile : in boolean;
! 133: sols : in out Standard_Complex_Solutions.Solution_List;
! 134: found : out boolean ) is
! 135:
! 136: fnd : boolean := false;
! 137:
! 138: begin
! 139: if sysonfile
! 140: then Scan_and_Skip(file,"SOLUTIONS",fnd);
! 141: if fnd
! 142: then get(file,sols);
! 143: end if;
! 144: Close(file);
! 145: else fnd := false;
! 146: end if;
! 147: found := fnd;
! 148: exception
! 149: when others
! 150: => put_line("Something is wrong with the solutions, will ignore...");
! 151: Close(file);
! 152: found := false;
! 153: end Scan_Solutions;
! 154:
! 155: procedure Read_Solutions
! 156: ( file : in out file_type; sysonfile : in boolean;
! 157: sols : in out Standard_Complex_Solutions.Solution_List ) is
! 158:
! 159: found : boolean;
! 160:
! 161: begin
! 162: Scan_Solutions(file,sysonfile,sols,found);
! 163: if not found
! 164: then new_line;
! 165: put_line("Reading the name of the file for the solutions.");
! 166: Read_Name_and_Open_File(file);
! 167: get(file,sols);
! 168: Close(file);
! 169: end if;
! 170: end Read_Solutions;
! 171:
! 172: -- ROOT REFINING AUXILIARIES :
! 173:
! 174: procedure Standard_Default_Root_Refining_Parameters
! 175: ( epsxa,epsfa,tolsing : out double_float;
! 176: maxit : out natural; wout : out boolean ) is
! 177:
! 178: -- DESCRIPTION :
! 179: -- Defines the default values for the root refining parameters.
! 180:
! 181: begin
! 182: epsxa := 10.0**(-8); -- precision for correction on x
! 183: epsfa := 10.0**(-8); -- precision for residual
! 184: tolsing := 10.0**(-8); -- tolerance on inverse condition numbers
! 185: maxit := 3; -- maximal number of Newton iterations
! 186: wout := false; -- if intermediate output is wanted
! 187: end Standard_Default_Root_Refining_Parameters;
! 188:
! 189: procedure Multprec_Default_Root_Refining_Parameters
! 190: ( epsxa,epsfa,tolsing : out Floating_Number;
! 191: maxit,deci : out natural; wout : out boolean ) is
! 192:
! 193: -- DESCRIPTION :
! 194: -- Defines the default values for the root refining parameters.
! 195:
! 196: begin
! 197: epsxa := Create(10.0**(-8)); -- precision for correction on x
! 198: epsfa := Create(10.0**(-8)); -- precision for residual
! 199: tolsing := Create(10.0**(-8)); -- tolerance on inverse condition numbers
! 200: maxit := 3; -- maximal number of Newton iterations
! 201: deci := 16; -- number of decimal places
! 202: wout := false; -- if intermediate output is wanted
! 203: end Multprec_Default_Root_Refining_Parameters;
! 204:
! 205: procedure Standard_Put_Root_Refining_Parameters
! 206: ( file : in file_type; epsxa,epsfa,tolsing : in double_float;
! 207: maxit : in natural; wout : in boolean ) is
! 208:
! 209: -- DESCRIPTION :
! 210: -- Writes the parameters for the root refiner on file.
! 211:
! 212: begin
! 213: put(file," 1. output during the iterations : ");
! 214: if wout
! 215: then put(file," yes"); new_line(file);
! 216: else put(file," no"); new_line(file);
! 217: end if;
! 218: put(file," 2. tolerance for error on the root : ");
! 219: put(file,epsxa,2,3,3); new_line(file);
! 220: put(file," 3. tolerance for the residual : ");
! 221: put(file,epsfa,2,3,3); new_line(file);
! 222: put(file," 4. tolerance for singular roots : ");
! 223: put(file,tolsing,2,3,3); new_line(file);
! 224: put(file," 5. maximum number of iterations : ");
! 225: put(file,maxit,2); new_line(file);
! 226: end Standard_Put_Root_Refining_Parameters;
! 227:
! 228: procedure Multprec_Put_Root_Refining_Parameters
! 229: ( file : in file_type; epsxa,epsfa,tolsing : in Floating_Number;
! 230: maxit,deci : in natural; wout : in boolean ) is
! 231:
! 232: -- DESCRIPTION :
! 233: -- Writes the parameters for the root refiner on file.
! 234:
! 235: begin
! 236: put(file," 1. output during the iterations : ");
! 237: if wout
! 238: then put(file," yes"); new_line(file);
! 239: else put(file," no"); new_line(file);
! 240: end if;
! 241: put(file," 2. tolerance for error on the root : ");
! 242: put(file,epsxa,2,3,3); new_line(file);
! 243: put(file," 3. tolerance for the residual : ");
! 244: put(file,epsfa,2,3,3); new_line(file);
! 245: put(file," 4. tolerance for singular roots : ");
! 246: put(file,tolsing,2,3,3); new_line(file);
! 247: put(file," 5. maximum number of iterations : ");
! 248: put(file,maxit,2); new_line(file);
! 249: put(file," 6. number of decimal places : ");
! 250: put(file,deci,2); new_line(file);
! 251: end Multprec_Put_Root_Refining_Parameters;
! 252:
! 253: procedure Standard_Menu_Root_Refining_Parameters
! 254: ( file : in file_type; epsxa,epsfa,tolsing : in out double_float;
! 255: maxit : in out natural; wout : in out boolean ) is
! 256:
! 257: -- DESCRIPTION :
! 258: -- The user can set the parameters of the root refiner by the menu's.
! 259:
! 260: ans : character;
! 261:
! 262: begin
! 263: new_line;
! 264: loop
! 265: put_line("MENU with current Settings for the Root Refiner :");
! 266: Standard_Put_Root_Refining_Parameters
! 267: (Standard_Output,epsxa,epsfa,tolsing,maxit,wout);
! 268: put("Type 1,2,3,4, or 5 to change, type 0 to exit : ");
! 269: Ask_Alternative(ans,"012345");
! 270: exit when ans = '0';
! 271: case ans is
! 272: when '1' => put("Do you want output during the iterations ? (y/n) ");
! 273: Ask_Yes_or_No(ans); wout := (ans = 'y');
! 274: when '2' => put("Give new tolerance for error on the root : ");
! 275: Read_Double_Float(epsxa);
! 276: when '3' => put("Give new tolerance for residual : ");
! 277: Read_Double_Float(epsfa);
! 278: when '4' => put("Give new tolerance for singular roots : ");
! 279: Read_Double_Float(tolsing);
! 280: when '5' => put("Give new maximum number of iterations : ");
! 281: Read_Natural(maxit);
! 282: when others => null;
! 283: end case;
! 284: end loop;
! 285: new_line(file);
! 286: put_line(file,"ROOT REFINING PARAMETERS : ");
! 287: Standard_Put_Root_Refining_Parameters(file,epsxa,epsfa,tolsing,maxit,wout);
! 288: end Standard_Menu_Root_Refining_Parameters;
! 289:
! 290: procedure Multprec_Menu_Root_Refining_Parameters
! 291: ( file : in file_type;
! 292: epsxa,epsfa,tolsing : in out Floating_Number;
! 293: maxit,deci : in out natural; wout : in out boolean ) is
! 294:
! 295: -- DESCRIPTION :
! 296: -- The user can set the parameters of the root refiner by the menu's.
! 297:
! 298: ans : character;
! 299:
! 300: begin
! 301: new_line;
! 302: loop
! 303: put_line("MENU with current Settings for the Root Refiner :");
! 304: Multprec_Put_Root_Refining_Parameters
! 305: (Standard_Output,epsxa,epsfa,tolsing,maxit,deci,wout);
! 306: put("Type 1,2,3,4,5 or 6 to change, type 0 to exit : ");
! 307: Ask_Alternative(ans,"0123456");
! 308: exit when ans = '0';
! 309: case ans is
! 310: when '1' => put("Do you want output during the iterations ? (y/n) ");
! 311: Ask_Yes_or_No(ans); wout := (ans = 'y');
! 312: when '2' => put("Give new tolerance for error on the root : ");
! 313: get(epsxa);
! 314: when '3' => put("Give new tolerance for residual : ");
! 315: get(epsfa);
! 316: when '4' => put("Give new tolerance for singular roots : ");
! 317: get(tolsing);
! 318: when '5' => put("Give new maximum number of iterations : ");
! 319: Read_Natural(maxit);
! 320: when '6' => put("Give new number of decimal places : ");
! 321: Read_Natural(deci);
! 322: when others => null;
! 323: end case;
! 324: end loop;
! 325: new_line(file);
! 326: put_line(file,"ROOT REFINING PARAMETERS : ");
! 327: Multprec_Put_Root_Refining_Parameters
! 328: (file,epsxa,epsfa,tolsing,maxit,deci,wout);
! 329: end Multprec_Menu_Root_Refining_Parameters;
! 330:
! 331: procedure Refine_Roots
! 332: ( file : in file_type;
! 333: p : in Standard_Complex_Poly_Systems.Poly_Sys;
! 334: solsfile,invar,allperms,signsym : in boolean;
! 335: v : in List_of_Permutations;
! 336: epsxa,epsfa,tolsing : in double_float;
! 337: maxit : in natural; wout : in boolean;
! 338: sols,refsols
! 339: : in out Standard_Complex_Solutions.Solution_List ) is
! 340:
! 341: -- DESCRIPTION :
! 342: -- Refines the roots and computes generating solutions when required.
! 343:
! 344: -- ON ENTRY :
! 345: -- file for writing results on;
! 346: -- p the polynomial system under consideration;
! 347: -- solsfile whether refined solution have to go to separate file;
! 348: -- invar whether generating solutions have to be computed;
! 349: -- allperms whether invariant under all permutations;
! 350: -- signsym whether there is sign-symmetry;
! 351: -- v group representation, only needed when invar;
! 352: -- sols solutions that need to be refined.
! 353:
! 354: -- ON RETURN :
! 355: -- sols solutions after applying some Newton iteration;
! 356: -- refsols refined solutions, with the exception of failures and
! 357: -- the non-generating solutions.
! 358:
! 359: numit : natural := 0;
! 360:
! 361: begin
! 362: if solsfile or invar
! 363: then Reporting_Root_Refiner
! 364: (file,p,sols,refsols,epsxa,epsfa,tolsing,numit,maxit,wout);
! 365: if invar
! 366: then Driver_for_Orbits_of_Solutions
! 367: (file,refsols,v,allperms,signsym,epsxa);
! 368: end if;
! 369: else Reporting_Root_Refiner
! 370: (file,p,sols,epsxa,epsfa,tolsing,numit,maxit,wout);
! 371: end if;
! 372: end Refine_Roots;
! 373:
! 374: procedure Refine_Roots
! 375: ( file : in file_type;
! 376: p : in Standard_Complex_Poly_Systems.Poly_Sys;
! 377: solsfile : in boolean;
! 378: epsxa,epsfa,tolsing : in double_float;
! 379: maxit : in natural; wout : in boolean;
! 380: sols,refsols : in out Standard_Complex_Solutions.Solution_List ) is
! 381:
! 382: -- DESCRIPTION :
! 383: -- Root refinement without computing of generating solutions.
! 384:
! 385: numit : natural := 0;
! 386:
! 387: begin
! 388: if solsfile
! 389: then Reporting_Root_Refiner
! 390: (file,p,sols,refsols,epsxa,epsfa,tolsing,numit,maxit,wout);
! 391: else Reporting_Root_Refiner
! 392: (file,p,sols,epsxa,epsfa,tolsing,numit,maxit,wout);
! 393: end if;
! 394: end Refine_Roots;
! 395:
! 396: procedure End_of_Input_Message is
! 397: begin
! 398: new_line;
! 399: put_line("No more input expected. See output file for results.");
! 400: new_line;
! 401: end End_of_Input_Message;
! 402:
! 403: -- VALIDATION PROCEDURES :
! 404:
! 405: procedure Winding_Validation is
! 406:
! 407: -- DESCRIPTION :
! 408: -- Validation by computing winding numbers by homotopy continuation.
! 409:
! 410: use Standard_Complex_Solutions;
! 411:
! 412: lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 413: timer : Timing_Widget;
! 414: infile,solsft,outfile : file_type;
! 415: ans : character;
! 416: sysonfile,solsfile,wout : boolean;
! 417: sols,refsols: Standard_Complex_Solutions.Solution_List;
! 418: epsxa,epsfa,tolsing : double_float;
! 419: maxit : natural;
! 420:
! 421: begin
! 422: Read_System(infile,infilename,lp,sysonfile);
! 423: Create_Output_File(outfile,outfilename);
! 424: put(outfile,lp'last,lp.all);
! 425: Read_Solutions(infile,sysonfile,sols);
! 426: new_line;
! 427: put("Do you want the refined solutions on separate file ? (y/n) ");
! 428: Ask_Yes_or_No(ans);
! 429: if ans = 'y'
! 430: then solsfile := true;
! 431: put_line("Reading the name of the file to write the solutions on.");
! 432: Read_Name_and_Create_File(solsft);
! 433: else solsfile := false;
! 434: end if;
! 435: Standard_Default_Root_Refining_Parameters(epsxa,epsfa,tolsing,maxit,wout);
! 436: Standard_Menu_Root_Refining_Parameters
! 437: (outfile,epsxa,epsfa,tolsing,maxit,wout);
! 438: Driver_for_Winding_Numbers(outfile,lp.all,sols);
! 439: tstart(timer);
! 440: Refine_Roots(outfile,lp.all,solsfile,
! 441: epsxa,epsfa,tolsing,maxit,wout,sols,refsols);
! 442: tstop(timer);
! 443: if solsfile
! 444: then put(solsft,Length_Of(refsols),Head_Of(refsols).n,refsols);
! 445: Close(solsft);
! 446: end if;
! 447: new_line(outfile);
! 448: print_times(outfile,timer,"Root Refinement");
! 449: Close(outfile);
! 450: end Winding_Validation;
! 451:
! 452: procedure Standard_Weeding_Validation is
! 453:
! 454: -- DESCRIPTION :
! 455: -- Validation by refining the roots and weeding out the solution set.
! 456:
! 457: use Standard_Complex_Solutions;
! 458:
! 459: lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 460: timer : Timing_Widget;
! 461: infile,solsft,outfile : file_type;
! 462: n,maxit : natural;
! 463: ans : character;
! 464: sysonfile,solsfile,wout : boolean;
! 465: invar,allperms,signsym,allsigns : boolean;
! 466: g,v : List_of_Permutations;
! 467: sols,refsols: Standard_Complex_Solutions.Solution_List;
! 468: epsxa,epsfa,tolsing : double_float;
! 469:
! 470: begin
! 471: Read_System(infile,infilename,lp,sysonfile);
! 472: Create_Output_File(outfile,outfilename);
! 473: put(outfile,lp'last,lp.all);
! 474: Read_Solutions(infile,sysonfile,sols);
! 475: new_line;
! 476: put("Is the system invariant under group actions ? (y/n) ");
! 477: Ask_Yes_or_No(ans);
! 478: if ans = 'y'
! 479: then invar := true; n := lp'length;
! 480: Read_Symmetry_Group(n,g,v,allperms,signsym,allsigns);
! 481: new_line(outfile);
! 482: put_line(outfile,"THE SYMMETRY GROUP : ");
! 483: new_line(outfile);
! 484: Symbolic_Symmetry_Group_io.put(outfile,v);
! 485: new_line(outfile);
! 486: else invar := false;
! 487: end if;
! 488: new_line;
! 489: put("Do you want the refined solutions on separate file ? (y/n) ");
! 490: Ask_Yes_or_No(ans);
! 491: if ans = 'y'
! 492: then solsfile := true;
! 493: put_line("Reading the name of the file to write the solutions on.");
! 494: Read_Name_and_Create_File(solsft);
! 495: else solsfile := false;
! 496: end if;
! 497: Standard_Default_Root_Refining_Parameters(epsxa,epsfa,tolsing,maxit,wout);
! 498: Standard_Menu_Root_Refining_Parameters
! 499: (outfile,epsxa,epsfa,tolsing,maxit,wout);
! 500: End_of_Input_Message;
! 501: tstart(timer);
! 502: Refine_Roots(outfile,lp.all,solsfile,invar,allperms,signsym,v,
! 503: epsxa,epsfa,tolsing,maxit,wout,sols,refsols);
! 504: tstop(timer);
! 505: if solsfile
! 506: then put(solsft,Length_Of(refsols),Head_Of(refsols).n,refsols);
! 507: Close(solsft);
! 508: end if;
! 509: new_line(outfile);
! 510: print_times(outfile,timer,"Root Refinement");
! 511: Close(outfile);
! 512: end Standard_Weeding_Validation;
! 513:
! 514: procedure Multprec_Residual_Evaluator is
! 515:
! 516: -- DESCRIPTION :
! 517: -- Evaluation of residuals using multi-precision arithmetic.
! 518:
! 519: lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 520: timer : Timing_Widget;
! 521: infile,outfile : file_type;
! 522: sysonfile : boolean;
! 523: sols : Standard_Complex_Solutions.Solution_List;
! 524:
! 525: begin
! 526: Read_System(infile,infilename,lp,sysonfile);
! 527: Create_Output_File(outfile,outfilename);
! 528: put(outfile,lp'last,lp.all);
! 529: Read_Solutions(infile,sysonfile,sols);
! 530: new_line(outfile);
! 531: put_line(outfile,"THE SOLUTIONS IN STANDARD PRECISION : ");
! 532: put(outfile,Standard_Complex_Solutions.Length_Of(sols),lp'last,sols);
! 533: declare
! 534: mpsols : Multprec_Complex_Solutions.Solution_List
! 535: := Multprec_Complex_Solutions.Create(sols);
! 536: mp : Multprec_Complex_Poly_Systems.Poly_Sys(lp'range) := Convert(lp.all);
! 537: mp_eval : Multprec_Complex_Poly_SysFun.Eval_Poly_Sys(mp'range)
! 538: := Create(mp);
! 539: deci,size : natural;
! 540: begin
! 541: new_line;
! 542: put("Give the number of decimal places : "); get(deci);
! 543: size := Decimal_to_Size(deci);
! 544: Multprec_Complex_Solutions.Set_Size(mpsols,Decimal_to_Size(deci));
! 545: new_line(outfile);
! 546: put(outfile,"THE RESIDUALS with "); put(outfile,deci,1);
! 547: put_line(outfile," decimal places :");
! 548: tstart(timer);
! 549: Residuals(outfile,mp_eval,mpsols);
! 550: tstop(timer);
! 551: end;
! 552: new_line(outfile);
! 553: print_times(outfile,timer,"Multi-Precision Residual Evaluation");
! 554: Close(outfile);
! 555: end Multprec_Residual_Evaluator;
! 556:
! 557: procedure Call_Multprec_Root_Refiner
! 558: ( file : in file_type;
! 559: p : in Multprec_Complex_Poly_Systems.Poly_Sys;
! 560: sols : in out Multprec_Complex_Solutions.Solution_List ) is
! 561:
! 562: timer : Timing_Widget;
! 563: epsxa,epsfa,tolsing : Floating_Number;
! 564: maxit,numit,deci,size : natural;
! 565: wout : boolean;
! 566:
! 567: begin
! 568: new_line;
! 569: Multprec_Default_Root_Refining_Parameters
! 570: (epsxa,epsfa,tolsing,maxit,deci,wout);
! 571: Multprec_Menu_Root_Refining_Parameters
! 572: (file,epsxa,epsfa,tolsing,maxit,deci,wout);
! 573: size := Decimal_to_Size(deci);
! 574: -- put("Give the size of the numbers : "); get(size);
! 575: Multprec_Complex_Solutions.Set_Size(sols,size);
! 576: End_of_Input_Message;
! 577: tstart(timer);
! 578: Reporting_Root_Refiner(file,p,sols,epsxa,epsfa,tolsing,numit,maxit,wout);
! 579: tstop(timer);
! 580: new_line(file);
! 581: print_times(file,timer,"Multi-Precision Root Refinement");
! 582: end Call_Multprec_Root_Refiner;
! 583:
! 584: procedure Multprec_Weeding_Validation is
! 585:
! 586: -- DESCRIPTION :
! 587: -- Newton's method using multi-precision arithmetic.
! 588:
! 589: lp : Standard_Complex_Poly_Systems.Link_to_Poly_Sys;
! 590: timer : Timing_Widget;
! 591: infile,outfile : file_type;
! 592: sysonfile : boolean;
! 593: sols : Standard_Complex_Solutions.Solution_List;
! 594:
! 595: begin
! 596: Read_System(infile,infilename,lp,sysonfile);
! 597: Create_Output_File(outfile,outfilename);
! 598: put(outfile,lp'last,lp.all);
! 599: Read_Solutions(infile,sysonfile,sols);
! 600: new_line(outfile);
! 601: put_line(outfile,"THE SOLUTIONS IN STANDARD PRECISION : ");
! 602: put(outfile,Standard_Complex_Solutions.Length_Of(sols),lp'last,sols);
! 603: declare
! 604: mpsols : Multprec_Complex_Solutions.Solution_List
! 605: := Multprec_Complex_Solutions.Create(sols);
! 606: mp : Multprec_Complex_Poly_Systems.Poly_Sys(lp'range) := Convert(lp.all);
! 607: begin
! 608: Call_Multprec_Root_Refiner(outfile,mp,mpsols);
! 609: end;
! 610: Close(outfile);
! 611: end Multprec_Weeding_Validation;
! 612:
! 613: procedure Polyhedral_End_Game_Validation is
! 614:
! 615: -- DESCRIPTION :
! 616: -- Validation of the polyhedral end game.
! 617:
! 618: pocofile,resultfile : file_type;
! 619:
! 620: begin
! 621: new_line;
! 622: put_line("Reading name of the output file of poco.");
! 623: Read_Name_and_Open_File(pocofile);
! 624: new_line;
! 625: put_line("Reading name of output file.");
! 626: Read_Name_and_Create_File(resultfile);
! 627: End_of_Input_Message;
! 628: valipoco(pocofile,resultfile);
! 629: Close(pocofile);
! 630: new_line(resultfile);
! 631: put(resultfile,Bye_Bye_Message);
! 632: Close(resultfile);
! 633: end Polyhedral_End_Game_Validation;
! 634:
! 635: procedure Display_and_Dispatch_Menu is
! 636:
! 637: ans : character;
! 638: timer : Timing_Widget;
! 639:
! 640: begin
! 641: loop
! 642: new_line;
! 643: put_line("MENU with Validation Methods : ");
! 644: put_line
! 645: (" 1. Basic Validation : refining and weeding out the solution set");
! 646: put_line
! 647: (" 2. Evaluation of the residuals using multi-precision arithmetic");
! 648: put_line
! 649: (" 3. Newton's method using multi-precision arithmetic");
! 650: put_line
! 651: (" 4. Winding-Number Computation by homotopy continuation");
! 652: put_line
! 653: (" 5. Polyhedral Validation : frequency table of path directions");
! 654: put("Type 1, 2, 3 or 4 to select validation method, or i for info : ");
! 655: Ask_Alternative(ans,"12345i");
! 656: case ans is
! 657: when 'i' => new_line;
! 658: Display_Validation_Info;
! 659: when '1' => Standard_Weeding_Validation;
! 660: when '2' => Multprec_Residual_Evaluator;
! 661: when '3' => Multprec_Weeding_Validation;
! 662: when '4' => Winding_Validation;
! 663: when '5' => Polyhedral_End_Game_Validation;
! 664: when others => null;
! 665: end case;
! 666: exit when ans /= 'i';
! 667: end loop;
! 668: end Display_and_Dispatch_Menu;
! 669:
! 670: begin
! 671: Display_and_Dispatch_Menu;
! 672: end mainvali;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>