Return to generic_matrices.ads CVS log | Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices |
File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices / generic_matrices.ads (download)
Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:23 2000 UTC (23 years, 10 months ago) by maekawa
Import the second public release of PHCpack. OKed by Jan Verschelde. |
with Abstract_Ring,Generic_Vectors; generic with package Ring is new Abstract_Ring(<>); with package Vectors is new Generic_Vectors(Ring); package Generic_Matrices is -- DESCRIPTION : -- An abstraction for matrices with coefficients over any ring. use Ring; use Vectors; type Matrix is array ( integer range <>, integer range <> ) of number; type Link_to_Matrix is access Matrix; -- COMPARISON AND COPYING : function Equal ( a,b : Matrix ) return boolean; -- DESCRIPTION : -- Comparing by using the comparison operations of the Ring. procedure Copy ( a : in Matrix; b : in out Matrix ); -- DESCRIPTION : -- Makes a deep copy of the matrix a to the matrix b. -- REQUIRED : a'range(1) = b'range(1) and a'range(2) = b'range(2). -- MATRIX-MATRIX OPERATIONS : function "+" ( a,b : Matrix ) return Matrix; -- return a+b function "+" ( a : Matrix ) return Matrix; -- copies a function "-" ( a,b : Matrix ) return Matrix; -- return a-b function "-" ( a : Matrix ) return Matrix; -- return -a function "*" ( a,b : Matrix ) return Matrix; -- return a*b procedure Mul1 ( a : in out Matrix; b : in Matrix ); -- a := a*b procedure Mul2 ( a : in Matrix; b : in out Matrix ); -- b := a*b -- MATRIX-VECTOR OPERATIONS : function "*" ( a : Matrix; v : Vector ) return Vector; -- return a*v function "*" ( v : Vector; a : Matrix ) return Vector; -- return v*a procedure Mul ( a : in Matrix; v : in out Vector ); -- v := a*v procedure Mul ( v : in out Vector; a : in Matrix ); -- v := a*v -- DESTRUCTORS : procedure Clear ( a : in out Matrix ); procedure Clear ( a : in out Link_to_Matrix ); -- DESCRIPTION : -- Deallocation of memory. end Generic_Matrices;