File: [local] / OpenXM_contrib / PHC / Ada / Schubert / bracket_polynomials_io.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:32 2000 UTC (23 years, 8 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_Floating_Numbers; use Standard_Floating_Numbers;
with Standard_Floating_Numbers_io; use Standard_Floating_Numbers_io;
with Standard_Complex_Numbers; use Standard_Complex_Numbers;
with Bracket_Monomials_io; use Bracket_Monomials_io;
package body Bracket_Polynomials_io is
procedure Write_Number ( file : in file_type; c : in Complex_Number;
ic : out integer ) is
-- DESCRIPTION :
-- Writes the complex coefficient in a concise way.
f : double_float;
i : integer := 0;
begin
if IMAG_PART(c) /= 0.0
then put(file,"(");
put(file,REAL_PART(c)); put(file," + ");
put(file,IMAG_PART(c));
put(file,")");
else f := REAL_PART(c);
i := integer(f);
if (f - double_float(i)) /= 0.0
then put(file,f);
else if i > 0
then put(file,"+");
if i /= 1
then put(file,i,1);
end if;
elsif i = -1
then put(file,"-");
else put(file,i,1);
end if;
end if;
end if;
ic := i;
end Write_Number;
procedure put ( t : in Bracket_Term ) is
begin
put(Standard_Output,t);
end put;
procedure put ( file : in file_type; t : in Bracket_Term ) is
ic : integer;
begin
Write_Number(file,t.coeff,ic);
if ic /= 1 and ic /= -1
then put(file,"*");
end if;
put(file,t.monom);
end put;
procedure put ( p : in Bracket_Polynomial ) is
begin
put(Standard_Output,p);
end put;
procedure put ( file : in file_type; p : in Bracket_Polynomial ) is
cnt : natural := 0;
procedure Write_Term ( t : in Bracket_Term; continue : out boolean ) is
begin
cnt := cnt + 1;
if cnt > 4
then cnt := 1;
new_line(file);
end if;
put(file,t);
continue := true;
end Write_Term;
procedure Write_Terms is new Enumerate_Terms(Write_Term);
begin
Write_Terms(p);
put_line(file,";");
end put;
end Bracket_Polynomials_io;