Annotation of OpenXM_contrib/PHC/Ada/Math_Lib/Matrices/generic_vectors.ads, Revision 1.1
1.1 ! maekawa 1: with Abstract_Ring;
! 2:
! 3: generic
! 4:
! 5: with package Ring is new Abstract_Ring(<>);
! 6:
! 7: package Generic_Vectors is
! 8:
! 9: -- DESCRIPTION :
! 10: -- An abstraction for vectors with coefficients over any ring.
! 11: -- The same functionality is provided for pointers to vectors.
! 12:
! 13: use Ring;
! 14:
! 15: type Vector is array ( integer range <> ) of number;
! 16: type Link_to_Vector is access Vector;
! 17:
! 18: -- COMPARISON AND COPYING :
! 19:
! 20: function Equal ( v1,v2 : Vector ) return boolean;
! 21: function Equal ( v1,v2 : Link_to_Vector ) return boolean;
! 22:
! 23: procedure Copy ( v1 : in Vector; v2 : in out Vector );
! 24: procedure Copy ( v1 : in Link_to_Vector; v2 : in out Link_to_Vector );
! 25:
! 26: -- ARITHMETIC OPERATIONS AS FUNCTIONS :
! 27:
! 28: function "+" ( v1,v2 : Vector ) return Vector; -- return v1+v2;
! 29: function "+" ( v1,v2 : Link_to_Vector ) return Link_to_Vector;
! 30: function "+" ( v : Vector ) return Vector; -- return +v;
! 31: function "+" ( v : Link_to_Vector ) return Link_to_Vector;
! 32: function "-" ( v : Vector ) return Vector; -- return -v;
! 33: function "-" ( v : Link_to_Vector ) return Link_to_Vector;
! 34: function "-" ( v1,v2 : Vector ) return Vector; -- return v1-v2;
! 35: function "-" ( v1,v2 : Link_to_Vector ) return Link_to_Vector;
! 36: function "*" ( v : Vector; a : number ) return Vector; -- return v*a;
! 37: function "*" ( v : Link_to_Vector; a : number ) return Link_to_Vector;
! 38: function "*" ( a : number; v : Vector ) return Vector; -- return a*v;
! 39: function "*" ( a : number; v : Link_to_Vector ) return Link_to_Vector;
! 40:
! 41: function "*" ( v1,v2 : Vector ) return number;
! 42: function "*" ( v1,v2 : Link_to_Vector ) return number;
! 43: -- returns the inner product of the vectors v1 and v2;
! 44: -- requires v1 /= null /= v2, in case of link_to_vector.
! 45:
! 46: function "*" ( v1,v2 : Vector ) return Vector;
! 47: function "*" ( v1,v2 : Link_to_Vector ) return Link_to_Vector;
! 48: -- returns the vector v, with v(k) = v1(k)*v2(k);
! 49: -- requires v1 /= null /= v2, in case of link_to_vector.
! 50:
! 51: function Sum ( v : Vector ) return number;
! 52: function Sum ( v : Link_to_Vector ) return number;
! 53: -- returns the sum of all components of v;
! 54:
! 55: -- ARITHMETIC OPERATIONS AS PROCEDURES :
! 56:
! 57: procedure Add ( v1 : in out Vector; v2 : in Vector ); -- v1 := v1+v2
! 58: procedure Add ( v1 : in out Link_to_Vector; v2 : in Link_to_Vector );
! 59: procedure Min ( v : in out Vector); -- v := -v
! 60: procedure Min ( v : in out Link_to_Vector );
! 61: procedure Sub ( v1 : in out Vector; v2 : in Vector ); -- v1 := v1-v2
! 62: procedure Sub ( v1 : in out Link_to_Vector; v2 : in Link_to_Vector );
! 63: procedure Mul ( v : in out Vector; a : in number ); -- v := v*a
! 64: procedure Mul ( v : in out Link_to_Vector; a : in number );
! 65: procedure Mul ( v1 : in out Vector; v2 : in Vector ); -- v1 := v1*v2
! 66: procedure Mul ( v1 : in out Link_to_Vector; v2 : in Link_to_Vector );
! 67:
! 68: -- DESTRUCTORS :
! 69:
! 70: procedure Clear ( v : in out Vector );
! 71: procedure Clear ( v : in out Link_to_Vector );
! 72:
! 73: end Generic_Vectors;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>