package Matrices is
------------------------------------------------------------------------
--| Specification for package Matrices
--| Author: Michael B. Feldman, The George Washington University 
--| Last Modified: October 1995                                     
------------------------------------------------------------------------
 
  type Matrix is array(Integer range <>, Integer range <>) of Float;

  -- exported exception, raised if two matrices are not conformable
  Bounds_Error : exception;

  function "+" (K : in Float; M : in Matrix) return Matrix;
  -- adds a scalar to a matrix
  -- Pre: K and M are defined
  -- Post: returns the sum of the scalar and the matrix
  --   Result(i,j) := K + M(i,j)

  function "*" (K : in Float; M : in Matrix) return Matrix;
  -- multiplies a matrix by a scalar
  -- Pre: K and M are defined
  -- Post: returns the product of the scalar and the matrix
  --   Result(i,j) := K * M(i,j)

  function "+" (Left, Right : in Matrix) return Matrix;
  -- finds the sum of two matrices
  -- Pre: Left and Right are defined and have the same bounds
  -- Post: returns the sum of Left and Right
  --   Result(i,j) := Left(i,j) + Right(i,j)
  --   Raises Bounds_Error if the matrices are not conformable

  function "*" (Left, Right : in Matrix) return Matrix;
  -- finds the product of two matrices
  -- Pre: Left and Right are defined
  --   and Left's column bounds agree with Right's row bounds
  -- Post: returns the product of Left and Right
  --   Raises Bounds_Error if the matrices are not conformable

  function Transpose(M : in Matrix) return Matrix;
  -- finds the transpose of a matrix
  -- Pre: M is defined
  -- Post: returns a matrix such that Result(i,j) = M(j,i)
  --   Result has M's bounds, interchanged

end Matrices;