package tezos-benchmark

  1. Overview
  2. Docs
type t

Matrices implemented as 2d bigarrays.

type gen = (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t

Genarrays.

val create : lines:int -> cols:int -> t

Create a matrix and initializes it to 0.0

val init : lines:int -> cols:int -> f:(int -> int -> float) -> t

Create and initializes a matrix.

val dim1 : t -> int

Number of lines.

val dim2 : t -> int

Number of columns.

val shape : t -> int * int

Lines x Columns

val set : t -> int -> int -> float -> unit

set m i j v sets the element on line i and column j of m to v.

val get : t -> int -> int -> float

get m i j gets the element on line i and column j.

val map : t -> (float -> float) -> t

map m f creates a new matrix by mapping f pointwise to m.

val column : t -> int -> t

column m i returns the ith column (starting from 0)

val concat_columns_horiz : t list -> t

concat_columns_horiz [c1;...;cn] returns the matrix having c1...cn as rows. The function fails if the columns have incoherent dimensions.

val to_genarray : t -> gen

Converts the 2d bigarray to a genarray.

val of_genarray : gen -> t

Converts a 2d genarray back to a matrix.

val to_numpy : t -> Pytypes.pyobject

Converts to a numpy Python object.

val to_numpy_vector : (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t -> Pytypes.pyobject

Converts a vector to a numpy Python object.

val of_numpy : Pytypes.pyobject -> t

Converts from a numpy Python object.

val numpy_mul : t -> t -> t
val numpy_add : t -> t -> t
val numpy_sub : t -> t -> t

Numpy implementations of matrix operations.

val numpy_show : t -> string

String representation of matri via numpy.

OCaml

Innovation. Community. Security.