------------ SIMTEL20 Ada Software Repository Proloque --------------
--           -*
-- Unit name    : MATRIX_PACKAGE
-- Version    : 1.0
-- Author : Dr. Roger Lee
--  : Naval Air Developement Center
--  : Advanced Software Technology Division
--  : Warminster Pa. 18974
-- DDN Address : LEE at NADC
-- Copyright : (c) 1984 Roger Lee
-- Date created : Feb 84
-- Release date : 7 Jun 85
-- Last update  : Feb 84
-- Machine/System Compiled/Run on : VMS VAX11/780 Telesoft Ada compiler
--             -*
-----------------------------------------------------------------------
--             -*
-- Keywords :
----------------: MATRIX,VECTOR
--
-- ABSTRACT :
----------------: MATRIX_PACKAGE is a general purpose matrix package.
-- It defines data types VECTOR and MATRIX, and contains functions
-- to perform general matrix algebra operations.  It provides for addition,
-- subtraction, and multiplication of VECTORS, MATRICES and SCALARS.
-- It also provides for matrix inversion and vector dot product.
--
--              -*
---------------- Revision history --------------------------------------
--              -*
-- DATE  VERSION AUTHOR   HISTORY
-- 2/84          1.0    Roger Lee               Initial Release
--              -*
---------------- Distribution and Copyright ----------------------------
--              -*
-- This prologue must be included in all copies of this software.
--
-- This software is copyright by the author.
--
-- This software is released to the Ada community.
-- This software is released to the Public Domain (note:
--   software released to the Public Domain is not subject
--   to copyright protection).
-- Restrictions on use or distribution:  NONE
--              -*
--------------------- Disclaimer ---------------------------------------
--              -*
-- This software and its documentation are provided "AS IS" and
-- without any expressed or implied warranties whatsoever.
-- No warranties as to performance, merchantability, or fitness
-- for a particular purpose exist.
--
-- Because of the diverity of conditions and hardware under
-- which this software may be used, no warranty of fitness for
-- a particular purpose is offered.  The user is advised to
-- test the software thoroughly before relying on it.  The user
-- must assume the entire risk and liability of using this
-- software.
--
-- In no event shall any person or organization of people  be
-- held responsible for any direct, indirect, consequential
-- or inconsequential damages or lost profits.
--               -*
-------------------- END-PROLOGUE ---------------------------------------
--
--
--
package Matrix_Package is
    --> PROLOGUE
    -->
    -->**************************************************************************
    --> This package is a general purpose matrix package. It defines data types
    --> VECTOR and MATRIX, and contains functions to perform general matrix
    --> algebra operations.
    -->**************************************************************************
    -->

    type Vector is array (Integer range <>) of Float;
    type Matrix is array (Integer range <>, Integer range <>) of Float;
    Incomparable_Dimension : exception; -- the dimension of matrices
    -- or vectors to be operated are
    -- incomparable
    Singular : exception;    -- matrix to be inverted is singular
    function Transpose (A : Matrix) return Matrix; -- transpose of matrix
    function Transpose (A : Vector) return Vector; -- transpose of vector
    function "+" (A : Vector; B : Vector) return Vector; -- sum of vector
    function "+" (A : Matrix; B : Matrix) return Matrix; -- sum of matrix
    function "-" (A : Vector; B : Vector) return Vector;
    -- difference of vector
    function "-" (A : Matrix; B : Matrix) return Matrix;
    -- difference of matrix
    function "*" (A : Float; B : Vector) return Vector;
    -- scalar, vector multiplication
    function "*" (A : Vector; B : Float) return Vector;
    -- vector, scalar multiplication
    function "*" (A : Vector; B : Vector) return Float;
    -- inner(dot) product of two vectors
    function "*" (A : Matrix; B : Vector) return Vector;
    -- matrix,column vector multiplication
    function "*" (A : Vector; B : Matrix) return Vector;
    -- row vector,matrix multiplication
    function "*" (A : Float; B : Matrix) return Matrix;
    -- scalar, matrix multiplication
    function "*" (A : Matrix; B : Float) return Matrix;
    -- matrix, scalar multiplication
    function "*" (A : Matrix; B : Matrix) return Matrix;
    -- matrix, matrix multiplication
    function "**" (A : Matrix; P : Integer) return Matrix;
    -- square matrix raised to integer
    -- power
    --
    --> CALLS
    -->       NONE
    -->
end Matrix_Package;
