Abstract
Small library of simple linear algebra-ish operations.
Synopsis
local module type linalg = {
| |||||||||||||||||||||||||||||||||||
module type field = {
| |||||||||||||||||||||||||||||||||||
module type ordered_field = {
| |||||||||||||||||||||||||||||||||||
module mk_linalg | : | (T: field) -> linalg with t = T.t |
Description
- ↑local module type linalg
- ↑type t
The scalar type.
- ↑val dotprod [n]: [n]t -> [n]t -> t
Dot product.
- ↑val outer [n] [m]: [n]t -> [m]t -> [n][m]t
Outer product.
- ↑val cross: [3]t -> [3]t -> [3]t
Cross product (only for three-element vectors).
- ↑val matvecmul_row [n] [m]: [n][m]t -> [m]t -> [n]t
Multiply a matrix with a row vector.
- ↑val matvecmul_col [n] [m]: [n][m]t -> [n]t -> [n][n]t
Multiply a matrix with a column vector.
- ↑val matmul [n] [p] [m]: [n][p]t -> [p][m]t -> [n][m]t
Multiply two matrices.
- ↑val kronecker [n] [m] [p] [q]: [m][n]t -> [p][q]t -> [][]t
Kronecker product of two matrices.
- ↑val kronecker' [m] [n] [p] [q]: [m][n]t -> [p][q]t -> [m][n][p][q]t
Kronecker product of two matrices, but preserving the blocked structure in the result.
- ↑val inv [n]: [n][n]t -> [n][n]t
Compute the inverse of a matrix.
- ↑val ols [n] [m]: [n][m]t -> [n]t -> [m]t
Solve linear system.
- ↑module type ordered_field