PermutedMutableBuffer

class PermutedMutableBuffer<T>(val origin: MutableBuffer<T>, permutations: IntArray) : BufferView<T> , MutableBuffer<T> (source)

A BufferView that overrides indexing of the original buffer

Constructors

Link copied to clipboard
constructor(origin: MutableBuffer<T>, permutations: IntArray)

Functions

Link copied to clipboard

Creates an iterable that returns all elements from this Buffer.

Link copied to clipboard

Creates an n × 1 VirtualMatrix, where n is the size of the given buffer.

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

Represent this buffer as 1D structure

Link copied to clipboard

Convert this buffer to read-only buffer.

Link copied to clipboard

Creates a sequence that returns all elements from this Buffer.

Link copied to clipboard
inline fun <T1, T2, R> Buffer<T1>.combineToBuffer(other: Buffer<T2>, bufferFactory: BufferFactory<R>, crossinline transform: (T1, T2) -> R): Buffer<R>

Zip two buffers using given transform.

Link copied to clipboard
open override fun copy(): MutableBuffer<T>

Returns a shallow copy of the buffer.

Link copied to clipboard
fun <T> Buffer<T>.cumulativeSum(ring: Ring<T>): Buffer<T>
Link copied to clipboard
operator fun Point<Double>.div(value: Double): DoubleBuffer

open operator fun Buffer<Double>.div(arg: Buffer<Double>): Buffer<Double>

Division of two elements.

open operator fun Buffer<Double>.div(k: Number): Buffer<Double>

Division of this element by scalar.

Link copied to clipboard
fun <T> Buffer<T>.expand(range: IntRange, defaultValue: T): BufferView<T>

Resize original buffer to a given range using given range, filling additional segments with defaultValue. Range left border could be negative to designate adding new blank segment to the beginning of the buffer

Link copied to clipboard
fun <T> Buffer<T>.first(): T
Link copied to clipboard
inline fun <T, R> Buffer<T>.fold(initial: R, operation: (acc: R, T) -> R): R

Fold given buffer according to operation

Link copied to clipboard
inline fun <T : Any, R> Buffer<T>.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R

Fold given buffer according to indexed operation

Link copied to clipboard
open operator override fun get(index: Int): T

Gets element at given index.

Link copied to clipboard
operator fun <T> Buffer<T>.get(index: UInt): T
Link copied to clipboard

Non-boxing access to primitive Double

Link copied to clipboard

Non-boxing access to primitive Int

Link copied to clipboard
fun <T> Buffer<T>.getOrNull(index: Int): T?

if index is in range of buffer, return the value. Otherwise, return null.

Link copied to clipboard

Return a new array filled with buffer indices. Indices order is defined by sorting associated buffer value. This feature allows sorting buffer values without reordering its content.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open operator override fun iterator(): Iterator<T>

Iterates over all elements.

Link copied to clipboard
fun <T> Buffer<T>.last(): T
Link copied to clipboard
inline override fun Buffer<Double>.map(block: DoubleField.(Double) -> Double): DoubleBuffer
Link copied to clipboard
inline override fun Buffer<Double>.mapIndexed(block: DoubleField.(index: Int, arg: Double) -> Double): DoubleBuffer
Link copied to clipboard
inline fun <T, R> Buffer<T>.mapIndexedToBuffer(bufferFactory: BufferFactory<R>, crossinline block: (index: Int, value: T) -> R): Buffer<R>

Create a new buffer from this one with the given mapping (indexed) function. Provided bufferFactory is used to construct the new buffer.

Link copied to clipboard
inline fun <T, R> Buffer<T>.mapToBuffer(bufferFactory: BufferFactory<R>, crossinline block: (T) -> R): Buffer<R>

Create a new buffer from this one with the given mapping function. Provided bufferFactory is used to construct the new buffer.

Link copied to clipboard
open operator override fun Point<Double>.minus(other: Point<Double>): DoubleBuffer

Vector subtraction

open operator override fun Buffer<Double>.minus(arg: Buffer<Double>): DoubleBuffer

Subtraction of two elements.

Link copied to clipboard
open override fun originIndex(index: Int): Int

Get the index in origin buffer from index in this buffer. Return -1 if element not present in the original buffer This method should be used internally to optimize non-boxing access.

Link copied to clipboard

Created a permuted view of given buffer using provided indices

Created a permuted mutable view of given buffer using provided indices

Link copied to clipboard
open operator override fun Point<Double>.plus(other: Point<Double>): DoubleBuffer

Vector sum

open operator override fun Buffer<Double>.plus(arg: Buffer<Double>): DoubleBuffer

Addition of two elements.

Link copied to clipboard
open infix fun Buffer<Double>.pow(pow: Number): Buffer<Double>

Raises this value to the power pow.

Link copied to clipboard
inline fun <T> Buffer<T>.reduce(operation: (left: T, value: T) -> T): T

Reduce a buffer from left to right according to operation

Link copied to clipboard

Checks that the Buffer is sorted (ascending) and throws IllegalArgumentException if it is not.

Link copied to clipboard
open operator override fun set(index: Int, value: T)

Sets the array element at the specified index to the specified value.

Link copied to clipboard
fun <T> Buffer<T>.slice(range: IntRange): BufferView<T>

Zero-copy select a slice inside the original buffer

Link copied to clipboard

Create a zero-copy virtual buffer that contains the same elements but in ascending order

Link copied to clipboard
fun <V, C : Comparable<C>> Buffer<V>.sortedBy(selector: (V) -> C): Buffer<V>
Link copied to clipboard
fun <V, C : Comparable<C>> Buffer<V>.sortedByDescending(selector: (V) -> C): Buffer<V>
Link copied to clipboard

Create a zero-copy virtual buffer that contains the same elements but in descending order

Link copied to clipboard
open operator override fun Point<Double>.times(value: Double): DoubleBuffer

Multiplies a vector by its element.

open operator fun Buffer<Double>.times(arg: Buffer<Double>): Buffer<Double>

Multiplies this element by scalar.

open operator fun Buffer<Double>.times(k: Number): Buffer<Double>

Multiplication of this element by a scalar.

Link copied to clipboard

Returns a new ByteArray containing all the elements of this Buffer.

Link copied to clipboard

Returns a new DoubleArray containing all the elements of this Buffer.

Link copied to clipboard

Represent this buffer as DoubleBuffer. Does not guarantee that changes in the original buffer are reflected on this buffer.

Link copied to clipboard

Returns a new FloatArray containing all the elements of this Buffer.

Link copied to clipboard

Returns a new IntArray containing all the elements of this Buffer.

Link copied to clipboard
fun <T> Buffer<T>.toList(): List<T>

Returns a new List containing all elements of this buffer.

Link copied to clipboard

Returns a new LongArray containing all the elements of this Buffer.

Link copied to clipboard

Returns a new MutableList filled with all elements of this buffer. NOTE: this method uses a protective copy, so it should not be used in performance-critical code.

Link copied to clipboard

Returns a new ShortArray containing all the elements of this Buffer.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Returns a new Array containing all elements of this buffer. NOTE: this method uses a protective copy, so it should not be used in performance-critical code.

Link copied to clipboard
open operator fun Point<Double>.unaryMinus(): Point<Double>

open operator override fun Buffer<Double>.unaryMinus(): DoubleBuffer

The negation of this element.

Link copied to clipboard
open operator fun Buffer<Double>.unaryPlus(): Buffer<Double>

Returns this value.

Link copied to clipboard
inline override fun Buffer<Double>.zip(other: Buffer<Double>, block: DoubleField.(left: Double, right: Double) -> Double): DoubleBuffer

Properties

Link copied to clipboard

Returns an IntRange of the valid indices for this Buffer.

Link copied to clipboard
open override val origin: MutableBuffer<T>
Link copied to clipboard
open override val size: Int

The size of this buffer.