package phylogenetics

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type symbol = t
include Linear_algebra.Matrix with type t = matrix and type vec := vector
type t = matrix
val dim : t -> int * int
Matrix and vector creation
val diagm : vector -> 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 : ?transa:[ `N | `T ] -> ?transb:[ `N | `T ] -> t -> t -> t

Matrix multiplication

val apply : ?trans:[ `N | `T ] -> t -> vector -> vector

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 -> vector

Copy row from a matrix

val diagonalize : t -> vector * 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 -> vector

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

val pp : Format.formatter -> t -> unit

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

val init : (symbol -> symbol -> float) -> matrix
val init_sym : (symbol -> symbol -> float) -> matrix
val of_arrays : float array array -> matrix option
val of_arrays_exn : float array array -> matrix
OCaml

Innovation. Community. Security.