Abstract

Library with operations related to LU-decomposition of dense matrices, including operations for decomposing a matrix A into a lower matrix L and upper matrix U such that LU = A. The module also contains functionality for solving linear systems based on LU-decomposition using forward- and back-substitution.

Synopsis

local module type lu = {
type t
val lu [m]: (block_size: i64) -> (mat: [m][m]t) -> [m][m]t
val lu2 [m]: (block_size: i64) -> (mat: [m][m]t) -> ([m][m]t, [m][m]t)
val forsolve [n]: [n][n]t -> [n]t -> [n]t
val backsolve [n]: [n][n]t -> [n]t -> [n]t
val ols [n]: (block_size: i64) -> [n][n]t -> [n]t -> [n]t
}
module mk_lu: (T: field) -> lu with t = T.t

Description

local module type lu
type t

The scalar type.

val lu [m]: (block_size: i64) -> (mat: [m][m]t) -> [m][m]t

LU decomposition. The function returns the L and U parts embedded into a single square matrix. The diagonal holds the diagonal of U; the diagonal of L is implicitly the identity. The block_size is a tunable parameter (16 and 32 are decent).

val lu2 [m]: (block_size: i64) -> (mat: [m][m]t) -> ([m][m]t, [m][m]t)

LU decomposition. The function returns the L and U parts in different arrays. The block_size is a tunable parameter (16 and 32 are decent).

val forsolve [n]: [n][n]t -> [n]t -> [n]t

Forward substitution on lower part of square matrix.

val backsolve [n]: [n][n]t -> [n]t -> [n]t

Back substitution on upper part of square matrix.

val ols [n]: (block_size: i64) -> [n][n]t -> [n]t -> [n]t

Solve linear system using LU-decomposition.

module mk_lu

LU-decomposition module parameterised over a field.