NAME

rnd_gen - create unit that generates a random vector

PROTOTYPE

unitptr rnd_gen( int n, int mode, unitptr host)

ARGUMENTS

int n
dimensionality of generated random vector
int mode
mode parameter selecting probability distribution from which random vector is drawn
unitptr host
host unit for newly created instance

RETURN VALUE:

unitptr u
pointer to newly created unit

INTERFACE OF CREATED UNIT:

X_in[n]:
(input field 0) lower limit (modes 1,5,6) or average (modes 2,3,4).
Y_in[n]:
(input field 1) upper limit (modes 1,5,6) or standard deviation (modes 2,3,4). Present, but ignored in mode 5.
Z_in[n]:
(input field 2) probability vector (used only in modes 5,6)
CTL_in[0]:
(input field 3) control input.
X_out[n]:
(output field 0) generated random vec- tor.

EXECUTION OF CREATED UNIT:

If CTL_in[0]>0, a new random vector is generated (available at X_out[]. Otherwise, the exec_unit-call remains without effect. The random vector is drawn from a probability dis- tribution that is selected by the value of the mode- parameter. Currently, the following possibilities exist:
mode = 1:
uniform distribution, limits for X_out[i] are [X_in[i],Y_in[i]].
mode = 2:
uniform distribution with means X_in[i], standard deviations Y_in[i].
mode = 3:
gaussian distribution with means X_in[i], standard deviations Y_in[i].
mode = 4:
uniform spherical distribution centered at X_in, i.e. ||X_out[]-X_in[]||=1.
mode = 5:
discrete distribution from binary set {X_in,Y_in}, Z_in[i] = Probability for X_out[i]=Y_in[i].
mode = 6:
discrete distribution, Y_out[i]=1 at a single pin i, all other Y_out[j]=0. Z_in[i]= probability that pin i is chosen.

DESCRIPTION:

Creates a unit execution of which creates a random vector available at X_out and drawn from a probability distribution selected by mode. Uses drand48 to generate random numbers, i.e. a new seed can be set by calling srand48(). The creation of a new random vector is suppressed (i.e. the old output values will be retained), if the value at CTL[0]=<0. In this way, a rnd_gen-unit created with mode=6 and the output of which is connected to the CTL-inputs of a number of other rnd_gen's can be used to select one out these generators for the generation of the next random vector. In this way, several distributions can be superimposed with specified probabilities. A negative value for n creates X_out as a packed field of ABS(n) pins.

EXAMPLES:

The program rndgen illustrates the use of the rnd_gen -unit.

FILE:

nst_math

FILE

/amnt/loge/users/nistaff02/nistaff/rhaschke/nst7/man/../o.linux//../foldersrc/nst_math.c