DPopulation

class DPopulation(elements: DoubleArray, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null) : RandomIfc, SampleIfc, ParametersIfc, IdentityIfc

A DPopulation is a population of doubles that can be sampled from and permuted.

Author

rossetti

Parameters

elements

the elements to sample from

stream

the stream to use for sampling

name

the name of the population, optional

Constructors

Link copied to clipboard
constructor(elements: DoubleArray, stream: RNStreamIfc = KSLRandom.nextRNStream(), name: String? = null)

Properties

Link copied to clipboard

If true, the stream will automatically participate in having its stream advanced to the next sub-stream via stream managers

Link copied to clipboard
open override var antithetic: Boolean

Tells the stream to start producing antithetic variates

Link copied to clipboard

A copy of the elements of the original population of elements

Link copied to clipboard
open override val id: Int
Link copied to clipboard
open override var label: String?
Link copied to clipboard
open override val name: String
Link copied to clipboard

Creates a new array that contains a random permutation of the population

Link copied to clipboard

Returns a random index into the population (assuming elements numbered starting at zero)

Link copied to clipboard
open override var resetStartStreamOption: Boolean

If true, the stream will automatically participate in having its stream reset to its start stream via stream managers

Link copied to clipboard
open override var rnStream: RNStreamIfc

rnStream provides a reference to the underlying stream of random numbers

Link copied to clipboard
open val streamNumber: Int
Link copied to clipboard
open override val value: Double

Returns a randomly selected element from the population. All elements are equally likely.

Functions

Link copied to clipboard
open override fun advanceToNextSubStream()

Positions the RNG at the beginning of its next substream

Link copied to clipboard
Link copied to clipboard
operator fun get(index: Int): Double

Returns the value at the supplied index

Link copied to clipboard

Returns a new instance of the population with the same parameters but an independent generator

Returns a new instance of the random source with the same parameters but an independent generator

Link copied to clipboard
open override fun parameters(): DoubleArray
open override fun parameters(params: DoubleArray)
Link copied to clipboard
fun permute()

Causes the population to form a new permutation, The ordering of the elements in the population will be changed.

Link copied to clipboard
open override fun resetStartStream()

The resetStartStream method will position the RNG at the beginning of its stream. This is the same location in the stream as assigned when the RNG was created and initialized.

Link copied to clipboard
open override fun resetStartSubStream()

Resets the position of the RNG at the start of the current substream

Link copied to clipboard
open fun sample(sampleSize: Int): DoubleArray

Generates a random generated sample of the give size

open override fun sample(): Double
Link copied to clipboard
open fun sampleAsColumns(sampleSize: Int, nCols: Int = 1): Array<DoubleArray>

Generates the number of columns nCols with each column holding a random sample of size sampleSize

Link copied to clipboard
open fun sampleAsRows(sampleSize: Int, nRows: Int = 1): Array<DoubleArray>

Generates the number of rows nRows with each row holding a random sample of size sampleSize

Link copied to clipboard
open fun sampleInto(matrix: Array<DoubleArray>)

Fills the supplied matrix with randomly generated values

open fun sampleInto(values: DoubleArray)

Fills the supplied array with randomly generated values

Link copied to clipboard

Creates a new array that contains a randomly sampled values without replacement from the existing population.

Link copied to clipboard
operator fun set(index: Int, value: Double)

Sets the element at the supplied index to the supplied value

Link copied to clipboard
fun size(): Int

Returns the number of elements in the population

Link copied to clipboard
open fun sum(numInSum: Int): Double
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open fun useStreamNumber(streamNumber: Int)

Assigns the stream associated with the supplied number from the default RNStreamProvider

Link copied to clipboard
open override fun value(): Double

The randomly generated value. Each value will be different