Package space.kscience.kmath.nd

Types

Link copied to clipboard
interface AlgebraND<T, out C : Algebra<T>> : Algebra<StructureND<T>>

The base interface for all ND-algebra implementations.

Link copied to clipboard
interface BufferAlgebraND<T, out A : Algebra<T>> : AlgebraND<T, A>
Link copied to clipboard
open class BufferedFieldOpsND<T, out A : Field<T>>(bufferAlgebra: BufferAlgebra<T, A>, indexerBuilder: (IntArray) -> ShapeIndexer) : BufferedRingOpsND<T, A> , FieldOpsND<T, A>
Link copied to clipboard
open class BufferedGroupNDOps<T, out A : Group<T>>(bufferAlgebra: BufferAlgebra<T, A>, indexerBuilder: (IntArray) -> ShapeIndexer) : GroupOpsND<T, A> , BufferAlgebraND<T, A>
Link copied to clipboard
open class BufferedRingOpsND<T, out A : Ring<T>>(bufferAlgebra: BufferAlgebra<T, A>, indexerBuilder: (IntArray) -> ShapeIndexer) : BufferedGroupNDOps<T, A> , RingOpsND<T, A>
Link copied to clipboard
open class BufferND<out T>(indices: ShapeIndexer, buffer: Buffer<T>) : StructureND<T>

Represents StructureND over Buffer.

Link copied to clipboard
class DefaultStrides : Strides

Simple implementation of Strides.

Link copied to clipboard
class DoubleBufferND(indexes: ShapeIndexer, buffer: DoubleBuffer) : BufferND<Double>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface FieldND<T, out A : Field<T>> : Field<StructureND<T>> , FieldOpsND<T, A> , RingND<T, A> , WithShape
Link copied to clipboard
interface FieldOpsND<T, out A : Field<T>> : FieldOps<StructureND<T>> , RingOpsND<T, A> , ScaleOperations<StructureND<T>>

Field of StructureND.

Link copied to clipboard
interface GroupND<T, out A : Group<T>> : Group<StructureND<T>> , GroupOpsND<T, A> , WithShape
Link copied to clipboard
interface GroupOpsND<T, out A : GroupOps<T>> : GroupOps<StructureND<T>> , AlgebraND<T, A>

Space of StructureND.

Link copied to clipboard
class MutableBufferND<T>(strides: ShapeIndexer, buffer: MutableBuffer<T>) : BufferND<T> , MutableStructureND<T>
Link copied to clipboard
interface MutableStructure1D<T> : Structure1D<T> , MutableStructureND<T> , MutableBuffer<T>

A mutable structure that is guaranteed to be one-dimensional

Link copied to clipboard
interface MutableStructure2D<T> : Structure2D<T> , MutableStructureND<T>

Represents mutable Structure2D.

Link copied to clipboard
interface MutableStructureND<T> : StructureND<T>

Represents mutable StructureND.

Link copied to clipboard
interface RingND<T, out A : Ring<T>> : Ring<StructureND<T>> , RingOpsND<T, A> , GroupND<T, A> , WithShape
Link copied to clipboard
interface RingOpsND<T, out A : RingOps<T>> : RingOps<StructureND<T>> , GroupOpsND<T, A>

Ring of StructureND.

Link copied to clipboard
typealias Shape = IntArray
Link copied to clipboard
interface ShapeIndexer : Iterable<IntArray>

A converter from linear index to multivariate index

Link copied to clipboard
class ShapeMismatchException(expected: IntArray, actual: IntArray) : RuntimeException

An exception is thrown when the expected and actual shape of NDArray differ.

Link copied to clipboard
class ShortRingND(shape: Shape) : ShortRingOpsND, RingND<Short, ShortRing> , NumbersAddOps<StructureND<Short>>
Link copied to clipboard
sealed class ShortRingOpsND : BufferedRingOpsND<Short, ShortRing>
Link copied to clipboard
abstract class Strides : ShapeIndexer

Linear transformation of indexes

Link copied to clipboard
interface Structure1D<out T> : StructureND<T> , Buffer<T>

A structure that is guaranteed to be one-dimensional

Link copied to clipboard
interface Structure2D<out T> : StructureND<T>

A structure that is guaranteed to be two-dimensional.

Link copied to clipboard
interface StructureFeature : Feature<StructureFeature>
Link copied to clipboard
interface StructureND<out T> : Featured<StructureFeature> , WithShape

Represents n-dimensional structure i.e., multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a sequence of non-negative integers that specify the sizes of each dimension.

Link copied to clipboard
interface WithShape

Functions

Link copied to clipboard
fun <T> MutableStructureND<T>.as1D(): MutableStructure1D<T>

fun <T> StructureND<T>.as1D(): Structure1D<T>

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

Link copied to clipboard
fun <T> MutableStructureND<T>.as2D(): MutableStructure2D<T>
fun <T> StructureND<T>.as2D(): Structure2D<T>

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

Link copied to clipboard
fun <T> Buffer<T>.asND(): Structure1D<T>

Represent this buffer as 1D structure

Link copied to clipboard
fun <T : Comparable<T>> LinearSpace<T, Ring<T>>.contentEquals(st1: StructureND<T>, st2: StructureND<T>): Boolean
fun <T : Comparable<T>> AlgebraND<T, Ring<T>>.contentEquals(st1: StructureND<T>, st2: StructureND<T>): Boolean

Indicates whether some StructureND is equal to another one.

fun <T : Comparable<T>> LinearSpace<T, Ring<T>>.contentEquals(st1: StructureND<T>, st2: StructureND<T>, absoluteTolerance: T): Boolean
fun <T : Comparable<T>> GroupOpsND<T, Ring<T>>.contentEquals(st1: StructureND<T>, st2: StructureND<T>, absoluteTolerance: T): Boolean

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

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

Returns the value at the specified indices.

Link copied to clipboard
inline fun <T : Any, F : StructureFeature> AlgebraND<T, *>.getFeature(structure: StructureND<T>): F?

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

Link copied to clipboard
inline fun <T, A : Algebra<T>> BufferAlgebraND<T, A>.mapInline(arg: BufferND<T>, crossinline transform: A.(T) -> T): BufferND<T>
Link copied to clipboard
inline fun <T> MutableStructureND<T>.mapInPlace(action: (index: IntArray, T) -> T)

Transform a structure element-by element in place.

Link copied to clipboard
inline fun <T, R : Any> StructureND<T>.mapToBuffer(crossinline transform: (T) -> R): BufferND<R>

Transform structure to a new structure using inferred BufferFactory

inline fun <T, R : Any> StructureND<T>.mapToBuffer(factory: BufferFactory<R>, crossinline transform: (T) -> R): BufferND<R>

Transform structure to a new structure using provided BufferFactory and optimizing if argument is BufferND

Link copied to clipboard
inline fun <T, R : Any> MutableStructureND<T>.mapToMutableBuffer(factory: MutableBufferFactory<R> = MutableBuffer.Companion::auto, crossinline transform: (T) -> R): MutableBufferND<R>

Transform structure to a new structure using provided MutableBufferFactory and optimizing if argument is MutableBufferND

Link copied to clipboard
fun DoubleField.ndAlgebra(vararg shape: Int): DoubleFieldND
Link copied to clipboard
fun <T, A : Ring<T>> AlgebraND<T, A>.one(shape: Shape): StructureND<T>
@JvmName(name = "oneVarArg")
fun <T, A : Ring<T>> AlgebraND<T, A>.one(shapeFirst: Int, vararg shapeRest: Int): StructureND<T>
Link copied to clipboard
fun Shape(shapeFirst: Int, vararg shapeRest: Int): Shape
Link copied to clipboard
fun <T, EA : Algebra<T>, A : BufferAlgebraND<T, EA>, WithShape> A.structureND(initializer: EA.(IntArray) -> T): BufferND<T>
fun <T, A : Algebra<T>> BufferAlgebraND<T, A>.structureND(vararg shape: Int, initializer: A.(IntArray) -> T): BufferND<T>
fun <T, A : Algebra<T>> AlgebraND<T, A>.structureND(shapeFirst: Int, vararg shapeRest: Int, initializer: A.(IntArray) -> T): StructureND<T>
Link copied to clipboard
inline fun <R> DoubleField.withNdAlgebra(vararg shape: Int, action: DoubleFieldND.() -> R): R

Produce a context for n-dimensional operations inside this real field

inline fun <R> ShortRing.withNdAlgebra(vararg shape: Int, action: ShortRingND.() -> R): R
Link copied to clipboard
fun <T, A : Group<T>> AlgebraND<T, A>.zero(shape: Shape): StructureND<T>
@JvmName(name = "zeroVarArg")
fun <T, A : Group<T>> AlgebraND<T, A>.zero(shapeFirst: Int, vararg shapeRest: Int): StructureND<T>
Link copied to clipboard
inline fun <T : Any> StructureND<T>.zip(struct: StructureND<T>, crossinline block: (T, T) -> T): StructureND<T>

Properties

Link copied to clipboard
val <T, A : Group<T>> BufferAlgebra<T, A>.nd: BufferedGroupNDOps<T, A>
Link copied to clipboard
val <T, A : Ring<T>> BufferAlgebra<T, A>.nd: BufferedRingOpsND<T, A>
Link copied to clipboard
val <T, A : Field<T>> BufferAlgebra<T, A>.nd: BufferedFieldOpsND<T, A>
Link copied to clipboard
val DoubleField.ndAlgebra: DoubleFieldOpsND