BufferND

open class BufferND<out T>(val indices: ShapeIndexer, val buffer: Buffer<T>) : StructureND<T> (source)

Represents StructureND over Buffer.

Parameters

T

the type of items.

indices

The strides to access elements of Buffer by linear indices.

buffer

The underlying buffer.

Inheritors

Constructors

Link copied to clipboard
constructor(indices: ShapeIndexer, buffer: Buffer<T>)

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
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

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.

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?

Feature is some additional structure information that allows to access it special properties or hints. If the feature is not present, null is returned.

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 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
Link copied to clipboard
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 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
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.

Properties

Link copied to clipboard
open val buffer: Buffer<T>
Link copied to clipboard
open val dimension: Int

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

Link copied to clipboard
open override val indices: ShapeIndexer
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.