Draws

class telescopic.kernels.Draws(streams, lanes)

Random numbers for a set of chains: row i of every request belongs to chain i.

Kernels receive a Draws and call it once per random quantity they need per step; every request returns one row per chain. In a run, each row reads the streams of its replicate. Draws are made by the engine, or by telescopic.testing.fixed_draws() and telescopic.testing.random_draws() in tests.

child(row)

A new child of the generator of a row’s stream, which does not move that stream.

Each call spawns the next child. In a run, the children of a replicate’s generator follow the two that serve its normals and uniforms, so they never repeat them.

Parameters:
rowint

The row, in [0, n).

Returns:
numpy.random.Generator

draws.generator(row).spawn(1)[0]; NumPy raises TypeError for a generator built without a seed sequence, which cannot spawn.

generator(row)

The generator of a row’s stream, for draws that the buffers do not cover.

Parameters:
rowint

The row, in [0, n).

Returns:
numpy.random.Generator
log_uniform()

Logarithms of uniform draws on [0, 1), one per row; -inf for a draw of 0.

Returns:
ndarray, shape (n,)
normal(size)

Standard normal draws, size per row.

Parameters:
sizeint

Draws per row.

Returns:
ndarray, shape (n, size)
subset(rows)

The draws of some rows of this set; they share the rows’ streams.

Parameters:
rowsarray_like of int

The rows, in [0, n); row i of the result is row rows[i] of this set.

Returns:
Draws
uniform()

Uniform draws on [0, 1), one per row.

Returns:
ndarray, shape (n,)