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

Annotation of OpenXM_contrib/PHC/Ada/Schubert/ts_mathom.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io,integer_io;                     use text_io,integer_io;
                      2: with Standard_Complex_Numbers;               use Standard_Complex_Numbers;
                      3: with Standard_Complex_Numbers_io;            use Standard_Complex_Numbers_io;
                      4: with Standard_Complex_Matrices;              use Standard_Complex_Matrices;
                      5: with Standard_Complex_Matrices_io;           use Standard_Complex_Matrices_io;
                      6: with Matrix_Homotopies;
                      7:
                      8: procedure ts_mathom is
                      9:
                     10: -- DESCRIPTION :
                     11: --   Test of the package Matrix_Homotopies.
                     12:
                     13:   procedure Read is
                     14:
                     15:     n,m : natural;
                     16:
                     17:   begin
                     18:     new_line;
                     19:     put_line("Adding a new matrix homotopy");
                     20:     new_line;
                     21:     put("Give number of rows : "); get(n);
                     22:     put("Give number of columns : "); get(m);
                     23:     declare
                     24:          start,target : Matrix(1..n,1..m);
                     25:     begin
                     26:       put("Give "); put(n,1); put("x"); put(m,1);
                     27:       put_line(" complex matrix as start : "); get(start);
                     28:       put("Give "); put(n,1); put("x"); put(m,1);
                     29:       put_line(" complex matrix as target : "); get(target);
                     30:       Matrix_Homotopies.Add(start,target);
                     31:       put_line("Matrix homotopy added...");
                     32:        end;
                     33:   end Read;
                     34:
                     35:   procedure Modify is
                     36:
                     37:     k,n,m : natural;
                     38:     ans : character;
                     39:
                     40:   begin
                     41:     new_line;
                     42:     put_line("Modifying or adding a matrix homotopy.");
                     43:     new_line;
                     44:     put("Give the number of the map : "); get(k);
                     45:     put("Give number of rows : "); get(n);
                     46:     put("Give number of columns : "); get(m);
                     47:     declare
                     48:          start,target : Matrix(1..n,1..m);
                     49:     begin
                     50:       put("Do you want to modify the start ? (y/n) "); get(ans);
                     51:       if ans = 'y'
                     52:        then put("Give "); put(n,1); put("x"); put(m,1);
                     53:             put_line(" complex matrix as start : "); get(start);
                     54:             Matrix_Homotopies.Add_Start(k,start);
                     55:       end if;
                     56:       put("Do you want to modify the target ? (y/n) "); get(ans);
                     57:       if ans = 'y'
                     58:        then put("Give "); put(n,1); put("x"); put(m,1);
                     59:             put_line(" complex matrix as target : "); get(target);
                     60:             Matrix_Homotopies.Add_Target(k,target);
                     61:       end if;
                     62:       put_line("Matrix homotopy modified...");
                     63:        end;
                     64:   end Modify;
                     65:
                     66:   procedure Eval is
                     67:
                     68:     k : natural;
                     69:     t : Complex_Number;
                     70:     ans : character;
                     71:
                     72:   begin
                     73:     new_line;
                     74:     put_line("Evaluating a matrix homotopy.");
                     75:     new_line;
                     76:     loop
                     77:       put("Give the number of the map : "); get(k);
                     78:       loop
                     79:         put("Give the continuation parameter t : "); get(t);
                     80:         declare
                     81:           eva : constant Matrix := Matrix_Homotopies.Eval(k,t);
                     82:         begin
                     83:           put_line("The evaluated map : "); put(eva);
                     84:         end;
                     85:         put("Do you want to evaluate this maps for other values ? (y/n) ");
                     86:         get(ans);
                     87:         exit when (ans /= 'y');
                     88:       end loop;
                     89:       put("Do you want to evaluate other maps ? (y/n) "); get(ans);
                     90:       exit when (ans /= 'y');
                     91:     end loop;
                     92:   end Eval;
                     93:
                     94:   procedure Main is
                     95:
                     96:     nb : natural;
                     97:     ans : character;
                     98:
                     99:   begin
                    100:     new_line;
                    101:     put_line("Testing the matrix homotopies.");
                    102:     new_line;
                    103:     put("Give the number of matrix homotopies : "); get(nb);
                    104:     Matrix_Homotopies.Init(nb);
                    105:        loop
                    106:       new_line;
                    107:       put_line("Choose one of the following : ");
                    108:       put_line("  0. Exit this program;");
                    109:       put_line("  1. Read and Add a new matrix homotopy;");
                    110:       put_line("  2. Modify or Add a matrix homotopy;");
                    111:       put_line("  3. Evaluate a matrix homotopy.");
                    112:       put("Type 0,1,2 or 3 to make your choice : "); get(ans);
                    113:       exit when (ans = '0');
                    114:       case ans is
                    115:         when '1' => Read;
                    116:         when '2' => Modify;
                    117:         when '3' => Eval;
                    118:         when others => null;
                    119:       end case;
                    120:     end loop;
                    121:     Matrix_Homotopies.Clear;
                    122:   end Main;
                    123:
                    124: begin
                    125:   Main;
                    126: end ts_mathom;

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