Dev #280

Merged
altavir merged 99 commits from dev into master 2021-04-16 19:45:55 +03:00
Showing only changes of commit 59b120e086 - Show all commits

View File

@ -6,6 +6,7 @@ import kscience.kmath.chains.collect
import kscience.kmath.structures.Buffer import kscience.kmath.structures.Buffer
import kscience.kmath.structures.BufferFactory import kscience.kmath.structures.BufferFactory
import kscience.kmath.structures.IntBuffer import kscience.kmath.structures.IntBuffer
import kotlin.jvm.JvmName
/** /**
* Sampler that generates chains of values of type [T]. * Sampler that generates chains of values of type [T].
@ -83,11 +84,13 @@ public suspend fun <T : Any> Sampler<T>.next(generator: RandomGenerator): T = sa
/** /**
* Generates [size] real samples and chunks them into some buffers. * Generates [size] real samples and chunks them into some buffers.
*/ */
@JvmName("sampleRealBuffer")
public fun Sampler<Double>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Double>> = public fun Sampler<Double>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Double>> =
sampleBuffer(generator, size, Buffer.Companion::real) sampleBuffer(generator, size, Buffer.Companion::real)
/** /**
* Generates [size] integer samples and chunks them into some buffers. * Generates [size] integer samples and chunks them into some buffers.
*/ */
@JvmName("sampleIntBuffer")
public fun Sampler<Int>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Int>> = public fun Sampler<Int>.sampleBuffer(generator: RandomGenerator, size: Int): Chain<Buffer<Int>> =
sampleBuffer(generator, size, ::IntBuffer) sampleBuffer(generator, size, ::IntBuffer)