![]() ![]() | ![]() |
File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials / standard_laur_poly_convertors.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:27 2000 UTC (23 years, 10 months ago) by maekawa
Import the second public release of PHCpack. OKed by Jan Verschelde. |
with Standard_Complex_Numbers; use Standard_Complex_Numbers; with Standard_Natural_Vectors; package body Standard_Laur_Poly_Convertors is function Laurent_Polynomial_to_Polynomial ( p : Standard_Complex_Laur_Polys.Poly ) return Standard_Complex_Polynomials.Poly is res : Standard_Complex_Polynomials.Poly; tt : Standard_Complex_Laur_Polys.Term; begin Laurent_Polynomial_to_Polynomial(p,tt,res); Standard_Complex_Laur_Polys.Clear(tt); return res; end Laurent_Polynomial_to_Polynomial; procedure Laurent_Polynomial_to_Polynomial ( l : in Standard_Complex_Laur_Polys.Poly; t : out Standard_Complex_Laur_Polys.Term; p : out Standard_Complex_Polynomials.Poly ) is min : Standard_Complex_Laur_Polys.Degrees := Standard_Complex_Laur_Polys.Minimal_Degrees(l); tt : Standard_Complex_Laur_Polys.Term; begin for i in min'range loop min(i) := -min(i); end loop; tt.cf := Create(1.0); tt.dg := min; p := Laurent_Polynomial_to_Polynomial(l,tt); t := tt; end Laurent_Polynomial_to_Polynomial; function Laurent_Polynomial_to_Polynomial ( l : Standard_Complex_Laur_Polys.Poly; t : Standard_Complex_Laur_Polys.Term ) return Standard_Complex_Polynomials.Poly is res : Standard_Complex_Polynomials.Poly; use Standard_Complex_Laur_Polys; procedure Laurent_Term_to_Term ( tt : in Term; cont : out boolean ) is rt : Standard_Complex_Polynomials.Term; begin rt.cf := tt.cf; rt.dg := new Standard_Natural_Vectors.Vector(tt.dg'range); for i in tt.dg'range loop rt.dg(i) := tt.dg(i) + t.dg(i); end loop; Standard_Complex_Polynomials.Add(res,rt); Standard_Complex_Polynomials.Clear(rt); cont := true; end Laurent_Term_to_Term; procedure LP2P is new Visiting_Iterator(Laurent_Term_to_Term); begin LP2P(l); return res; end Laurent_Polynomial_to_Polynomial; function Laurent_to_Polynomial_System ( p : Laur_Sys ) return Poly_Sys is res : Poly_Sys(p'range); begin for i in p'range loop res(i) := Laurent_Polynomial_to_Polynomial(p(i)); end loop; return res; end Laurent_to_Polynomial_System; end Standard_Laur_Poly_Convertors;