Package space.kscience.kmath.linear

Types

BufferedLinearSpace
Link copied to clipboard
common
class BufferedLinearSpace<T, out A : Ring<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : LinearSpace<T, A>
CholeskyDecompositionFeature
Link copied to clipboard
common
interface CholeskyDecompositionFeature<out T : Any> : MatrixFeature
Matrices with this feature support Cholesky factorization: a = l &middot; lH where a is the owning matrix.
DeterminantFeature
Link copied to clipboard
common
interface DeterminantFeature<out T : Any> : MatrixFeature
Matrices with this feature can compute their determinant.
DiagonalFeature
Link copied to clipboard
common
interface DiagonalFeature : MatrixFeature
Matrices with this feature are considered to have only diagonal non-null elements.
DoubleLinearSpace
Link copied to clipboard
common
object DoubleLinearSpace : LinearSpace<Double, DoubleField>
InverseMatrixFeature
Link copied to clipboard
common
interface InverseMatrixFeature<out T : Any> : MatrixFeature
Matrices with this feature can be inverted: inverse = a&minus;1 where a is the owning matrix.
LFeature
Link copied to clipboard
common
object LFeature : MatrixFeature
Matrices with this feature are lower triangular ones.
LinearSolver
Link copied to clipboard
common
interface LinearSolver<T : Any>
A group of methods to solve for X in equation X = A&minus;1 &middot; B, where A and B are matrices or vectors.
LinearSpace
Link copied to clipboard
common
interface LinearSpace<T, out A : Ring<T>>
Basic operations on matrices and vectors.
LUDecompositionFeature
Link copied to clipboard
common
interface LUDecompositionFeature<out T : Any> : MatrixFeature
Matrices with this feature support LU factorization: a = l &middot; u where a is the owning matrix.
LupDecomposition
Link copied to clipboard
common
class LupDecomposition<T : Any>(context: LinearSpace<T, *>, elementContext: Field<T>, lu: Matrix<T>, pivot: IntArray, even: Boolean) : LupDecompositionFeature<T> , DeterminantFeature<T>
Common implementation of LupDecompositionFeature.
LupDecompositionFeature
Link copied to clipboard
common
interface LupDecompositionFeature<out T : Any> : MatrixFeature
Matrices with this feature support LU factorization with partial pivoting: p &middot; a = l &middot; u where a is the owning matrix.
Matrix
Link copied to clipboard
common
typealias Matrix<T> = Structure2D<T>

Alias for Structure2D with more familiar name.

MatrixBuilder
Link copied to clipboard
common
class MatrixBuilder<T : Any, out A : Ring<T>>(linearSpace: LinearSpace<T, A>, rows: Int, columns: Int)
MatrixFeature
Link copied to clipboard
common
interface MatrixFeature : StructureFeature
A marker interface representing some properties of matrices or additional transformations of them.
MatrixWrapper
Link copied to clipboard
common
class MatrixWrapper<out T : Any> : Structure2D<T>
A Matrix that holds MatrixFeature objects.
MutableMatrix
Link copied to clipboard
common
typealias MutableMatrix<T> = MutableStructure2D<T>
OrthogonalFeature
Link copied to clipboard
common
object OrthogonalFeature : MatrixFeature
Matrices with this feature are orthogonal ones: a &middot; aT = u where a is the owning matrix, u is the unit matrix (UnitFeature).
Point
Link copied to clipboard
common
typealias Point<T> = Buffer<T>

Alias or using Buffer as a point/vector in a many-dimensional space.

QRDecompositionFeature
Link copied to clipboard
common
interface QRDecompositionFeature<out T : Any> : MatrixFeature
Matrices with this feature support QR factorization: a = q &middot; r where a is the owning matrix.
SingularValueDecompositionFeature
Link copied to clipboard
common
interface SingularValueDecompositionFeature<out T : Any> : MatrixFeature
Matrices with this feature support SVD: a = u &middot; s &middot; vH where a is the owning matrix.
SymmetricMatrixFeature
Link copied to clipboard
common
object SymmetricMatrixFeature : MatrixFeature
TransposedFeature
Link copied to clipboard
common
class TransposedFeature<out T : Any>(original: Matrix<T>) : MatrixFeature
UFeature
Link copied to clipboard
common
object UFeature : MatrixFeature
Matrices with this feature are upper triangular ones.
UnitFeature
Link copied to clipboard
common
object UnitFeature : DiagonalFeature
Matrices with this feature have unit elements on diagonal and zero elements in all other places.
VirtualMatrix
Link copied to clipboard
common
class VirtualMatrix<out T : Any>(rowNum: Int, colNum: Int, generator: (i: Int, j: Int) -> T) : Structure2D<T>
The matrix where each element is evaluated each time when is being accessed.
ZeroFeature
Link copied to clipboard
common
object ZeroFeature : DiagonalFeature
Matrices with this feature have all zero elements.

Functions

asMatrix
Link copied to clipboard
common
fun <T : Any> Point<T>.asMatrix(): VirtualMatrix<T>
Creates an n &times; 1 VirtualMatrix, where n is the size of the given buffer.
asVector
Link copied to clipboard
common
fun <T : Any> Matrix<T>.asVector(): Point<T>
Convert matrix to vector if it is possible.
column
Link copied to clipboard
common
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>
computeFeature
Link copied to clipboard
common
inline fun <T : Any, F : StructureFeature> LinearSpace<T, *>.computeFeature(structure: Matrix<T>): F?
Get a feature of the structure in this scope.
DeterminantFeature
Link copied to clipboard
common
fun <T : Any> DeterminantFeature(determinant: T): DeterminantFeature<T>
invoke
Link copied to clipboard
common
inline operator fun <LS : LinearSpace<*, *>, R> LS.invoke(block: LS.() -> R): R
linearSpace
Link copied to clipboard
common
fun <T, A : Ring<T>> A.linearSpace(bufferFactory: BufferFactory<T>): BufferedLinearSpace<T, A>
lup
Link copied to clipboard
common
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 = 1e-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.
lupSolver
Link copied to clipboard
common
fun LinearSpace<Double, DoubleField>.lupSolver(singularityThreshold: Double = 1e-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
matrix
Link copied to clipboard
common
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
one
Link copied to clipboard
common
fun <T : Any> LinearSpace<T, Ring<T>>.one(rows: Int, columns: Int): Matrix<T>
Diagonal matrix of ones.
plus
Link copied to clipboard
common
operator fun <T : Any> Matrix<T>.plus(newFeature: MatrixFeature): MatrixWrapper<T>
row
Link copied to clipboard
common
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>
symmetric
Link copied to clipboard
common
fun <T : Any, A : Ring<T>> MatrixBuilder<T, A>.symmetric(builder: (i: Int, j: Int) -> T): Matrix<T>
Naive implementation of a symmetric matrix builder, that adds a SymmetricMatrixFeature tag.
transpose
Link copied to clipboard
common
fun <T : Any> Matrix<T>.transpose(): Matrix<T>
Create a virtual transposed matrix without copying anything.
vector
Link copied to clipboard
common
fun <T : Any> LinearSpace<T, Ring<T>>.vector(vararg elements: T): Point<T>
virtual
Link copied to clipboard
common
fun <T : Any> MatrixBuilder<T, *>.virtual(generator: (i: Int, j: Int) -> T): VirtualMatrix<T>
withFeature
Link copied to clipboard
common
fun <T : Any> Matrix<T>.withFeature(newFeature: MatrixFeature): MatrixWrapper<T>
Add a single feature to a Matrix
withFeatures
Link copied to clipboard
common
fun <T : Any> Matrix<T>.withFeatures(newFeatures: Iterable<MatrixFeature>): MatrixWrapper<T>
Add a collection of features to a Matrix
zero
Link copied to clipboard
common
fun <T : Any> LinearSpace<T, Ring<T>>.zero(rows: Int, columns: Int): Matrix<T>
A virtual matrix of zeroes

Properties

linearSpace
Link copied to clipboard
common
val DoubleField.linearSpace: DoubleLinearSpace
origin
Link copied to clipboard
common
val <T : Any> Matrix<T>.origin: Matrix<T>
Return the original matrix.