Module Nn.Matrix

module Int : sig ... end
type t = float array array

Matrices. As usual a.(i).(j) is the element in row i and column j and corresponds to the i-th output of the j-th input.

val init : int -> int -> (int -> int -> float) -> t

Create a matrix.

val rows : t -> int

Number of rows.

val cols : t -> int

Number of columns.

val copy : t -> t
val dims : t -> int * int
val src : t -> int

Dimension of the source.

val tgt : t -> int

Dimension of the target.

val print_dims : string -> t -> unit
val to_scalar : t -> float
val transpose : t -> t
val of_list : float list -> t

Create a vector from a list.

val to_list : t -> float list
val sum : int -> (int -> float) -> float

Sum of f i for i from 0 to n - 1.

val map : (float -> float) -> t -> t
val mapi : (int -> int -> float -> float) -> t -> t
val map2 : (float -> float -> float) -> t -> t -> t
val add : t -> t -> t
val cmul : float -> t -> t
val neg : t -> t
val sub : t -> t -> t
val hadamard : t -> t -> t
val mul : t -> t -> t

Matrix multiplication.

val app : t -> Vector.t -> Vector.t
val tapp : t -> Vector.t -> Vector.t

Apply the transpose of f to x.