------------------------------------------------------------------------------- -- Title : Matrix Math package for type REAL -- Project : ------------------------------------------------------------------------------- -- File : real_matrix_pkg.vhdl -- Author : David Bishop -- Company : -- Created : 2010-04-15 -- Last update: 2010-04-26 -- Platform : -- Standard : VHDL'93 ------------------------------------------------------------------------------- -- Description: Matrix math package for type REAL ------------------------------------------------------------------------------- -- Copyright (c) 2010 ------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- 2010-04-15 1.0 l435385 Created ------------------------------------------------------------------------------- -- package real_matrix_pkg is -- Define arrays of vectors -- %%% "real_vector" is defined in VHDL-2008 type real_vector is array (NATURAL range <>) of REAL; -- array type real_matrix is array (NATURAL range <>, NATURAL range <>) of REAL; -- real matrix -- purpose: matrix multiply function "*" ( l, r : real_matrix) return real_matrix; -- purpose: matrix by vector function "*" ( l : real_matrix; r : real_vector) return real_vector; -- purpose: multiply a vector by a matrix function "*" ( l : real_vector; r : real_matrix) return real_vector; -- purpose: Multiply a vector by a vector to get a matrix function "*" ( l, r : real_vector) return real_matrix; -- purpose: multiply a scalar by a matrix function "*" ( l : REAL; r : real_matrix) return real_matrix; -- purpose: multiply a scalar by a matrix function "*" ( l : real_matrix; r : REAL) return real_matrix; -- purpose: matrix addition function "+" ( l, r : real_matrix) return real_matrix; -- purpose: matrix subtraction function "-" ( l, r : real_matrix) return real_matrix; -- purpose: Transpose a matrix function transpose ( arg : real_matrix) return real_matrix; -- purpose: returns a matrix of zeors function zeros ( rows, columns : POSITIVE) return real_matrix; -- purpose: returns a matrix of zeors function ones ( rows, columns : POSITIVE) return real_matrix; -- purpose: Returns an identity matrix function identity ( rows, columns : POSITIVE) return real_matrix; -- purpose: submatrix returns a matrix with 1 less row and column -- Used by determinant function function submatrix ( constant row, column : INTEGER; -- row and column to exclude arg : real_matrix) return real_matrix; -- purpose: Finds the determinant of a matrix function determinant ( arg : real_matrix) return REAL; -- purpose: Inverts a matrix function invert ( arg : real_matrix) return real_matrix; -- purpose: Prints out a matrix procedure print_matrix ( arg : in real_matrix; index : in BOOLEAN := false); -- purpose: Prints out a vector procedure print_vector ( arg : in real_vector; index : in BOOLEAN := false); -- purpose: returns true if 2 matricies are equal -- function "=" ( -- l, r : real_matrix) -- return BOOLEAN; -- -- purpose: returns true if 2 matricies are not equal -- function "/=" ( -- l, r : real_matrix) -- return BOOLEAN; -- Matlab .* operator function times ( l, r : real_matrix) return real_matrix; -- Matlab ./ operator function rdivide ( l, r : real_matrix) return real_matrix; end package real_matrix_pkg;