package oml

  1. Overview
  2. Docs
type t = Vectors.t array
val row : t -> int -> Vectors.t

row m i returns the ith row of matrix m.

val column : t -> int -> Vectors.t

column m i returns the ith colum of matrix m.

val dim : t -> int * int

dim m the dimensions (row, columns) of the matrix m.

val transpose : t -> t

transpose m returns the transpose of m.

val diagonal : ?n:int -> ?m:int -> Vectors.t -> t

diagonal v create a diagonal matrix from vector v.

val equal : ?d:float -> t -> t -> bool

equal d x y two matrices are equal if they have the same dimensions and all pairwise elements are not Util.significantly_different_from ?d from each other.

val add : t -> t -> t

add x y add two matrices.

val sub : t -> t -> t

sub x y subtraction.

val mult : float -> t -> t

mult s v scalar multiplication.

val identity : int -> t

identity n create the identity matrix of rank n.

val prod : t -> t -> t

prod m n matrix product m * n

val prod_row_vector : Vectors.t -> t -> Vectors.t

Multiply a row vector against a matrix.

val prod_column_vector : t -> Vectors.t -> Vectors.t

Multiply a matrix against a column vector.

OCaml

Innovation. Community. Security.