From 561d0f0155f4906d90eb7e73a3ff9cb28909126f Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 5 Feb 2021 09:08:39 +0100 Subject: Update project structure --- shapes/matrix/MatrixI.ml | 105 ----------------------------------------------- 1 file changed, 105 deletions(-) delete mode 100755 shapes/matrix/MatrixI.ml (limited to 'shapes/matrix/MatrixI.ml') diff --git a/shapes/matrix/MatrixI.ml b/shapes/matrix/MatrixI.ml deleted file mode 100755 index fbc4e21..0000000 --- a/shapes/matrix/MatrixI.ml +++ /dev/null @@ -1,105 +0,0 @@ -exception NonSquare -exception ImproperDimensions - -module type MATRIX = -sig - - (******** TYPES ********) - type elt - - type matrix - - (* empty matrix of nxp dimensions *) - val empty : int -> int -> matrix - - (* Takes a list of lists and converts that to a matrix *) - val from_list : (elt list list) -> matrix - - val from_array: elt array array -> matrix - - (******** OPERATIONS ON ONE MATRIX ********) - (* Takes in a matrix and returns its dimensions. ie, nxp *) - val get_dimensions : matrix -> (int * int) - - (* get's the row of a matrix: Not zero-indexed. *) - val get_row : matrix -> int -> (int * elt array) - - (* similar to get_row *) - val get_column: matrix -> int -> (int * elt array) - - (* sets the row of a matrix in place! Not zero-index *) - val set_row: matrix -> int -> elt array -> unit - - (* similar to set_row, but for a column *) - val set_column: matrix -> int -> elt array -> unit - - (* gets the element at the specified index. *) - val get_elt: matrix -> (int * int) -> elt - - (* sets the element at the specified index *) - val set_elt: matrix -> (int * int) -> elt -> unit - - (* Scales every element in the matrix by another elt *) - val scale : matrix -> elt -> matrix - - - (******** MORE ADVANCED SINGLE MATRIX OPERATIONS ********) - (* Returns the row reduced form of a matrix *) - val row_reduce: matrix -> matrix - (* We will implement the algorithm found in the link above *) - - (* Returns the inverse of a matrix *) - val inverse: matrix -> matrix - - (*Transposes a matrix. If the input has dimensions m x n, the output will - * have dimensions n x m *) - val transpose: matrix -> matrix - - (* Returns the trace of the matrix *) - val trace: matrix -> elt - - (******** OPERATIONS ON TWO MATRICES ********) - (* Adds two matrices. They must have the same dimensions *) - val add : matrix -> matrix -> matrix - - (* Multiplies two matrices. If the matrices have dimensions m x n and p x q, n - * and p must be equal, and the resulting matrix will have dimension m x q *) - val mult: matrix -> matrix -> matrix - - (**** Other Library Functions ***) - (* Function to make over our matrices *) - val map : (elt -> elt) -> matrix -> matrix - - (*val iter : (elt -> unit) -> matrix -> unit*) - - (* Returns the LUP decomposition of a matrix *) - val lu_decomposition : matrix -> (matrix * matrix * matrix) * int - - (* Returns the determinant of the matrix *) - val determinant: matrix -> elt - - (************** Other Library Functions *************) - val iter : (elt -> unit) -> matrix -> unit - - val iteri : (int -> int -> elt -> unit) -> matrix -> unit - - (* folds over each row using base case u and function f *) - val reduce: ('a -> elt -> 'a) -> 'a -> matrix -> 'a - - val fold_row: f:(elt array -> 'b) -> matrix -> 'b list - - (********** Specific for Simplex Algorithm ***********) - (** All of the following functions will raise ImproperDimensions - * Exception if the matrix is not the right size for the operation - **) - - (* Scales a row *) - val scale_row: matrix -> int -> elt -> unit - - (* Swaps two rows *) - val swap_row: matrix -> int -> int -> unit - - (* Subtracts a multiple of one row (the 2nd int) from another (the 1st int) *) - val sub_mult: matrix -> int -> int -> elt -> unit - -end -- cgit v1.2.3