Package-level declarations

Everything lives in one package: Nat/N1..N10 for type-level dimensions, Matrix/Vector (statically sized) and DynamicMatrix/DynamicVector (runtime sized), the decomposition result types (LLTDecomposition, LDLTDecomposition, LUDecomposition, QRDecomposition), and the MatrixBuilder/matrixOf/vectorOf construction helpers.

Types

Link copied to clipboard
open class DynamicMatrix(simple: SimpleMatrix)

Represents a matrix of doubles with dynamic (runtime-checked) dimensions. Internally represented as a SimpleMatrix from EJML.

Link copied to clipboard

Represents a column vector of doubles with dynamic (runtime-checked) dimensions. This is essentially a DynamicMatrix with a single column.

Link copied to clipboard

Data class for LDLT decomposition.

Link copied to clipboard
data class LLTDecomposition

Data class for LLT (Cholesky) decomposition, with rank-1 update/downdate.

Link copied to clipboard
data class LUDecomposition

Data class for LU decomposition.

Link copied to clipboard
open class Matrix<R : Nat, C : Nat>

A dimensionally type-safe matrix of doubles.

Link copied to clipboard
class MatrixBuilder<R : Nat, C : Nat>
Link copied to clipboard
data object N1 : Nat

Type-level representation of 1

Link copied to clipboard
data object N10 : Nat

Type-level representation of 10

Link copied to clipboard
data object N2 : Nat

Type-level representation of 2

Link copied to clipboard
data object N3 : Nat

Type-level representation of 3

Link copied to clipboard
data object N4 : Nat

Type-level representation of 4

Link copied to clipboard
data object N5 : Nat

Type-level representation of 5

Link copied to clipboard
data object N6 : Nat

Type-level representation of 6

Link copied to clipboard
data object N7 : Nat

Type-level representation of 7

Link copied to clipboard
data object N8 : Nat

Type-level representation of 8

Link copied to clipboard
data object N9 : Nat

Type-level representation of 9

Link copied to clipboard
sealed interface Nat

Type-level natural numbers for compile-time matrix dimension checking. Use these as generic bounds on Matrix to ensure dimensional correctness at compile time.

Link copied to clipboard
data class NDynamic(val num: Int) : Nat

Type-level representation of an unknown/dynamic dimension

Link copied to clipboard
data class QRDecomposition

Data class for QR decomposition.

Link copied to clipboard
class Vector<N : Nat> : Matrix<N, N1>

A dimensionally type-safe column vector of doubles.

Functions

Link copied to clipboard
fun <R : Nat, C : Nat> buildMatrix(natRows: R, natCols: C, initializer: MatrixBuilder<R, C>.() -> Unit): Matrix<R, C>

Builds a matrix with the given dimensions using a DSL-style initializer.

Link copied to clipboard
fun <N : Nat> Matrix<N, N>.exp(): Matrix<N, N>

Computes the matrix exponential of this matrix, using the Padé approximant.

Link copied to clipboard
fun <C : Nat> matrixOf(row0: Vector<C>): Matrix<N1, C>

Creates a 1xC matrix from a single row vector.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>): Matrix<N2, C>

Creates a 2xC matrix from two row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>): Matrix<N3, C>

Creates a 3xC matrix from three row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>): Matrix<N4, C>

Creates a 4xC matrix from four row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>): Matrix<N5, C>

Creates a 5xC matrix from five row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>, row5: Vector<C>): Matrix<N6, C>

Creates a 6xC matrix from six row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>, row5: Vector<C>, row6: Vector<C>): Matrix<N7, C>

Creates a 7xC matrix from seven row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>, row5: Vector<C>, row6: Vector<C>, row7: Vector<C>): Matrix<N8, C>

Creates an 8xC matrix from eight row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>, row5: Vector<C>, row6: Vector<C>, row7: Vector<C>, row8: Vector<C>): Matrix<N9, C>

Creates a 9xC matrix from nine row vectors.

fun <C : Nat> matrixOf(row0: Vector<C>, row1: Vector<C>, row2: Vector<C>, row3: Vector<C>, row4: Vector<C>, row5: Vector<C>, row6: Vector<C>, row7: Vector<C>, row8: Vector<C>, row9: Vector<C>): Matrix<N10, C>

Creates a 10xC matrix from ten row vectors.

Link copied to clipboard
fun natOf(num: Int): Nat

Creates a Nat from a number.

Link copied to clipboard
operator fun Double.times(vector: DynamicVector): DynamicVector
operator fun <R : Nat, C : Nat> Double.times(matrix: Matrix<R, C>): Matrix<R, C>
operator fun <N : Nat> Double.times(vector: Vector<N>): Vector<N>
operator fun Int.times(vector: DynamicVector): DynamicVector
operator fun <R : Nat, C : Nat> Int.times(matrix: Matrix<R, C>): Matrix<R, C>
operator fun <N : Nat> Int.times(vector: Vector<N>): Vector<N>

Scalar multiplication from the left.

Link copied to clipboard

Creates a 1-dimensional vector.

Creates a 2-dimensional vector.

fun vectorOf(x: Double, y: Double, z: Double): Vector<N3>

Creates a 3-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double): Vector<N4>

Creates a 4-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double): Vector<N5>

Creates a 5-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double, x6: Double): Vector<N6>

Creates a 6-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double, x6: Double, x7: Double): Vector<N7>

Creates a 7-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double, x6: Double, x7: Double, x8: Double): Vector<N8>

Creates an 8-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double, x6: Double, x7: Double, x8: Double, x9: Double): Vector<N9>

Creates a 9-dimensional vector.

fun vectorOf(x1: Double, x2: Double, x3: Double, x4: Double, x5: Double, x6: Double, x7: Double, x8: Double, x9: Double, x10: Double): Vector<N10>

Creates a 10-dimensional vector.