mvnrnd

 

Description

Generates an array of random numbers from a multivariate Normal distribution, seeds and generator number passed explicitly

Syntax

int mvnrnd( double * v, uint n, int nDim, const double * pMean, const double * mCov )

Parameters

v
[output] Pointer to a double array, which contain the results
n
[input] The number of pseudo-random numbers to be generated. n>=1
nDim
[input] The number of dimensions, n, of the distribution
pMean
[input] The vector of means, a, of the distribution
mCov
[input] The covariance matrix of the distribution

Return

Return NE_NOERROR(0) on success, otherwise error.

Examples

EX1

void mvnrnd_ex1()
{
        int n = 10;
        vector v(n);
        matrix m(n, n);
        vector vm(n);
        for ( int ii = 0; ii < n; ii++ )
        {
                vm[ii] = rnd();
                for ( int jj = 0; jj < n; jj++ )
                        m[ii][jj] = rnd();
        }
        int nRet = mvnrnd(v, n, 2, vm, m);
        return;
}

Remark

See Also

binornd

header to Include

origin.h

Reference