jburkardt

NORMAL_DATASET\ Generate Multivariate Normal Random Datasets {#normal_dataset-generate-multivariate-normal-random-datasets align=”center”} ============================================


NORMAL_DATASET is a C++ program which creates a multivariate normal random dataset and writes it to a file.

The multivariate normal distribution for the M dimensional vector X has the form:

        pdf(X) = (2*pi*det(A))**(-M/2) * exp(-0.5*(X-MU)'*inverse(A)*(X-MU))

where MU is the mean vector, and A is a positive definite symmetric matrix called the variance-covariance matrix.

To create X, an MxN matrix containing N samples from this distribution, it is only necessary to

  1. create an MxN vector Y, each of whose elements is a sample of the 1-dimensional normal distribution with mean 0 and variance 1;
  2. determine the upper triangular Cholesky factor R of the matrix A, so that A = R’ * R;
  3. compute X = MU + R’ * Y.

Usage: {#usage align=”center”}

normal_dataset m n seed mu a

where

The data is written to the file normal_m_n.txt.

Licensing: {#licensing align=”center”}

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages: {#languages align=”center”}

NORMAL_DATASET is available in a C++ version and a FORTRAN90 version and a MATLAB version.

CVT_DATASET, a C++ program which computes a Centroidal Voronoi Tessellation and writes it to a file.

FAURE_DATASET, a C++ program which creates a Faure quasirandom dataset;

GRID_DATASET, a C++ program which creates a grid sequence and writes it to a file.

HALTON_DATASET, a C++ program which creates a Halton sequence and writes it to a file.

HAMMERSLEY_DATASET, a C++ program which creates a Hammersley sequence and writes it to a file.

HEX_GRID_DATASET, a C++ program which creates a hexagonal grid dataset and writes it to a file.

IHS_DATASET, a C++ program which creates an improved distributed Latin hypercube dataset and writes it to a file.

LATIN_CENTER_DATASET, a C++ program which creates a Latin Center Hypercube dataset;

LATIN_EDGE_DATASET, a C++ program which creates a Latin Edge Hypercube dataset;

LATIN_RANDOM_DATASET, a C++ program which creates a Latin Random Hypercube dataset;

LCVT_DATASET, a C++ program which computes a latinized Centroidal Voronoi Tessellation and writes it to a file.

NIEDERREITER2_DATASET, a C++ program which creates a Niederreiter quasirandom dataset with base 2;

NORMAL, a C++ library which computes normally distributed pseudorandom values.

SOBOL_DATASET, a C++ program which computes a Sobol quasirandom sequence and writes it to a file.

UNIFORM_DATASET, a C++ program which generates a dataset of uniform pseudorandom values and writes them to a file.

VAN_DER_CORPUT_DATASET, a C++ program which creates a van der Corput quasirandom sequence and writes it to a file.

Reference: {#reference align=”center”}

  1. Paul Bratley, Bennett Fox, Linus Schrage,\ A Guide to Simulation,\ Springer Verlag, pages 201-202, 1983.
  2. Donald Knuth,\ The Art of Computer Programming,\ Volume 2: Seminumerical Algorithms,\ Addison Wesley, 1969.

Source Code: {#source-code align=”center”}

Examples: {#examples align=”center”}

normal_2_1000.txt, is the file created in response to the command

          "normal_dataset 2 1000 123456789 1 2 1 0 0 3".
        
      
    

    
      List of Routines:
    

    
      
        
          MAIN is the main program for NORMAL_DATASET.
        
        
          I4_MAX returns the maximum of two I4's.
        
        
          I4_MIN returns the minimum of two I4's.
        
        
          MULTINORMAL_SAMPLE samples a multivariate normal distribution.
        
        
          R8_UNIFORM_01 returns a unit pseudorandom R8.
        
        
          R8MAT_PRINT prints an R8MAT.
        
        
          R8MAT_PRINT_SOME prints some of an R8MAT.
        
        
          R8MAT_WRITE writes an R8MAT file with no header.
        
        
          R8PO_FA factors a R8PO matrix.
        
        
          R8VEC_NORMAL_01_NEW returns a unit pseudonormal R8VEC.
        
        
          R8VEC_PRINT prints an R8VEC.
        
        
          R8VEC_UNIFORM_01_NEW returns a new unit pseudorandom R8VEC.
        
        
          TIMESTAMP prints the current YMDHMS date as a time stamp.
        
      
    

    
      You can go up one level to 
      the C++ source codes.
    

    

    
      Last revised on 09 December 2009.