Package space.kscience.kmath.stat

Types

BasicSampler
Link copied to clipboard
common
class BasicSampler<T : Any>(chainBuilder: (RandomGenerator) -> Chain<T>) : Sampler<T>
Implements Sampler by delegating sampling to value of chainBuilder.
BlockingStatistic
Link copied to clipboard
common
interface BlockingStatistic<T, R> : Statistic<T, R>
ComposableStatistic
Link copied to clipboard
common
interface ComposableStatistic<T, I, R> : Statistic<T, R>
A statistic tha could be computed separately on different blocks of data and then composed
ConstantSampler
Link copied to clipboard
common
class ConstantSampler<T : Any>(value: T) : Sampler<T>
Implements Sampler by sampling only certain value.
DefaultGenerator
Link copied to clipboard
common
class DefaultGenerator(random: Random) : RandomGenerator
Implements RandomGenerator by delegating all operations to Random.
MCScope
Link copied to clipboard
common
class MCScope(coroutineContext: CoroutineContext, random: RandomGenerator)
A scope for a Monte-Carlo computations or multi-coroutine random number generation.
Mean
Link copied to clipboard
common
class Mean<T>(group: Ring<T>, division: (T, count: Int) -> T) : ComposableStatistic<T, Pair<T, Int>, T> , BlockingStatistic<T, T>
Arithmetic mean
Median
Link copied to clipboard
common
class Median<T>(comparator: Comparator<T>) : BlockingStatistic<T, T>
Non-composable median
RandomChain
Link copied to clipboard
common
class RandomChain<out R>(generator: RandomGenerator, gen: suspend RandomGenerator.() -> R) : Chain<R>
A possibly stateful chain producing random values.
RandomGenerator
Link copied to clipboard
common
interface RandomGenerator
An interface that is implemented by random number generator algorithms.
RandomGeneratorProvider
Link copied to clipboard
class RandomGeneratorProvider(generator: RandomGenerator) : UniformRandomProvider
Implements UniformRandomProvider by delegating all operations to RandomGenerator.
RandomSourceGenerator
Link copied to clipboard
class RandomSourceGenerator : RandomGenerator
Implements RandomGenerator by delegating all operations to RandomSource.
Sampler
Link copied to clipboard
common
fun fun interface Sampler<out T : Any>
Sampler that generates chains of values of type T in a chain of type C.
SamplerSpace
Link copied to clipboard
common
class SamplerSpace<T : Any, S : Group<T>, ScaleOperations<T>>(algebra: S) : Group<Sampler<T>> , ScaleOperations<Sampler<T>>
A space of samplers.
Statistic
Link copied to clipboard
common
interface Statistic<T, R>
A function, that transforms a buffer of random quantities to some resulting value
UniformDistribution
Link copied to clipboard
common
UniformDoubleChain
Link copied to clipboard
common
class UniformDoubleChain(generator: RandomGenerator) : BlockingDoubleChain
A type-specific double chunk random chain

Functions

asUniformRandomProvider
Link copied to clipboard
fun RandomGenerator.asUniformRandomProvider(): UniformRandomProvider
Represent this RandomGenerator as commons-rng UniformRandomProvider preserving and mirroring its current state.
async
Link copied to clipboard
common
inline fun <T> MCScope.async(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, crossinline block: suspend MCScope.() -> T): Deferred<T>
Specialized async for MCScope.
chain
Link copied to clipboard
common
fun <R> RandomGenerator.chain(generator: suspend RandomGenerator.() -> R): RandomChain<R>
Create a generic random chain with provided generator
flow
Link copied to clipboard
common
fun <T, I, R> ComposableStatistic<T, I, R>.flow(flow: Flow<Buffer<T>>, dispatcher: CoroutineDispatcher = Dispatchers.Default): Flow<R>
Perform a streaming statistical analysis on a chunked data.
fromSource
Link copied to clipboard
fun RandomGenerator.Companion.fromSource(source: RandomSource, seed: Long? = null): RandomSourceGenerator
Returns RandomSourceGenerator with given RandomSource and seed.
launch
Link copied to clipboard
common
inline fun MCScope.launch(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, crossinline block: suspend MCScope.() -> Unit): Job
Specialized launch for MCScope.
mcScope
Link copied to clipboard
common
inline suspend fun <T> mcScope(seed: Long, block: MCScope.() -> T): T
Launch mc scope with a given seed
inline suspend fun <T> mcScope(generator: RandomGenerator, block: MCScope.() -> T): T
Launches a supervised Monte-Carlo scope
mersenneTwister
Link copied to clipboard
fun RandomGenerator.Companion.mersenneTwister(seed: Long? = null): RandomSourceGenerator
Returns RandomSourceGenerator with RandomSource.MT algorithm and given seed.
next
Link copied to clipboard
common
suspend fun <T : Any> Sampler<T>.next(generator: RandomGenerator): T
Samples one value from this Sampler.
sampleBuffer
Link copied to clipboard
common
@JvmName(name = sampleRealBuffer)
fun Sampler<Double>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Double>>
Generates size real samples and chunks them into some buffers.
@JvmName(name = sampleIntBuffer)
fun Sampler<Int>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Int>>
Generates size integer samples and chunks them into some buffers.
fun <T : Any> Sampler<T>.sampleBuffer(generator: RandomGenerator, size: Int, bufferFactory: BufferFactory<T> = Buffer.Companion::boxing): Chain<Buffer<T>>
Sample a bunch of values
uniform
Link copied to clipboard
common