NEURON
nrnran123.h File Reference
#include <cstdint>

Go to the source code of this file.

Classes

struct  nrnran123_array4x32
 

Functions

void nrnran123_set_globalindex (std::uint32_t gix)
 
std::uint32_t nrnran123_get_globalindex ()
 
nrnran123_Statenrnran123_newstream (std::uint32_t id1, std::uint32_t id2=0, std::uint32_t id3=0)
 Construct a new Random123 stream based on the philox4x32 generator. More...
 
nrnran123_Statenrnran123_newstream3 (std::uint32_t id1, std::uint32_t id2, std::uint32_t id3)
 
nrnran123_Statenrnran123_newstream ()
 Construct a new Random123 stream based on the philox4x32 generator. More...
 
void nrnran123_deletestream (nrnran123_State *s)
 Destroys the given Random123 stream. More...
 
void nrnran123_getseq (nrnran123_State *s, std::uint32_t *seq, char *which)
 Get sequence number and selector from an nrnran123_State object. More...
 
void nrnran123_setseq (nrnran123_State *s, std::uint32_t seq, char which)
 Set a Random123 sequence for a sequnece ID and which selector. More...
 
void nrnran123_setseq (nrnran123_State *s, double seq4which)
 Set a Random123 sequence for a sequnece ID and which selector. More...
 
void nrnran123_getids (nrnran123_State *s, std::uint32_t *id1, std::uint32_t *id2)
 Get stream IDs from Random123 State object. More...
 
void nrnran123_getids (nrnran123_State *s, std::uint32_t *id1, std::uint32_t *id2, std::uint32_t *id3)
 Get stream IDs from Random123 State object. More...
 
void nrnran123_getids3 (nrnran123_State *, std::uint32_t *id1, std::uint32_t *id2, std::uint32_t *id3)
 
void nrnran123_setids (nrnran123_State *, std::uint32_t id1, std::uint32_t id2, std::uint32_t id3)
 
std::uint32_t nrnran123_ipick (nrnran123_State *)
 
double nrnran123_dblpick (nrnran123_State *)
 
double nrnran123_negexp (nrnran123_State *)
 
double nrnran123_negexp (nrnran123_State *, double mean)
 
double nrnran123_normal (nrnran123_State *)
 
double nrnran123_normal (nrnran123_State *, double mean, double std)
 
double nrnran123_uniform (nrnran123_State *)
 
double nrnran123_uniform (nrnran123_State *, double min, double max)
 
nrnran123_array4x32 nrnran123_iran (std::uint32_t seq, std::uint32_t id1, std::uint32_t id2=0, std::uint32_t id3=0)
 
nrnran123_array4x32 nrnran123_iran3 (std::uint32_t seq, std::uint32_t id1, std::uint32_t id2, std::uint32_t id3)
 

Function Documentation

◆ nrnran123_dblpick()

double nrnran123_dblpick ( nrnran123_State s)

Definition at line 122 of file nrnran123.cpp.

◆ nrnran123_deletestream()

void nrnran123_deletestream ( nrnran123_State s)

Destroys the given Random123 stream.

Definition at line 46 of file nrnran123.cpp.

◆ nrnran123_get_globalindex()

std::uint32_t nrnran123_get_globalindex ( )

Definition at line 22 of file nrnran123.cpp.

◆ nrnran123_getids() [1/2]

void nrnran123_getids ( nrnran123_State s,
std::uint32_t *  id1,
std::uint32_t *  id2 
)

Get stream IDs from Random123 State object.

Definition at line 82 of file nrnran123.cpp.

◆ nrnran123_getids() [2/2]

void nrnran123_getids ( nrnran123_State s,
std::uint32_t *  id1,
std::uint32_t *  id2,
std::uint32_t *  id3 
)

Get stream IDs from Random123 State object.

Definition at line 87 of file nrnran123.cpp.

◆ nrnran123_getids3()

void nrnran123_getids3 ( nrnran123_State s,
std::uint32_t *  id1,
std::uint32_t *  id2,
std::uint32_t *  id3 
)

Deprecated, use nrnran123_getids

Definition at line 97 of file nrnran123.cpp.

◆ nrnran123_getseq()

void nrnran123_getseq ( nrnran123_State s,
std::uint32_t *  seq,
char *  which 
)

Get sequence number and selector from an nrnran123_State object.

Definition at line 50 of file nrnran123.cpp.

◆ nrnran123_ipick()

std::uint32_t nrnran123_ipick ( nrnran123_State s)

Definition at line 110 of file nrnran123.cpp.

◆ nrnran123_iran()

nrnran123_array4x32 nrnran123_iran ( std::uint32_t  seq,
std::uint32_t  id1,
std::uint32_t  id2 = 0,
std::uint32_t  id3 = 0 
)

◆ nrnran123_iran3()

nrnran123_array4x32 nrnran123_iran3 ( std::uint32_t  seq,
std::uint32_t  id1,
std::uint32_t  id2,
std::uint32_t  id3 
)

Deprecated, use nrnran123_iran

Definition at line 171 of file nrnran123.cpp.

◆ nrnran123_negexp() [1/2]

double nrnran123_negexp ( nrnran123_State s)

Definition at line 141 of file nrnran123.cpp.

◆ nrnran123_negexp() [2/2]

double nrnran123_negexp ( nrnran123_State s,
double  mean 
)

Definition at line 136 of file nrnran123.cpp.

◆ nrnran123_newstream() [1/2]

nrnran123_State* nrnran123_newstream ( )

Construct a new Random123 stream based on the philox4x32 generator.

Note
This overload constructs each stream instance as an independent stream. Independence is derived by using id1=1, id2=nrnmpi_myid, id3 = ++internal_static_uint32_initialized_to_0

Definition at line 31 of file nrnran123.cpp.

◆ nrnran123_newstream() [2/2]

nrnran123_State* nrnran123_newstream ( std::uint32_t  id1,
std::uint32_t  id2 = 0,
std::uint32_t  id3 = 0 
)

Construct a new Random123 stream based on the philox4x32 generator.

Parameters
id1stream ID
id2optional defaults to 0
id3optional defaults to 0
Returns
an nrnran123_State object representing this stream

Definition at line 37 of file nrnran123.cpp.

◆ nrnran123_newstream3()

nrnran123_State* nrnran123_newstream3 ( std::uint32_t  id1,
std::uint32_t  id2,
std::uint32_t  id3 
)
Deprecated:
use nrnran123_newstream instead

Definition at line 27 of file nrnran123.cpp.

◆ nrnran123_normal() [1/2]

double nrnran123_normal ( nrnran123_State s)

Definition at line 148 of file nrnran123.cpp.

◆ nrnran123_normal() [2/2]

double nrnran123_normal ( nrnran123_State s,
double  mean,
double  std 
)

Definition at line 164 of file nrnran123.cpp.

◆ nrnran123_set_globalindex()

void nrnran123_set_globalindex ( std::uint32_t  gix)

Definition at line 17 of file nrnran123.cpp.

◆ nrnran123_setids()

void nrnran123_setids ( nrnran123_State s,
std::uint32_t  id1,
std::uint32_t  id2,
std::uint32_t  id3 
)

Definition at line 104 of file nrnran123.cpp.

◆ nrnran123_setseq() [1/2]

void nrnran123_setseq ( nrnran123_State s,
double  seq4which 
)

Set a Random123 sequence for a sequnece ID and which selector.

This overload encodes the sequence ID and which in one double. This is done specifically to be able to expose the Random123 API in HOC, which only supports real numbers.

Parameters
san Random123 state object
seq4whichencodes both seq and which as seq*4+which

Set a Random123 sequence for a sequnece ID and which selector.

Definition at line 68 of file nrnran123.cpp.

◆ nrnran123_setseq() [2/2]

void nrnran123_setseq ( nrnran123_State s,
std::uint32_t  seq,
char  which 
)

Set a Random123 sequence for a sequnece ID and which selector.

Parameters
san Random123 state object
seqthe sequence ID for which to initialize the random number sequence
whichthe selector (0 <= which < 4) of the sequence

Definition at line 55 of file nrnran123.cpp.

◆ nrnran123_uniform() [1/2]

double nrnran123_uniform ( nrnran123_State s)

Definition at line 128 of file nrnran123.cpp.

◆ nrnran123_uniform() [2/2]

double nrnran123_uniform ( nrnran123_State s,
double  min,
double  max 
)

Definition at line 132 of file nrnran123.cpp.