[Previous] [Up] [Next]

5. Function Simulator

A user-provided function Simulator computes L(Y). The syntax of the function is as follows:
double Simulator(mode,dim,ref,y,us_idata,us_rdata,h_idata)
int dim,mode,***us_idata.**h_idata;
double *y,***us_rdata,*ref;

Here mode determines the purpose for which the function is called, pointer y is used to receive from the function the state vector Y, given vector of parameters ref, dim is the dimension of Y, the user-handled pointers us_idata, us_rdata are used to supply the system-related data and pointer h_idata holds the information about distributions the state vector x comes from.

The function is initially (exactly once!) called with mode=0 ( setup call), and then is called with mode=1 (working calls). The setup call is used to allocate memory for us_idata and us_rdata and to load system-related data into this memory in order to be able to compute the performance in the subsequent working calls. The code is "transparent" for us_idata, us_rdata in the sense that the content of the memory domains pointed by us_idata, us_rdata is never updated by the code.

In the working call the function should return the performance of the system and a state vector Y at a given vector of parameters ref. Matrix h_idata is constructed as follows:

  • Line 0 consists of one element h_idata[0][0] which contains total number of distribution types in the input file (if two random elements of the state vector Y come from the same distribution but with different parameters, they are considered to be of different types!)
  • Line i, i=1,...,h_idata[0][0] contains 3 elements:
  • h_idata[i][0] is the number of identcally distributed entries in x coming from distribution type i.
  • h_idata[i][1] is an integer corresponding to each distribution (first column in Table 1)
  • h_idata[i][2] is a number of parameters in distribution type i
  • Table 2 describes the syntax of function parameters.

    Table 2. Function Simulator(mode,dim,x,us_idata,us_rdata)

    Call Parameter Input value Output value
    setup mode
    dim
    ref
    y
    us_idata
    us_rdata
    h_idata
    0
    undefined
    undefined
    undefined
    undefined
    undefined
    undefined
    0
    unchanged
    unchanged
    unchanged
    up to user
    up to user
    unchanged
    working mode
    dim
    ref
    y
    us_idata
    us_rdata
    h_idata
    1
    dimension of x
    vector of parameters
    undefined
    as created by user
    as created by user
    distribution-related data
    1
    unchanged
    unchanged
    Y
    up to user
    up to user
    unchanged


    [Previous] [Up] [Next]