MatrixWrapper

A Matrix that holds MatrixFeature objects.

Parameters

T

the type of items.

Functions

Link copied to clipboard

Represent a StructureND as Structure1D. Throw error in case of dimension mismatch.

Link copied to clipboard

Represents a StructureND as Structure2D. Throws runtime error in case of dimension mismatch.

Link copied to clipboard

A zero-copy method to represent a Structure2D as a two-column x-y data. There could more than two columns in the structure.

Link copied to clipboard
fun <T : Any> Matrix<T>.asVector(): Point<T>

Convert matrix to vector if it is possible.

Link copied to clipboard
fun <T> Structure2D<T>.asXYData(xIndex: Int = 0, yIndex: Int = 1): XYColumnarData<T, T, T>

A zero-copy method to represent a Structure2D as a two-column x-y data. There could more than two columns in the structure.

Link copied to clipboard
open operator override fun StructureND<Double>.div(arg: Double): DoubleBufferND

Divides an ND structure by an element of it.

open operator override fun StructureND<Double>.div(k: Number): DoubleBufferND

Division of this element by scalar.

open operator override fun StructureND<Double>.div(arg: StructureND<Double>): DoubleBufferND

Division of two elements.

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

Computes the dot product of this matrix and another one.

open infix override fun Matrix<Double>.dot(vector: Point<Double>): DoubleBuffer

Computes the dot product of this matrix and a vector.

Link copied to clipboard

Returns the sequence of all the elements associated by their indices.

Link copied to clipboard
open operator override fun get(index: IntArray): T

Returns the value at the specified indices.

open operator override fun get(i: Int, j: Int): T

Retrieves an element from the structure by two indices.

Link copied to clipboard
operator fun <T> StructureND<T>.get(vararg index: Int): T

Returns the value at the specified indices.

operator fun StructureND<Double>.get(vararg index: Int): Double
operator fun StructureND<Int>.get(vararg index: Int): Int
Link copied to clipboard

Optimized method to access primitive without boxing if possible

Link copied to clipboard
open override fun <F : StructureFeature> getFeature(type: KClass<out F>): F?

Get the first feature matching given class. Does not guarantee that matrix has only one feature matching the criteria.

Link copied to clipboard
Link copied to clipboard
@PerformancePitfall(message = "Very slow on remote execution algebras")
open fun StructureND<Int>.map(transform: IntRing.(Int) -> Int): StructureND<Int>

Maps elements from one structure to another one by applying transform to them.

@PerformancePitfall(message = "Very slow on remote execution algebras")
open fun StructureND<Short>.map(transform: ShortRing.(Short) -> Short): StructureND<Short>

Maps elements from one structure to another one by applying transform to them.

open override fun StructureND<Double>.map(transform: DoubleField.(Double) -> Double): BufferND<Double>

Maps elements from one structure to another one by applying transform to them.

Link copied to clipboard
@PerformancePitfall(message = "Very slow on remote execution algebras")
open fun StructureND<Double>.mapIndexed(transform: DoubleField.(index: IntArray, Double) -> Double): StructureND<Double>

Maps elements from one structure to another one by applying transform to them alongside with their indices.

@PerformancePitfall(message = "Very slow on remote execution algebras")
open fun StructureND<Int>.mapIndexed(transform: IntRing.(index: IntArray, Int) -> Int): StructureND<Int>

Maps elements from one structure to another one by applying transform to them alongside with their indices.

@PerformancePitfall(message = "Very slow on remote execution algebras")
open fun StructureND<Short>.mapIndexed(transform: ShortRing.(index: IntArray, Short) -> Short): StructureND<Short>

Maps elements from one structure to another one by applying transform to them alongside with their indices.

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

Matrix subtraction

open operator override fun StructureND<Double>.minus(arg: Double): StructureND<Double>
open operator fun StructureND<Int>.minus(arg: Int): StructureND<Int>
open operator fun StructureND<Short>.minus(arg: Short): StructureND<Short>

Subtracts an element from ND structure of it.

open operator override fun StructureND<Double>.minus(arg: StructureND<Double>): DoubleBufferND
open operator fun StructureND<Int>.minus(arg: StructureND<Int>): StructureND<Int>

Subtraction of two elements.

Link copied to clipboard
fun <T> Matrix<T>.named(symbols: List<Symbol>): NamedMatrix<T>
Link copied to clipboard
Link copied to clipboard
operator fun <T : Any> Matrix<T>.plus(newFeature: MatrixFeature): MatrixWrapper<T>

open operator override fun Matrix<Double>.plus(other: Matrix<Double>): Matrix<Double>

Matrix sum

open operator override fun StructureND<Double>.plus(arg: Double): DoubleBufferND
open operator fun StructureND<Int>.plus(arg: Int): StructureND<Int>
open operator fun StructureND<Short>.plus(arg: Short): StructureND<Short>

Adds an ND structure to an element of it.

open operator override fun StructureND<Double>.plus(arg: StructureND<Double>): DoubleBufferND
open operator fun StructureND<Int>.plus(arg: StructureND<Int>): StructureND<Int>

Addition of two elements.

Link copied to clipboard
open infix fun StructureND<Double>.pow(pow: Number): StructureND<Double>

Raises this value to the power pow.

Link copied to clipboard
fun <T> StructureND<T>.roll(axis: Int, step: Int = 1): StructureND<T>
fun <T> StructureND<T>.roll(pair: Pair<Int, Int>, vararg others: Pair<Int, Int>): StructureND<T>
Link copied to clipboard
open operator override fun Matrix<Double>.times(value: Double): Matrix<Double>

Multiplies a matrix by its element.

open operator override fun StructureND<Double>.times(k: Number): DoubleBufferND

Multiplication of this element by a scalar.

open operator override fun StructureND<Double>.times(arg: StructureND<Double>): DoubleBufferND
open operator fun StructureND<Int>.times(arg: StructureND<Int>): StructureND<Int>

Multiplies this element by scalar.

open operator fun StructureND<Double>.times(arg: Double): StructureND<Double>
open operator fun StructureND<Int>.times(arg: Int): StructureND<Int>
open operator fun StructureND<Short>.times(arg: Short): StructureND<Short>

Multiplies an ND structure by an element of it.

Link copied to clipboard
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun <T : Any> Matrix<T>.transpose(): Matrix<T>

Create a virtual transposed matrix without copying anything. A.transpose().transpose() === A

Link copied to clipboard
open operator override fun Matrix<Double>.unaryMinus(): Matrix<Double>

open operator override fun StructureND<Int>.unaryMinus(): StructureND<Int>
open operator override fun StructureND<Short>.unaryMinus(): StructureND<Short>
open operator override fun StructureND<Double>.unaryMinus(): DoubleBufferND

The negation of this element.

Link copied to clipboard
open operator override fun StructureND<Double>.unaryPlus(): DoubleBufferND
open operator fun StructureND<Int>.unaryPlus(): StructureND<Int>

Returns this value.

Link copied to clipboard

Add a single feature to a Matrix

Link copied to clipboard

Add a collection of features to a Matrix

Properties

Link copied to clipboard
open override val colNum: Int

The number of columns in this structure.

Link copied to clipboard
open override val columns: List<Buffer<T>>

The buffer of columns of this structure. It gets elements from the structure dynamically.

Link copied to clipboard
open override val dimension: Int

The count of dimensions in this structure. It should be equal to size of shape.

Link copied to clipboard
Link copied to clipboard
open override val indices: ShapeIndexer
Link copied to clipboard
Link copied to clipboard

Return the original matrix. If this is a wrapper, return its origin. If not, this matrix. Origin does not necessary store all features.

Link copied to clipboard
open override val rowNum: Int

The number of rows in this structure.

Link copied to clipboard
open override val rows: List<Buffer<T>>

The buffer of rows of this structure. It gets elements from the structure dynamically.

Link copied to clipboard
open override val shape: ShapeND

The shape of structure i.e., non-empty sequence of non-negative integers that specify sizes of dimensions of this structure.