[BACK]Return to random_product_system_io.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/random_product_system_io.adb, Revision 1.1

1.1     ! maekawa     1: with integer_io;
        !             2: with Standard_Floating_Numbers;          use Standard_Floating_Numbers;
        !             3: with Standard_Floating_Numbers_io;       use Standard_Floating_Numbers_io;
        !             4: with Standard_Complex_Numbers;           use Standard_Complex_Numbers;
        !             5: with Standard_Complex_Vectors;           use Standard_Complex_Vectors;
        !             6: with Standard_Natural_Vectors;
        !             7: with Symbol_Table,Symbol_Table_io;
        !             8: with Standard_Complex_Polynomials;       use Standard_Complex_Polynomials;
        !             9: with Standard_Complex_Polynomials_io;    use Standard_Complex_Polynomials_io;
        !            10: with Standard_Complex_Poly_Systems;      use Standard_Complex_Poly_Systems;
        !            11: with Standard_Complex_Poly_Systems_io;   use Standard_Complex_Poly_Systems_io;
        !            12: with Random_Product_System;
        !            13:
        !            14: package body Random_Product_System_io is
        !            15:
        !            16:   procedure get ( n : out natural ) is
        !            17:   begin
        !            18:     Random_Product_System_io.get(Standard_Input,n);
        !            19:   end get;
        !            20:
        !            21:   procedure get ( file : in file_type; n : out natural ) is
        !            22:
        !            23:     nn : natural;
        !            24:
        !            25:   begin
        !            26:     integer_io.get(file,nn); n := nn;
        !            27:     Random_Product_System.Init(nn);
        !            28:     declare
        !            29:       h : Vector(0..nn);
        !            30:       pp : Poly;
        !            31:       d : degrees := new Standard_Natural_Vectors.Vector'(1..nn => 0);
        !            32:       stop : boolean;
        !            33:     begin
        !            34:       get(file,nn,pp); Clear(pp);
        !            35:       for i in 1..nn loop
        !            36:         stop := false;
        !            37:         while not stop loop
        !            38:           get(file,nn,pp);
        !            39:           stop := (pp = Null_Poly);
        !            40:           exit when stop;
        !            41:           h(0) := Coeff(pp,d);
        !            42:           for j in 1..nn loop
        !            43:             d(j) := 1;
        !            44:             h(j) := Coeff(pp,d);
        !            45:             d(j) := 0;
        !            46:           end loop;
        !            47:           Random_Product_System.Add_Hyperplane(i,h);
        !            48:         end loop;
        !            49:       end loop;
        !            50:     end;
        !            51:   end get;
        !            52:
        !            53:   procedure put ( n,fore,after,exp : in natural ) is
        !            54:   begin
        !            55:     Random_Product_System_io.put(Standard_Output,n,fore,after,exp);
        !            56:   end put;
        !            57:
        !            58:   procedure put ( file : in file_type; n,fore,after,exp : in natural ) is
        !            59:
        !            60:     h : Vector(0..n);
        !            61:
        !            62:     procedure Write_Number ( file : in file_type; x : in Complex_Number ) is
        !            63:     begin
        !            64:       if IMAG_PART(x) + 1.0 = 1.0
        !            65:        then put(file,REAL_PART(x),fore,after,exp);
        !            66:        else put(file,'(');
        !            67:             put(file,REAL_PART(x),fore,after,exp);
        !            68:             put(file,'+');
        !            69:             put(file,IMAG_PART(x),fore,after,exp);
        !            70:             put(file,')');
        !            71:       end if;
        !            72:     end Write_Number;
        !            73:
        !            74:   begin
        !            75:     for i in 1..n loop
        !            76:       put(file,"The hyperplanes for the "); integer_io.put(file,i,1);
        !            77:       put_line(file,"th equation :");
        !            78:       for j in 1..Random_Product_System.Number_Of_Hyperplanes(i) loop
        !            79:         h := Random_Product_System.Get_Hyperplane(i,j);
        !            80:         put(file,' ');
        !            81:         for k in 1..n loop
        !            82:          Write_Number(file,h(k));
        !            83:          put(file,'*');
        !            84:          Symbol_Table_io.put(file,Symbol_Table.Get(k));
        !            85:          put(file," + ");
        !            86:         end loop;
        !            87:         Write_Number(file,h(0));
        !            88:         new_line(file);
        !            89:       end loop;
        !            90:     end loop;
        !            91:   end put;
        !            92:
        !            93: end Random_Product_System_io;

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