Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Matrices/generic_matrices.ads, Revision 1.1.1.1
1.1 maekawa 1: with Abstract_Ring,Generic_Vectors;
2:
3: generic
4:
5: with package Ring is new Abstract_Ring(<>);
6: with package Vectors is new Generic_Vectors(Ring);
7:
8: package Generic_Matrices is
9:
10: -- DESCRIPTION :
11: -- An abstraction for matrices with coefficients over any ring.
12:
13: use Ring; use Vectors;
14:
15: type Matrix is array ( integer range <>, integer range <> ) of number;
16: type Link_to_Matrix is access Matrix;
17:
18: -- COMPARISON AND COPYING :
19:
20: function Equal ( a,b : Matrix ) return boolean;
21:
22: -- DESCRIPTION :
23: -- Comparing by using the comparison operations of the Ring.
24:
25: procedure Copy ( a : in Matrix; b : in out Matrix );
26:
27: -- DESCRIPTION :
28: -- Makes a deep copy of the matrix a to the matrix b.
29:
30: -- REQUIRED : a'range(1) = b'range(1) and a'range(2) = b'range(2).
31:
32: -- MATRIX-MATRIX OPERATIONS :
33:
34: function "+" ( a,b : Matrix ) return Matrix; -- return a+b
35: function "+" ( a : Matrix ) return Matrix; -- copies a
36: function "-" ( a,b : Matrix ) return Matrix; -- return a-b
37: function "-" ( a : Matrix ) return Matrix; -- return -a
38: function "*" ( a,b : Matrix ) return Matrix; -- return a*b
39:
40: procedure Mul1 ( a : in out Matrix; b : in Matrix ); -- a := a*b
41: procedure Mul2 ( a : in Matrix; b : in out Matrix ); -- b := a*b
42:
43: -- MATRIX-VECTOR OPERATIONS :
44:
45: function "*" ( a : Matrix; v : Vector ) return Vector; -- return a*v
46: function "*" ( v : Vector; a : Matrix ) return Vector; -- return v*a
47:
48: procedure Mul ( a : in Matrix; v : in out Vector ); -- v := a*v
49: procedure Mul ( v : in out Vector; a : in Matrix ); -- v := a*v
50:
51: -- DESTRUCTORS :
52:
53: procedure Clear ( a : in out Matrix );
54: procedure Clear ( a : in out Link_to_Matrix );
55:
56: -- DESCRIPTION :
57: -- Deallocation of memory.
58:
59: end Generic_Matrices;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>