package Vectors is ------------------------------------------------------------------------ --| Specification for vector arithmetic package --| Author: Michael B. Feldman, The George Washington University --| Last Modified: October 1995 ------------------------------------------------------------------------ type Vector is array(Integer range <>) of Float; -- exported exception, raised if two vectors are not conformable -- (i.e., have different bounds) Bounds_Error : exception; function "+" (K : Float; 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 : Float; 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 Float; -- Pre: Left and Right are defined -- Post: returns the inner product of Left and Right -- Raises: Bounds_Error if Left and Right have different bounds function "+" (Left, Right : Vector) return Vector; -- Pre: Left and Right are defined -- Post: returns the sum of Left and Right -- result(i) := Left(i) + Right(i) -- Raises: Bounds_Error if Left and Right have different bounds end Vectors;