with Text_IO; use Text_IO; package A83_014_Vector is ---------------------------------------------------------------------- ---------------------------------------------------------------------- Copyright : constant string := "A83_014_Vector 1.00 (C) 1994 by David Wallace Croft." & " All rights reserved."; Description : constant string := "Vector types and operations."; ---------------------------------------------------------------------- package Float_IO is new Text_IO.Float_IO ( float ); use Float_IO; ---------------------------------------------------------------------- type Vector_Integer_Type is array ( integer range <> ) of integer; type Vector_Type is array ( integer range <> ) of float; ---------------------------------------------------------------------- function "*" ( F : float; V : Vector_Type ) return Vector_Type; function "/" ( V : Vector_Type; F : float ) return Vector_Type; function "-" ( V : Vector_Type ) return Vector_Type; function "-" ( V1, V2 : Vector_Type ) return Vector_Type; function "-" ( V : Vector_Type; F : float ) return Vector_Type; function "+" ( V1, V2 : Vector_Type ) return Vector_Type; procedure Ask ( V : in out Vector_Type; Prompt : in string ); function Concatenate ( V1, V2 : Vector_Type ) return Vector_Type; procedure Demo; function Dot ( V1, V2 : Vector_Type ) return float; function Fill ( V : Vector_Type; F : float := 0.0 ) return Vector_Type; procedure Load ( V : out Vector_Type; File_Name : in string ); function Max ( V : Vector_Type ) return float; function Max_Index ( -- returns the position of max value V : Vector_Type ) return integer; function Mean ( V : Vector_Type ) return float; function Min ( V : Vector_Type ) return float; function Min_Index ( V : Vector_Type ) return integer; function Norm ( -- returns length: sqrt ( v1**2 + v2**2 + ...) V : Vector_Type ) return float; procedure Put ( V : in Vector_Integer_Type ); procedure Put ( File : in File_Type; V : in Vector_Type; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ); procedure Put ( V : in Vector_Type; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ); procedure Put_Line ( V : in Vector_Integer_Type ); procedure Put_Line ( File : in File_Type; V : in Vector_Type; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ); procedure Put_Line ( V : in Vector_Type; Fore : in Field := Default_Fore; Aft : in Field := Default_Aft; Exp : in Field := Default_Exp ); procedure Save ( V : in Vector_Type; File_Name : in string ); function Sum ( V : Vector_Type ) return float; function TanH ( V : Vector_Type ) return Vector_Type; ---------------------------------------------------------------------- ---------------------------------------------------------------------- end A83_014_Vector;