package phantom-algebra

  1. Overview
  2. Docs

Some useful linear algebra values and functions

type 'a dim
type 'a rank
type (+'a, +'b) tensor
val zero : 'dim dim -> 'rank rank -> ('dim, 'rank) tensor

zero dim rank is the zero scalar, vector or matrix with dimension dim

val id : 'dim dim -> 'rank rank -> ('dim, 'rank) tensor

id rank dim t ** 0 for any tensor of corresponding rank and dimension

val eye : 'a dim -> ('a, _ Type_functions.two) tensor

eye dim is id matrix dim, the identity matrix with ones on the diagonal

val diag : ('dim, _ tensor -> ('dim, _ Type_functions.two) tensor

diag vec is the diagonal matrix with vec on the diagonal

val rotation : ('dim, _ tensor -> ('dim, _ tensor -> k -> ('dim, _ Type_functions.two) tensor

rotation x y θ computes the rotation matrix in the plane spanned by x y with a θ angle.


Innovation. Community. Security.