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

File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials / multprec_complex_polynomials_io.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:26 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 integer_io;                         use integer_io;
with Standard_Natural_Vectors;           use Standard_Natural_Vectors;
with Standard_Complex_Polynomials_io;
with Symbol_Table,Symbol_Table_io;       use Symbol_Table;
with Multprec_Floating_Numbers;          use Multprec_Floating_Numbers;
with Multprec_Floating_Numbers_io;       use Multprec_Floating_Numbers_io;
with Multprec_Complex_Numbers;           use Multprec_Complex_Numbers;
with Multprec_Complex_Numbers_io;        use Multprec_Complex_Numbers_io;

package body Multprec_Complex_Polynomials_io is

-- THE INPUT OPERATIONS :

  procedure get ( n : in out natural; p : in out Poly ) is
  begin
    null;
  end get;

  procedure get ( file : in file_type; n : in out natural; p : in out Poly ) is
  begin
    null;
  end get;

  procedure get ( p : in out Poly ) is
  begin
    null;
  end get;

  procedure get ( file : in file_type; p : in out Poly ) is
  begin
    null;
  end get;

-- THE OUTPUT OPERATIONS FOR TERMS :

  procedure Write ( file : in file_type; c : in Complex_Number ) is

    cre : Floating_Number := REAL_PART(c);
    cim : Floating_Number := IMAG_PART(c);

  begin
    if Equal(cim,0.0)
     then if cre > 0.0
           then put(file,"+");
          end if;
          put(file,cre);
     elsif Equal(cre,0.0)
         then if cim > 0.0
               then put(file,"+");
              end if;
              put(file,cim);
              put(file,"*i");
         else put(file,"+(");
              put(file,cre);
              if cim > 0.0
               then put(file,"+");
              end if;
              put(file,cim);
              put(file,"*i)");
    end if;
  end Write;

  procedure Write ( file : in file_type; d : in Degrees; pow : in Power ) is

    sb : Symbol;

  begin
    for i in d'range loop
      if d(i) /= 0
       then put(file,"*");
            sb := Symbol_Table.get(i);
            Symbol_Table_io.put(file,sb);
            if d(i) /= 1
             then if pow = '^'
                   then put(file,"^");
                   else put(file,"**");
                  end if;
                  put(d(i),1);
            end if;
      end if;
    end loop;
  end Write;

  procedure put ( file : in file_type; t : in Term; pow : in Power ) is
  begin
    Write(file,t.cf);
    if Sum(t.dg) /= 0
     then Write(file,t.dg,pow);
    end if;
  end put;

-- THE OUTPUT OPERATIONS :

  procedure put ( p : in Poly; pow : in Power ) is
  begin
    put(Standard_Output,p,pow);
  end put;

  procedure put ( file : in file_type; p : in Poly; pow : in Power ) is

    procedure Write_Term ( t : in Term; continue : out boolean ) is
    begin
      put(file,t,pow);
      continue := true;
    end Write_Term;
    procedure Write_Terms is new Visiting_Iterator(Write_Term);

  begin
    Write_Terms(p);
  end put;

  procedure put ( n : in natural; p : in Poly; pow : in Power ) is
  begin
    put(Standard_Output,n,p,pow);
  end put;

  procedure put ( file : in file_type;
                  n : in natural; p : in Poly; pow : in Power ) is
  begin
    put(file,n); new_line(file);
    put(file,p,pow);
  end put;

  procedure put ( p : in Poly ) is
  begin
    put(Standard_Output,p);
  end put;

  procedure put ( file : in file_type; p : in Poly ) is
  begin
    put(file,p,'*');
  end put;

  procedure put_line ( p : in Poly ) is
  begin
    put_line(Standard_Output,p);
  end put_line;

  procedure put_line ( file : in file_type; p : in Poly ) is
  begin
    put_line(file,p,'*');
  end put_line;

  procedure put_line ( p : in Poly; pow : in Power ) is
  begin
    put_line(Standard_Output,p,pow);
  end put_line;

  procedure put_line ( file : in file_type; p : in Poly; pow : in Power ) is

    procedure Write_Term ( t : in Term; continue : out boolean ) is
    begin
      put(file,t,pow);
      new_line(file);
      continue := true;
    end Write_Term;
    procedure Write_Terms is new Visiting_Iterator(Write_Term);

  begin
    Write_Terms(p);
  end put_line;

  procedure Display_Format is
  begin
    Standard_Complex_Polynomials_io.Display_Format;
  end Display_Format;

end Multprec_Complex_Polynomials_io;