MutableStructureND

interface MutableStructureND<T> : StructureND<T>

Represents mutable StructureND.

Functions

Link copied to clipboard
open fun elements(): Sequence<Pair<IntArray, T>>

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

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

Returns the value at the specified indices.

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
abstract operator fun set(index: IntArray, value: T)

Inserts an item at the specified indices.

Properties

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 val indices: ShapeIndexer
Link copied to clipboard
abstract override val shape: Shape

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

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

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

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

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

Sources

Link copied to clipboard