generic type ValueType is private; type IndexType is (<>); with function "+"(L,R: ValueType) return ValueType; with function "*"(L,R: ValueType) return ValueType; Zero: ValueType; package Vectors_Generic is ------------------------------------------------------------------ --| Generic specification for vector arithmetic package --| Author: Michael B. Feldman, The George Washington University --| Last Modified: October 1995 ------------------------------------------------------------------ type Vector is array(IndexType range <>) of ValueType; -- exported exception, raised if two vectors are not conformable -- (i.e., have different bounds) Bounds_Error : exception; function "+" (K : ValueType; Right : Vector) return Vector; -- Pre: K and Right are defined -- Post: returns the sum of the vector and the scalar -- Result(i) := K + Right(i) function "*" (K : ValueType; Right : Vector) return Vector; -- Pre: K and Right are defined -- Post: returns the product of the vector and the scalar -- Result(i) := K * Right(i) function "*" (Left, Right : Vector) return ValueType; -- Pre: Left and Right are defined and have the same bounds -- Post: returns the inner product of Left and Right function "+" (Left, Right : Vector) return Vector; -- Pre: Left and Right are defined and have the same bounds -- Post: returns the sum of Left and Right -- Result(i) := Left(i) + Right(i) end Vectors_Generic;