nag_return_multi_normal (g05ezc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_return_multi_normal (g05ezc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_return_multi_normal (g05ezc) generates a pseudorandom multivariate Normal vector taken from a distribution described by a reference vector set up by nag_ref_vec_multi_normal (g05eac).

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_return_multi_normal (double z[], double *r)

3  Description

nag_return_multi_normal (g05ezc) is designed for use in conjunction with nag_ref_vec_multi_normal (g05eac). The description of nag_ref_vec_multi_normal (g05eac) should be referred to for a specification of the operation of these two functions.

4  References

Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin
Knuth D E (1981) The Art of Computer Programming (Volume 2) (2nd Edition) Addison–Wesley

5  Arguments

1:     z[n]doubleOutput
where n  is the number of dimensions of the distribution as supplied to nag_ref_vec_multi_normal (g05eac).
On exit: the pseudorandom multivariate Normal vector.
2:     rdouble *Input
On entry: the reference vector to which memory has been allocated as set up by nag_ref_vec_multi_normal (g05eac). To free this memory the macro NAG_FREE should be added in your program after the final call to nag_return_multi_normal (g05ezc).

6  Error Indicators and Warnings

None.

7  Accuracy

The accuracy is discussed in the document for nag_ref_vec_multi_normal (g05eac).

8  Further Comments

The time taken by nag_return_multi_normal (g05ezc) is of the order
a + b × n + c × n 2
where a  and b  are appreciably (say 10-20 times) larger than c .

9  Example

The example program prints five pseudorandom observations from a bivariate Normal distribution with means vector
1.0 2.0
and covariance matrix
2.0 1.0 1.0 3.0 ,
generated by nag_ref_vec_multi_normal (g05eac) and nag_return_multi_normal (g05ezc) after initialization by nag_random_init_repeatable (g05cbc).

9.1  Program Text

Program Text (g05ezce.c)

9.2  Program Data

None.

9.3  Program Results

Program Results (g05ezce.r)


nag_return_multi_normal (g05ezc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012