Next: , Up: User Supplied Generators


DRANDINITIALIZEUSER / SRANDINITIALIZEUSER

Registers a user supplied base generator so that it can be used with the ACML distributional generators.

(Note that SRANDINITIALIZEUSER is the single precision version of DRANDINITIALIZEUSER. The argument lists of both routines are identical except that any double precision arguments of DRANDINITIALIZEUSER are replaced in SRANDINITIALIZEUSER by single precision arguments - type REAL in FORTRAN or type float in C).

— SUBROUTINE: DRANDINITIALIZEUSER (UINI,UGEN,GENID,SUBID,SEED,LSEED, STATE,LSTATE,INFO)
— Input: SUBROUTINE UINI

On input: routine that will be used to initialize the user supplied generator, UGEN.

— Input: SUBROUTINE UGEN

On input: user supplied base generator.

— Input: INTEGER GENID

On input: parameter is passed directly to UINI. Its function therefore depends on that routine.

— Input: INTEGER SUBID

On input: parameter is passed directly to UINI. Its function therefore depends on that routine.

— Input: INTEGER SEED(LSEED)

On input: parameter is passed directly to UINI. Its function therefore depends on that routine.

— Input/Output: INTEGER LSEED

On input: length of the vector SEED. This parameter is passed directly to UINI and therefore its required value depends on that routine.
On output: whether LSEED changes will depend on UINI.

— Output: INTEGER STATE(LSTATE)

On output: the state vector required by all of the supplied distributional generators. The value of STATE returned by UINI has some housekeeping elements appended to the end before being returned by DRANDINITIALIZEUSER. See User Supplied Generators for details about the form of STATE.

— Input/Output: INTEGER LSTATE

On input: length of the vector STATE. This parameter is passed directly to UINI and therefore its required value depends on that routine.
On output: whether LSTATE changes will depend on UINI. If LSTATE<=0 then it is assumed that a request for the required length of STATE has been made. The value of LSTATE returned from UINI is therefore adjusted to allow for housekeeping elements to be added to the end of the STATE vector. This results in the value of LSTATE returned by DRANDINITIALIZEUSER being 3 larger than that returned by UINI.

— Output: INTEGER INFO

On output: INFO is an error indicator. DRANDINITIALIZEUSER will return a value of -6 if the value of LSTATE is between 1 and 3. Otherwise INFO is passed directly back from UINI. It is recommended that the value of INFO returned by UINI is kept consistent with the rest of the ACML, that is if INFO = -i on exit, the i-th argument had an illegal value. If INFO =1 on exit, then either, or both of LSEED and / or LSTATE have been set to the required length for vectors SEED and STATE respectively and the STATE vector has not have been initialized. If INFO = 0 then the state vector, STATE, has been successfully initialized.

     Example:
     

          C     Generate 100 values from the Uniform distribution using
          C     a user supplied base generator
                INTEGER LSTATE,N
                PARAMETER (LSTATE=16,N=100)
                INTEGER I,INFO,NSKIP,SEED(1),STATE(LSTATE)
                INTEGER X(N)
                DOUBLE PRECISION A,B
          
          C     Set the seed
                SEED(1) = 1234
          
          C     Set the distributional parameters
                A = 0.0D0
                B = 1.0D0
          
          C     Initialize the base generator. Here ACMLRNGNB0GND is a user
          C     supplied generator and ACMLRNGNB0INI its initializer
                CALL DRANDINITIALIZEUSER(ACMLRNGNB0INI,ACMLRNGNB0GND,1,0,SEED,
               *    LSEED,STATE,LSTATE,INFO)
          
          C     Generate N variates from the Univariate distribution
                CALL DRANDUNIFORM(N,A,B,STATE,X,LDX,INFO)
          
          C     Print the results
                WRITE(6,*) (X(I),I=1,N)