LinearSpace

interface LinearSpace<T, out A : Ring<T>>(source)

Basic operations on matrices and vectors.

Parameters

T

the type of items in the matrices.

A

the type of ring over T.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun buildMatrix(rows: Int, columns: Int, initializer: A.(i: Int, j: Int) -> T): Matrix<T>

Produces a matrix with this context and given dimensions.

Link copied to clipboard
abstract fun buildVector(size: Int, initializer: A.(Int) -> T): Point<T>

Produces a point compatible with matrix space (and possibly optimized for it).

Link copied to clipboard
fun <T : Any> LinearSpace<T, Ring<T>>.column(vararg values: T): Matrix<T>
inline fun <T : Any> LinearSpace<T, Ring<T>>.column(size: Int, crossinline builder: (Int) -> T): Matrix<T>
Link copied to clipboard
open fun <F : StructureFeature> computeFeature(structure: Matrix<T>, type: KClass<out F>): F?

Compute a feature of the structure in this scope. Structure features take precedence other context features.

Link copied to clipboard

Get a feature of the structure in this scope. Structure features take precedence other context features.

Link copied to clipboard

Indicates whether some StructureND is equal to another one.

Indicates whether some StructureND is equal to another one with absoluteTolerance.

Link copied to clipboard
open infix fun Matrix<T>.dot(other: Matrix<T>): Matrix<T>

Computes the dot product of this matrix and another one.

open infix fun Matrix<T>.dot(vector: Point<T>): Point<T>

Computes the dot product of this matrix and a vector.

Link copied to clipboard
inline fun <T : Comparable<T>> LinearSpace<T, Field<T>>.lup(matrix: Matrix<T>, noinline checkSingular: (T) -> Boolean): LupDecomposition<T>
fun LinearSpace<Double, DoubleField>.lup(matrix: Matrix<Double>, singularityThreshold: Double = 1.0E-11): LupDecomposition<Double>

fun <T : Comparable<T>> LinearSpace<T, Field<T>>.lup(factory: MutableBufferFactory<T>, matrix: Matrix<T>, checkSingular: (T) -> Boolean): LupDecomposition<T>

Create a lup decomposition of generic matrix.

Link copied to clipboard
fun LinearSpace<Double, DoubleField>.lupSolver(singularityThreshold: Double = 1.0E-11): LinearSolver<Double>

fun <T : Comparable<T>, F : Field<T>> LinearSpace<T, F>.lupSolver(bufferFactory: MutableBufferFactory<T>, singularityCheck: (T) -> Boolean): LinearSolver<T>

Produce a generic solver based on LUP decomposition

Link copied to clipboard
fun <T : Any, A : Ring<T>> LinearSpace<T, A>.matrix(rows: Int, columns: Int): MatrixBuilder<T, A>

Create a matrix builder with given number of rows and columns

Link copied to clipboard
open operator fun Matrix<T>.minus(other: Matrix<T>): Matrix<T>

Matrix subtraction

open operator fun Point<T>.minus(other: Point<T>): Point<T>

Vector subtraction

Link copied to clipboard
fun <T : Any> LinearSpace<T, Ring<T>>.one(rows: Int, columns: Int): Matrix<T>

Diagonal matrix of ones. The matrix is virtual no actual matrix is created.

Link copied to clipboard
open operator fun Matrix<T>.plus(other: Matrix<T>): Matrix<T>

Matrix sum

open operator fun Point<T>.plus(other: Point<T>): Point<T>

Vector sum

Link copied to clipboard
fun <T : Any> LinearSpace<T, Ring<T>>.row(vararg values: T): Matrix<T>
inline fun <T : Any> LinearSpace<T, Ring<T>>.row(size: Int, crossinline builder: (Int) -> T): Matrix<T>
Link copied to clipboard
open operator fun T.times(m: Matrix<T>): Matrix<T>

Multiplies an element by a matrix of it.

open operator fun T.times(v: Point<T>): Point<T>

Multiplies an element by a vector of it.

open operator fun Matrix<T>.times(value: T): Matrix<T>

Multiplies a matrix by its element.

open operator fun Point<T>.times(value: T): Point<T>

Multiplies a vector by its element.

Link copied to clipboard
open operator fun Matrix<T>.unaryMinus(): Matrix<T>
open operator fun Point<T>.unaryMinus(): Point<T>
Link copied to clipboard
fun <T : Any> LinearSpace<T, Ring<T>>.vector(vararg elements: T): Point<T>
Link copied to clipboard
fun <T : Any> LinearSpace<T, Ring<T>>.zero(rows: Int, columns: Int): Matrix<T>

A virtual matrix of zeroes

Properties

Link copied to clipboard
abstract val elementAlgebra: A