package phylogenetics

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = mat
Matrix and vector creation
val init : int -> f:(int -> int -> float) -> mat

Initialises a square matrix from a int->int->float function.

val init_diag : vec -> mat

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

val mul : mat -> ?alpha:float -> mat -> mat

Computes the product of two matrices. If optional argument alpha is provided then the result is also multiplied by scalar alpha.

val pow : mat -> ?alpha:float -> int -> mat

Elevates a matrix to an integer power. If optional argument alpha is provided then the result is also multiplied by scalar alpha.

val add : mat -> mat -> mat

Matrix addition.

val expm : mat -> mat

Matrix exponentiation.

val log : mat -> mat

Element-wise logarithm of matrix

val compare : tol:float -> mat -> mat -> 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 : mat -> int -> int -> float

Access a specific element of a matrix.

val row : mat -> int -> vec

Copy row from a matrix

val diagonalize : mat -> mat * vec * mat

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

val inverse : mat -> mat

Computes the inverse of a matrix.

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

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

OCaml

Innovation. Community. Security.