package phylogenetics

  1. Overview
  2. Docs
type symbol = t
include module type of struct include Linear_algebra.Matrix end
val dim : t -> int * int
Matrix and vector creation
val diagm : Linear_algebra.vec -> t

Initializes a square diagonal matrix from the vector of its diagonal elements.

val mul : t -> t -> t

Matrix element-wise multiplication

val add : t -> t -> t

Matrix addition.

val scal_mul : float -> t -> t

Multiplication of a matrix by a scalar.

val inplace_scal_mul : float -> t -> unit

Inplace multiplication of a matrix by a scalar.

val dot : t -> t -> t

Matrix multiplication

Matrix-vector product

val pow : t -> int -> t

Matrix exponentiation

val expm : t -> t

Matrix exponential

val log : t -> t

Element-wise logarithm of matrix

val robust_equal : tol:float -> t -> t -> bool

Compares two matrices and tolerates a certain relative difference. Let f be the float parameter, it returns true iff the elements of the second matrix are between 1-f and 1+f times the corresponding elements of the first

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

Access a specific element of a matrix.

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

Set a specific element of a matrix.

val row : t -> int -> Linear_algebra.vec

Copy row from a matrix

val diagonalize : t -> Linear_algebra.vec * t

Diagonalizes a matrix M so that M = PxDxP^T; returns (v,P) where v is the diagonal vector of D.

val transpose : t -> t
val inverse : t -> t

Computes the inverse of a matrix.

val zero_eigen_vector : t -> Linear_algebra.vec

zero_eigen_vector m is a vector v such that Vec.sum v = 1 and mat_vec_mul m v = zero

val of_arrays : float array array -> t option
val pp : Stdlib.Format.formatter -> t -> unit

Prints a matrix to the standard output (display may be messy).

val init : (int -> int -> float) -> t
val init_sym : (int -> int -> float) -> t
val of_arrays_exn : float array Core_kernel.Array.t -> t
val of_array : float array Core_kernel.Array.t -> t option
OCaml

Innovation. Community. Security.