StructureND

interface StructureND<out T> : Featured<StructureFeature>

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.

StructureND is in general identity-free. StructureND.contentEquals should be used in tests to compare contents.

Parameters

T

the type of items.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

elements
Link copied to clipboard
common
abstract fun elements(): Sequence<Pair<IntArray, T>>
Returns the sequence of all the elements associated by their indices.
get
Link copied to clipboard
common
abstract operator fun get(index: IntArray): T
Returns the value at the specified indices.
getFeature
Link copied to clipboard
common
open override fun <F : StructureFeature> getFeature(type: KClass<out F>): F?
Feature is some additional structure information that allows to access it special properties or hints.

Properties

dimension
Link copied to clipboard
common
open val dimension: Int
The count of dimensions in this structure.
shape
Link copied to clipboard
common
abstract val shape: IntArray
The shape of structure i.e., non-empty sequence of non-negative integers that specify sizes of dimensions of this structure.

Inheritors

BufferND
Link copied to clipboard
Structure1D
Link copied to clipboard
Structure2D
Link copied to clipboard
MutableStructureND
Link copied to clipboard

Extensions

as1D
Link copied to clipboard
common
fun <T> StructureND<T>.as1D(): Structure1D<T>
Represent a StructureND as Structure1D.
as2D
Link copied to clipboard
common
fun <T> StructureND<T>.as2D(): Structure2D<T>
Represents a StructureND as Structure2D.
div
Link copied to clipboard
common
open operator override fun StructureND<Double>.div(other: StructureND<Double>): DoubleBufferND
Division of two elements.
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.
get
Link copied to clipboard
common
operator fun <T> StructureND<T>.get(vararg index: Int): T
Returns the value at the specified indices.
map
Link copied to clipboard
common
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.
abstract fun StructureND<Short>.map(transform: ShortRing.(Short) -> Short): StructureND<Short>
Maps elements from one structure to another one by applying transform to them.
mapIndexed
Link copied to clipboard
common
abstract 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.
abstract 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.
mapToBuffer
Link copied to clipboard
common
inline fun <T, R : Any> StructureND<T>.mapToBuffer(factory: BufferFactory<R> = Buffer.Companion::auto, crossinline transform: (T) -> R): BufferND<R>
Transform structure to a new structure using provided BufferFactory and optimizing if argument is BufferND
minus
Link copied to clipboard
common
open operator override fun StructureND<Double>.minus(other: StructureND<Double>): DoubleBufferND
Subtraction of two elements.
open operator override fun StructureND<Double>.minus(arg: Double): StructureND<Double>
Subtracts an element from ND structure of it.
open operator fun StructureND<Short>.minus(arg: Short): StructureND<Short>
Subtracts an element from ND structure of it.
open operator fun StructureND<Short>.minus(other: StructureND<Short>): StructureND<Short>
Subtraction of two elements.
plus
Link copied to clipboard
common
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(other: StructureND<Double>): DoubleBufferND
Addition of two elements.
open operator override fun StructureND<Double>.plus(arg: Double): DoubleBufferND
Adds an ND structure to an element of it.
open operator fun StructureND<Short>.plus(other: StructureND<Short>): StructureND<Short>
Addition of two elements.
pow
Link copied to clipboard
common
open infix fun StructureND<Double>.pow(pow: Number): StructureND<Double>
Raises this value to the power pow.
times
Link copied to clipboard
common
open operator override fun StructureND<Double>.times(other: StructureND<Double>): DoubleBufferND
Multiplies this element by scalar.
open operator override fun StructureND<Double>.times(k: Number): DoubleBufferND
Multiplication of this element by a scalar.
open operator fun StructureND<Short>.times(arg: Short): StructureND<Short>
Multiplies an ND structure by an element of it.
open operator fun StructureND<Double>.times(arg: Double): StructureND<Double>
Multiplies an ND structure by an element of it.
open operator fun StructureND<Short>.times(other: StructureND<Short>): StructureND<Short>
Multiplies this element by scalar.
toBufferND
Link copied to clipboard
common
open override fun StructureND<Double>.toBufferND(): DoubleBufferND
open fun StructureND<Short>.toBufferND(): BufferND<Short>
unaryMinus
Link copied to clipboard
common
open operator override fun StructureND<Short>.unaryMinus(): StructureND<Short>
The negation of this element.
open operator override fun StructureND<Double>.unaryMinus(): DoubleBufferND
The negation of this element.
unaryPlus
Link copied to clipboard
common
open operator override fun StructureND<Double>.unaryPlus(): DoubleBufferND
Returns this value.
open operator fun StructureND<Short>.unaryPlus(): StructureND<Short>
Returns this value.
zip
Link copied to clipboard
common
inline fun <T : Any> StructureND<T>.zip(struct: StructureND<T>, crossinline block: (T, T) -> T): StructureND<T>

Sources

common source
Link copied to clipboard