Package space.kscience.kmath.linear

Types

BufferMatrix
Link copied to clipboard
common
class BufferMatrix<T : Any>(rowNum: Int, colNum: Int, buffer: Buffer<T>) : Structure2D<T>
BufferMatrixContext
Link copied to clipboard
common
class BufferMatrixContext<T : Any, R : Ring<T>>(elementContext: R, bufferFactory: BufferFactory<T>) : GenericMatrixContext<T, R, BufferMatrix<T>>
Basic implementation of Matrix space based on NDStructure
BufferVectorSpace
Link copied to clipboard
common
class BufferVectorSpace<T : Any, S : Space<T>>(size: Int, space: S, bufferFactory: BufferFactory<T>) : VectorSpace<T, S>
CholeskyDecompositionFeature
Link copied to clipboard
common
interface CholeskyDecompositionFeature<T : Any> : MatrixFeature
Matrices with this feature support Cholesky factorization: a = l &middot; l<sup>H</sup> 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.
GenericMatrixContext
Link copied to clipboard
common
interface GenericMatrixContext<T : Any, R : Ring<T>, out M : Matrix<T>> : MatrixContext<T, M>
Partial implementation of MatrixContext for matrices of Ring.
InverseMatrixFeature
Link copied to clipboard
common
interface InverseMatrixFeature<T : Any> : MatrixFeature
Matrices with this feature can be inverted: inverse = a<sup>-1</sup> 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 resolve equation A dot X = B, where A and B are matrices or vectors
LupDecomposition
Link copied to clipboard
common
class LupDecomposition<T : Any>(context: MatrixContext<T, Matrix<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(rows: Int, columns: Int)
MatrixContext
Link copied to clipboard
common
interface MatrixContext<T : Any, out M : Matrix<T>> : SpaceOperations<Matrix<T>>
Basic operations on matrices.
MatrixFeature
Link copied to clipboard
common
interface MatrixFeature
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.
OrthogonalFeature
Link copied to clipboard
common
object OrthogonalFeature : MatrixFeature
Matrices with this feature are orthogonal ones: a &middot; a<sup>T</sup> = u where a is the owning matrix, u is the unit matrix (UnitFeature).
Point
Link copied to clipboard
common
typealias Point<T> = Buffer<T>
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.
RealMatrixContext
Link copied to clipboard
common
object RealMatrixContext : MatrixContext<Double, BufferMatrix<Double>>
SingularValueDecompositionFeature
Link copied to clipboard
common
interface SingularValueDecompositionFeature<T : Any> : MatrixFeature
Matrices with this feature support SVD: a = u &middot; s &middot; v<sup>H</sup> 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.
VectorSpace
Link copied to clipboard
common
interface VectorSpace<T : Any, S : Space<T>> : Space<Point<T>>
A linear space for vectors.
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>
asPoint
Link copied to clipboard
common
fun <T : Any> Matrix<T>.asPoint(): Point<T>
Convert matrix to vector if it is possible
build
Link copied to clipboard
common
fun Structure2D.Companion.build(rows: Int, columns: Int): MatrixBuilder
column
Link copied to clipboard
common
fun <T : Any> Structure2D.Companion.column(vararg values: T): Matrix<T>
inline fun <T : Any> Structure2D.Companion.column(size: Int, factory: BufferFactory<T> = Buffer.Companion::auto, noinline builder: (Int) -> T): Matrix<T>
DeterminantFeature
Link copied to clipboard
common
fun <T : Any> DeterminantFeature(determinant: T): DeterminantFeature<T>
Produces a DeterminantFeature where the DeterminantFeature.determinant is determinant.
getFeature
Link copied to clipboard
common
inline fun <T : Any, F : Any> MatrixContext<T, *>.getFeature(m: Matrix<T>): F?
Gets a feature from the matrix.
inverseWithLup
Link copied to clipboard
common
fun RealMatrixContext.inverseWithLup(matrix: Matrix<Double>): Matrix<Double>
Inverses a square matrix using LUP decomposition.
inline fun <T : Comparable<T>, F : Field<T>> GenericMatrixContext<T, F, Matrix<T>>.inverseWithLup(matrix: Matrix<T>, noinline bufferFactory: MutableBufferFactory<T> = MutableBuffer.Companion::auto, noinline checkSingular: (T) -> Boolean): Matrix<T>
lup
Link copied to clipboard
common
fun MatrixContext<Double, Matrix<Double>>.lup(matrix: Matrix<Double>): LupDecomposition<Double>
inline fun <T : Comparable<T>, F : Field<T>> GenericMatrixContext<T, F, Matrix<T>>.lup(matrix: Matrix<T>, noinline checkSingular: (T) -> Boolean): LupDecomposition<T>
fun <T : Comparable<T>> MatrixContext<T, Matrix<T>>.lup(factory: MutableBufferFactory<T>, elementContext: Field<T>, matrix: Matrix<T>, checkSingular: (T) -> Boolean): LupDecomposition<T>
Create a lup decomposition of generic matrix.
one
Link copied to clipboard
common
fun <T : Any, R : Ring<T>> GenericMatrixContext<T, R, *>.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> Structure2D.Companion.row(vararg values: T): Matrix<T>
inline fun <T : Any> Structure2D.Companion.row(size: Int, factory: BufferFactory<T> = Buffer.Companion::auto, noinline builder: (Int) -> T): Matrix<T>
solveWithLup
Link copied to clipboard
common
inline fun <T : Any> LupDecomposition<T>.solveWithLup(matrix: Matrix<T>): Matrix<T>
fun <T : Any> LupDecomposition<T>.solveWithLup(factory: MutableBufferFactory<T>, matrix: Matrix<T>): Matrix<T>
fun RealMatrixContext.solveWithLup(a: Matrix<Double>, b: Matrix<Double>): Matrix<Double>
inline fun <T : Comparable<T>, F : Field<T>> GenericMatrixContext<T, F, Matrix<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.
square
Link copied to clipboard
common
fun <T : Any> Structure2D.Companion.square(vararg elements: T): Matrix<T>
Build a square matrix from given elements.
transpose
Link copied to clipboard
common
fun <T : Any> Matrix<T>.transpose(): Matrix<T>
Create a virtual transposed matrix without copying anything.
zero
Link copied to clipboard
common
fun <T : Any, R : Ring<T>> GenericMatrixContext<T, R, *>.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.
real
Link copied to clipboard
common
val MatrixContext.Companion.real: RealMatrixContext
Partially optimized real-valued matrix