Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Polynomials/generic_polynomial_systems.adb, Revision 1.1
1.1 ! maekawa 1: with unchecked_deallocation;
! 2:
! 3: package body Generic_Polynomial_Systems is
! 4:
! 5: -- COPYING :
! 6:
! 7: procedure Copy ( p : in Poly_Sys; q : in out Poly_Sys ) is
! 8: begin
! 9: for i in p'range loop
! 10: Copy(p(i),q(i));
! 11: end loop;
! 12: end Copy;
! 13:
! 14: -- ARITHMETIC OPERATIONS :
! 15:
! 16: function "+" ( p,q : Poly_Sys ) return Poly_Sys is
! 17:
! 18: res : Poly_Sys(p'range);
! 19:
! 20: begin
! 21: for i in p'range loop
! 22: res(i) := p(i)+q(i);
! 23: end loop;
! 24: return res;
! 25: end "+";
! 26:
! 27: function "-" ( p,q : Poly_Sys ) return Poly_Sys is
! 28:
! 29: res : Poly_Sys(p'range);
! 30:
! 31: begin
! 32: for i in p'range loop
! 33: res(i) := p(i)-q(i);
! 34: end loop;
! 35: return res;
! 36: end "-";
! 37:
! 38: function "-" ( p : Poly_Sys ) return Poly_Sys is
! 39:
! 40: res : Poly_Sys(p'range);
! 41:
! 42: begin
! 43: for i in p'range loop
! 44: res(i) := -p(i);
! 45: end loop;
! 46: return res;
! 47: end "-";
! 48:
! 49: function "*" ( a : number; p : Poly_Sys ) return Poly_Sys is
! 50:
! 51: res : Poly_Sys(p'range);
! 52:
! 53: begin
! 54: for k in p'range loop
! 55: res(k) := a*p(k);
! 56: end loop;
! 57: return res;
! 58: end "*";
! 59:
! 60: function "*" ( p : Poly_Sys; a : number ) return Poly_Sys is
! 61: begin
! 62: return a*p;
! 63: end "*";
! 64:
! 65: procedure Add ( p : in out Poly_Sys; q : in Poly_Sys ) is
! 66: begin
! 67: for i in p'range loop
! 68: Add(p(i),q(i));
! 69: end loop;
! 70: end Add;
! 71:
! 72: procedure Sub ( p : in out Poly_Sys; q : in Poly_Sys ) is
! 73: begin
! 74: for i in p'range loop
! 75: Sub(p(i),q(i));
! 76: end loop;
! 77: end Sub;
! 78:
! 79: procedure Min ( p : in out Poly_Sys ) is
! 80: begin
! 81: for i in p'range loop
! 82: Min(p(i));
! 83: end loop;
! 84: end Min;
! 85:
! 86: procedure Mul ( p : in out Poly_Sys; a : in number ) is
! 87: begin
! 88: for k in p'range loop
! 89: Mul(p(k),a);
! 90: end loop;
! 91: end Mul;
! 92:
! 93: function Diff ( p : Poly_Sys; i : natural ) return Poly_Sys is
! 94:
! 95: res : Poly_Sys(p'range);
! 96:
! 97: begin
! 98: for j in p'range loop
! 99: res(j) := Diff(p(j),i);
! 100: end loop;
! 101: return res;
! 102: end Diff;
! 103:
! 104: procedure Diff ( p : in out Poly_Sys; i : in natural ) is
! 105: begin
! 106: for j in p'range loop
! 107: Diff(p(j),i);
! 108: end loop;
! 109: end Diff;
! 110:
! 111: -- DESTRUCTORS :
! 112:
! 113: procedure Clear ( p : in out Poly_Sys ) is
! 114: begin
! 115: for i in p'range loop
! 116: Clear(p(i));
! 117: end loop;
! 118: end Clear;
! 119:
! 120: procedure Clear ( p : in out Link_to_Poly_Sys ) is
! 121:
! 122: procedure free is new unchecked_deallocation(Poly_Sys,Link_to_Poly_Sys);
! 123:
! 124: begin
! 125: if p /= null
! 126: then Clear(p.all);
! 127: end if;
! 128: free(p);
! 129: end Clear;
! 130:
! 131: end Generic_Polynomial_Systems;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>