Abstract

Mono sparse matrices.

A mono sparse matrix is a matrix that stores fewer elements than a corresponding dense regular matrix (non-stored elements are assumed to be zero). There are two kinds of mono sparse matrices, one that stores only one element per row (mono sparse row matrix) and one that stores only one element per column (mono sparse column matrix).

Synopsis

local module type mono = {
type t
type sr [n] [m]
type sc [n] [m]
module sr: {
include matrix_regular with t = t with mat [n] [m] = sr [n] [m]
val transpose [n] [m]: mat [n] [m] -> sc [m] [n]
val smvm [n] [m]: mat [n] [m] -> [m]t -> [n]t
}
module sc: {
include matrix_regular with t = t with mat [n] [m] = sc [n] [m]
val transpose [n] [m]: mat [n] [m] -> sr [m] [n]
val vsmm [n] [m]: [n]t -> mat [n] [m] -> [m]t
}
}
module mk_mono: (T: field) -> mono with t = T.t

Description

local module type mono
type t
type sr [n] [m]
type sc [n] [m]
module sr

Mono sparse row representation.

include matrix_regular with t = t with mat [n] [m] = sr [n] [m]
val transpose [n] [m]: mat [n] [m] -> sc [m] [n]

Matrix transposition.

val smvm [n] [m]: mat [n] [m] -> [m]t -> [n]t

Sparse matrix vector multiplication. Given a sparse n times m matrix and a vector of size m, the function returns a vector of size n, the result of multiplying the argument matrix with the argument vector.

module sc

Mono sparse column representation.

include matrix_regular with t = t with mat [n] [m] = sc [n] [m]
val transpose [n] [m]: mat [n] [m] -> sr [m] [n]

Matrix transposition.

val vsmm [n] [m]: [n]t -> mat [n] [m] -> [m]t

Vector sparse matrix multiplication.

module mk_mono

Parameterised mono sparse matrix module with submodules for the mono sparse row (MSR) representation and for the mono sparse column (MSR) representation. The module is parameterised over a field (defined in the linalg package).