Package-level declarations

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: (ShapeND) -> ShapeIndexer = BufferAlgebraND.defaultIndexerBuilder) : BufferedRingOpsND<T, A> , FieldOpsND<T, A>
Link copied to clipboard
open class BufferedGroupNDOps<T, out A : Group<T>>(val bufferAlgebra: BufferAlgebra<T, A>, val indexerBuilder: (ShapeND) -> ShapeIndexer = BufferAlgebraND.defaultIndexerBuilder) : GroupOpsND<T, A> , BufferAlgebraND<T, A>
Link copied to clipboard
open class BufferedRingOpsND<T, out A : Ring<T>>(bufferAlgebra: BufferAlgebra<T, A>, indexerBuilder: (ShapeND) -> ShapeIndexer = BufferAlgebraND.defaultIndexerBuilder) : BufferedGroupNDOps<T, A> , RingOpsND<T, A>
Link copied to clipboard
open class BufferND<out T>(val indices: ShapeIndexer, val buffer: Buffer<T>) : StructureND<T>

Represents StructureND over Buffer.

Link copied to clipboard
class ColumnStrides(val shape: ShapeND) : Strides

Column-first Strides. Columns are represented as continuous arrays

Link copied to clipboard

A simple mutable StructureND of doubles

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
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
Link copied to clipboard
class IntBufferND(indexes: ShapeIndexer, val buffer: IntBuffer) : MutableBufferND<Int>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open class MutableBufferND<T>(strides: ShapeIndexer, val buffer: MutableBuffer<T>) : BufferND<T> , MutableStructureND<T>
Link copied to clipboard

A mutable structure that is guaranteed to be one-dimensional

Link copied to clipboard

Represents mutable Structure2D.

Link copied to clipboard

Represents mutable StructureND.

Link copied to clipboard
class PermutedMutableStructureND<T>(val origin: MutableStructureND<T>, val shape: ShapeND = origin.shape, val permutation: (IntArray) -> IntArray) : MutableStructureND<T>
Link copied to clipboard
class PermutedStructureND<T>(val origin: StructureND<T>, val permutation: (IntArray) -> IntArray) : StructureND<T>
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
class RowStrides(val shape: ShapeND) : Strides

This Strides implementation follows the last dimension first convention For more information: https://numpy.org/doc/stable/reference/generated/numpy.ndarray.strides.html

Link copied to clipboard

A converter from linear index to multivariate index

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

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

Link copied to clipboard
value class ShapeND(array: IntArray)

A read-only ND shape

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

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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open class VirtualStructureND<T>(val shape: ShapeND, val producer: (IntArray) -> T) : StructureND<T>
Link copied to clipboard
interface WithShape

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
Link copied to clipboard
Link copied to clipboard
fun <T> Buffer<T>.asND(): Structure1D<T>

Represent this buffer as 1D structure

Link copied to clipboard
fun <T> BufferND(shape: ShapeND, bufferFactory: BufferFactory<T> = BufferFactory.boxing(), initializer: (IntArray) -> T): BufferND<T>

Create a generic BufferND using provided initializer

Link copied to clipboard
operator fun ShapeND.component1(): Int
Link copied to clipboard
operator fun ShapeND.component2(): Int
Link copied to clipboard
operator fun ShapeND.component3(): Int
Link copied to clipboard

Indicates whether some StructureND is equal to another one.

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

A shape including first n dimensions of this shape

Link copied to clipboard
inline fun ShapeND.forEach(block: (value: Int) -> Unit)
Link copied to clipboard
inline fun ShapeND.forEachIndexed(block: (index: Int, value: Int) -> Unit)
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
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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A shape including last n dimensions of this shape

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
fun <T> MutableBufferND(shape: ShapeND, bufferFactory: MutableBufferFactory<T> = MutableBufferFactory.boxing(), initializer: (IntArray) -> T): MutableBufferND<T>

Create a generic BufferND using provided initializer

Link copied to clipboard
Link copied to clipboard
fun <T, A : Ring<T>> AlgebraND<T, A>.one(shape: ShapeND): 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 <T> MutableStructureND<T>.permute(newShape: ShapeND = shape, permutation: (IntArray) -> IntArray): PermutedMutableStructureND<T>
Link copied to clipboard
operator fun ShapeND.plus(add: IntArray): ShapeND
operator fun ShapeND.plus(add: ShapeND): ShapeND
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
operator fun <T> MutableStructureND<T>.set(vararg index: Int, value: T)

Set value at specified indices

Link copied to clipboard
fun ShapeND(shapeFirst: Int, vararg shapeRest: Int): ShapeND
Link copied to clipboard
Link copied to clipboard
fun Strides(shape: ShapeND): Strides

Cached builder for default strides

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

Convert to array with protective copy

Link copied to clipboard
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> IntRing.withNdAlgebra(vararg shape: Int, action: IntRingND.() -> R): R
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: ShapeND): StructureND<T>
@JvmName(name = "zeroVarArg")
fun <T, A : Group<T>> AlgebraND<T, A>.zero(shapeFirst: Int, vararg shapeRest: Int): StructureND<T>

Properties

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