![]() ![]() | ![]() |
File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Polynomials / generic_laur_poly_systems.adb (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:26 2000 UTC (23 years, 10 months ago) by maekawa
Import the second public release of PHCpack. OKed by Jan Verschelde. |
with unchecked_deallocation; package body Generic_Laur_Poly_Systems is -- COPYING : procedure Copy ( p : in Laur_Sys; q : in out Laur_Sys ) is begin for i in p'range loop Copy(p(i),q(i)); end loop; end Copy; -- ARITHMETIC OPERATIONS : function "+" ( p,q : Laur_Sys ) return Laur_Sys is res : Laur_Sys(p'range); begin for i in p'range loop res(i) := p(i)+q(i); end loop; return res; end "+"; function "-" ( p,q : Laur_Sys ) return Laur_Sys is res : Laur_Sys(p'range); begin for i in p'range loop res(i) := p(i)-q(i); end loop; return res; end "-"; function "-" ( p : Laur_Sys ) return Laur_Sys is res : Laur_Sys(p'range); begin for i in p'range loop res(i) := -p(i); end loop; return res; end "-"; function "*" ( a : number; p : Laur_Sys ) return Laur_Sys is res : Laur_Sys(p'range); begin for k in p'range loop res(k) := a*p(k); end loop; return res; end "*"; function "*" ( p : Laur_Sys; a : number ) return Laur_Sys is begin return a*p; end "*"; procedure Add ( p : in out Laur_Sys; q : in Laur_Sys ) is begin for i in p'range loop Add(p(i),q(i)); end loop; end Add; procedure Sub ( p : in out Laur_Sys; q : in Laur_Sys ) is begin for i in p'range loop Sub(p(i),q(i)); end loop; end Sub; procedure Min ( p : in out Laur_Sys ) is begin for i in p'range loop Min(p(i)); end loop; end Min; procedure Mul ( p : in out Laur_Sys; a : in number ) is begin for k in p'range loop Mul(p(k),a); end loop; end Mul; function Diff ( p : Laur_Sys; i : natural ) return Laur_Sys is res : Laur_Sys(p'range); begin for j in p'range loop res(j) := Diff(p(j),i); end loop; return res; end Diff; procedure Diff ( p : in out Laur_Sys; i : in natural ) is begin for j in p'range loop Diff(p(j),i); end loop; end Diff; -- DESTRUCTORS : procedure Clear ( p : in out Laur_Sys ) is begin for i in p'range loop Clear(p(i)); end loop; end Clear; procedure Clear ( p : in out Link_to_Laur_Sys ) is procedure free is new unchecked_deallocation(Laur_Sys,Link_to_Laur_Sys); begin if p /= null then Clear(p.all); end if; free(p); end Clear; end Generic_Laur_Poly_Systems;