[BACK]Return to ts_natmat.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices

File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices / ts_natmat.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:24 2000 UTC (23 years, 7 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD
Changes since 1.1: +0 -0 lines

Import the second public release of PHCpack.

OKed by Jan Verschelde.

with text_io,integer_io;                 use text_io,integer_io;
with Standard_Natural_Matrices;
with Standard_Natural_Matrices_io;
with Multprec_Natural_Matrices;
with Multprec_Natural_Matrices_io;

procedure ts_natmat is

-- DESCRIPTION :
--   Tests the matrix packages of standard and multi-precision naturals.

  procedure Test_Standard_io is

    use Standard_Natural_Matrices,Standard_Natural_Matrices_io;

    n,m : natural;

  begin
    put("Give the number of rows : "); get(n);
    put("Give the number of columns : "); get(m);
    declare
      mat : Matrix(1..n,1..m);
    begin
      put("Give "); put(n,1); put("x"); put(m,1);
      put_line(" natural matrix : "); get(mat);
      put_line("Your matrix : "); put(mat); new_line;
    end;
  end Test_Standard_io;

  procedure Test_Multprec_io is

    use Multprec_Natural_Matrices,Multprec_Natural_Matrices_io;

    n,m : natural;

  begin
    put("Give the number of rows : "); get(n);
    put("Give the number of columns : "); get(m);
    declare
      mat : Matrix(1..n,1..m);
    begin
      put("Give "); put(n,1); put("x"); put(m,1);
      put_line(" natural matrix : "); get(mat);
      put_line("Your matrix : "); put(mat); new_line;
    end;
  end Test_Multprec_io;

  procedure Main is

    ans : character;

  begin
    new_line;
    put_line("Interactive testing of matrices of natural numbers");
    new_line;
    loop
      put_line("Choose one of the following : ");
      put_line("  1. io of matrices of standard natural numbers.");
      put_line("  2. io of matrices of multi-precision natural numbers.");
      put("Make your choice (1/2) : "); get(ans);
      case ans is
        when '1' => Test_Standard_io;
        when '2' => Test_Multprec_io;
        when others => null;
      end case;
      put("Do you want more tests ? (y/n) "); get(ans);
      exit when ans /= 'y';
    end loop;
  end Main;

begin
  Main;
end ts_natmat;