Package space.kscience.kmath.linear

Types

BufferedLinearSpace
Link copied to clipboard
common
class BufferedLinearSpace<T : Any, A : Ring<T>>(elementAlgebra: A, bufferFactory: BufferFactory<T>) : LinearSpace<T, A>
CholeskyDecompositionFeature
Link copied to clipboard
common
interface CholeskyDecompositionFeature<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<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.
InverseMatrixFeature
Link copied to clipboard
common
interface InverseMatrixFeature<T : Any> : MatrixFeature
Matrices with this feature can be inverted: inverse = a-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 -1 &middot; B, where A and B are matrices or vectors.
LinearSpace
Link copied to clipboard
common
interface LinearSpace<T : Any, out A : Ring<T>>
Basic operations on matrices and vectors.
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<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, 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<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<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<T : Any> : MatrixFeature
Matrices with this feature support SVD: a = u &middot; s &middot; vH where a is the owning matrix.
TransposedFeature
Link copied to clipboard
common
class TransposedFeature<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<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>
DeterminantFeature
Link copied to clipboard
common
fun <T : Any> DeterminantFeature(determinant: T): DeterminantFeature<T>
getFeature
Link copied to clipboard
common
inline fun <T : Any, F : StructureFeature> LinearSpace<T, *>.getFeature(structure: Matrix<T>): F?
Get a feature of the structure in this scope.
inverseWithLup
Link copied to clipboard
common
fun LinearSpace<Double, DoubleField>.inverseWithLup(matrix: Matrix<Double>): Matrix<Double>
Inverses a square matrix using LUP decomposition.
inline fun <T : Comparable<T>> LinearSpace<T, Field<T>>.inverseWithLup(matrix: Matrix<T>, noinline bufferFactory: MutableBufferFactory<T> = MutableBuffer.Companion::auto, noinline checkSingular: (T) -> Boolean): Matrix<T>
invoke
Link copied to clipboard
common
operator fun <LS : LinearSpace<*, *>, R> LS.invoke(block: LS.() -> R): R
lup
Link copied to clipboard
common
fun LinearSpace<Double, DoubleField>.lup(matrix: Matrix<Double>): LupDecomposition<Double>
inline fun <T : Comparable<T>> LinearSpace<T, Field<T>>.lup(matrix: Matrix<T>, noinline checkSingular: (T) -> Boolean): LupDecomposition<T>
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.
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(newFeatures: Collection<MatrixFeature>): MatrixWrapper<T>
Add a collection of features to a Matrix
operator fun <T : Any> Matrix<T>.plus(newFeature: MatrixFeature): MatrixWrapper<T>
Add a single feature to a Matrix
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>
solveWithLup
Link copied to clipboard
common
inline fun <T : Any> LupDecomposition<T>.solveWithLup(matrix: Matrix<T>): Matrix<T>
fun LinearSpace<Double, DoubleField>.solveWithLup(a: Matrix<Double>, b: Matrix<Double>): Matrix<Double>
fun <T : Any> LupDecomposition<T>.solveWithLup(factory: MutableBufferFactory<T>, matrix: Matrix<T>): Matrix<T>
inline fun <T : Comparable<T>> LinearSpace<T, Field<T>>.solveWithLup(a: Matrix<T>, b: Matrix<T>, noinline bufferFactory: MutableBufferFactory<T> = MutableBuffer.Companion::auto, noinline checkSingular: (T) -> Boolean): Matrix<T>
Solves a system of linear equations ax = b* using LUP decomposition.
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>
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

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