Package space.kscience.kmath.structures

Types

Link copied to clipboard
class ArrayBuffer<T>(array: Array<T>) : MutableBuffer<T>

MutableBuffer implementation over Array.

Link copied to clipboard
interface Buffer<out T>

A generic read-only random-access structure for both primitives and objects.

Link copied to clipboard
typealias BufferFactory<T> = (Int, (Int) -> T) -> Buffer<T>

Function that produces Buffer from its size and function that supplies values.

Link copied to clipboard
value class DoubleBuffer(array: DoubleArray) : MutableBuffer<Double>

Specialized MutableBuffer implementation over DoubleArray.

Link copied to clipboard
interface FlaggedBuffer<out T> : Buffer<T>

A buffer with flagged values.

Link copied to clipboard
class FlaggedDoubleBuffer(values: DoubleArray, flags: ByteArray) : FlaggedBuffer<Double?> , Buffer<Double?>

A Double buffer that supports flags for each value like NaN or Missing.

Link copied to clipboard
value class FloatBuffer(array: FloatArray) : MutableBuffer<Float>

Specialized MutableBuffer implementation over FloatArray.

Link copied to clipboard
value class IntBuffer(array: IntArray) : MutableBuffer<Int>

Specialized MutableBuffer implementation over IntArray.

Link copied to clipboard
class ListBuffer<T>(list: List<T>) : Buffer<T>

Buffer implementation over List.

Link copied to clipboard
value class LongBuffer(array: LongArray) : MutableBuffer<Long>

Specialized MutableBuffer implementation over LongArray.

Link copied to clipboard
open class MemoryBuffer<T : Any>(memory: Memory, spec: MemorySpec<T>) : Buffer<T>

A non-boxing buffer over Memory object.

Link copied to clipboard
interface MutableBuffer<T> : Buffer<T>

A generic mutable random-access structure for both primitives and objects.

Link copied to clipboard
typealias MutableBufferFactory<T> = (Int, (Int) -> T) -> MutableBuffer<T>

Function that produces MutableBuffer from its size and function that supplies values.

Link copied to clipboard
value class MutableListBuffer<T>(list: MutableList<T>) : MutableBuffer<T>

MutableBuffer implementation over MutableList.

Link copied to clipboard
class MutableMemoryBuffer<T : Any>(memory: Memory, spec: MemorySpec<T>) : MemoryBuffer<T> , MutableBuffer<T>

A mutable non-boxing buffer over Memory object.

Link copied to clipboard
value class ReadOnlyBuffer<T>(buffer: MutableBuffer<T>) : Buffer<T>

Immutable wrapper for MutableBuffer.

Link copied to clipboard
value class ShortBuffer(array: ShortArray) : MutableBuffer<Short>

Specialized MutableBuffer implementation over ShortArray.

Link copied to clipboard
enum ValueFlag : Enum<ValueFlag>

Represents flags to supply additional info about values of buffer.

Link copied to clipboard
class VirtualBuffer<out T>(size: Int, generator: (Int) -> T) : Buffer<T>

A buffer with content calculated on-demand. The calculated content is not stored, so it is recalculated on each call. Useful when one needs single element from the buffer.

Functions

Link copied to clipboard
fun <T> Array<T>.asBuffer(): ArrayBuffer<T>

Returns an ArrayBuffer that wraps the original array.

fun DoubleArray.asBuffer(): DoubleBuffer

Returns DoubleBuffer over this array.

fun FloatArray.asBuffer(): FloatBuffer

Returns FloatBuffer over this array.

fun IntArray.asBuffer(): IntBuffer

Returns IntBuffer over this array.

fun LongArray.asBuffer(): LongBuffer

Returns LongBuffer over this array.

fun ShortArray.asBuffer(): ShortBuffer

Returns ShortBuffer over this array.

fun <T> List<T>.asBuffer(): ListBuffer<T>

Returns an ListBuffer that wraps the original list.

Link copied to clipboard
fun <T> MutableList<T>.asMutableBuffer(): MutableListBuffer<T>

Returns an MutableListBuffer that wraps the original list.

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

Convert this buffer to read-only buffer.

Link copied to clipboard
fun DoubleBuffer.contentEquals(vararg doubles: Double): Boolean

Simplified DoubleBuffer to array comparison

Link copied to clipboard
fun DoubleBuffer(vararg doubles: Double): DoubleBuffer

Returns a new DoubleBuffer of given elements.

inline fun DoubleBuffer(size: Int, init: (Int) -> Double): DoubleBuffer

Creates a new DoubleBuffer with the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
fun <T> Buffer<T>.first(): T
Link copied to clipboard
fun FloatBuffer(vararg floats: Float): FloatBuffer

Returns a new FloatBuffer of given elements.

inline fun FloatBuffer(size: Int, init: (Int) -> Float): FloatBuffer

Creates a new FloatBuffer with the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
inline fun FlaggedDoubleBuffer.forEachValid(block: (Double) -> Unit)
Link copied to clipboard
fun FlaggedBuffer<*>.hasFlag(index: Int, flag: ValueFlag): Boolean
Link copied to clipboard
fun IntBuffer(vararg ints: Int): IntBuffer

Returns a new IntBuffer of given elements.

inline fun IntBuffer(size: Int, init: (Int) -> Int): IntBuffer

Creates a new IntBuffer with the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
fun FlaggedBuffer<*>.isMissing(index: Int): Boolean
Link copied to clipboard
fun FlaggedBuffer<*>.isValid(index: Int): Boolean

The value is valid if all flags are down

Link copied to clipboard
fun <T> Buffer<T>.last(): T
Link copied to clipboard
fun LongBuffer(vararg longs: Long): LongBuffer

Returns a new LongBuffer of given elements.

inline fun LongBuffer(size: Int, init: (Int) -> Long): LongBuffer

Creates a new LongBuffer with the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
fun ShortBuffer(vararg shorts: Short): ShortBuffer

Returns a new ShortBuffer of given elements.

inline fun ShortBuffer(size: Int, init: (Int) -> Short): ShortBuffer

Creates a new ShortBuffer with the specified size, where each element is calculated by calling the specified init function.

Link copied to clipboard
fun Buffer<Double>.toDoubleArray(): DoubleArray

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

Link copied to clipboard
fun Buffer<Float>.toFloatArray(): FloatArray

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

Link copied to clipboard
fun Buffer<Int>.toIntArray(): IntArray

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

Link copied to clipboard
fun Buffer<Long>.toLongArray(): LongArray

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

Link copied to clipboard
fun Buffer<Short>.toShortArray(): ShortArray

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

Properties

Link copied to clipboard
val Buffer<*>.indices: IntRange

Returns an IntRange of the valid indices for this Buffer.