MRANDOMN#
Name#
MRANDOMN
Purpose#
Draws random deviates from a multivariate normal distribution with zero mean and given covariance matrix.
Calling Sequence#
rand_val = mrandomn(seed, covar [, nrand = , /error_check, status=status])
Inputs#
seedanyThe random number generator seed, the default is IDL’s default in
randomn().covarint, float, or double array(N, N)The covariance matrix of the multivariate normal distribution.
Optional Inputs#
nrandint, float, or double scalarThe number of randomn deviates to draw for each parameter,
N. (Default =1)error_checkflagIf set, all inputs are checked for errors. Otherwise, all inputs are assumed to be of correct format.
Output#
rand_valdouble array(nrand, N)The random deviates.
Optional Output#
statusint scalarStatus of the Cholesky decomposition. If
status = 0then the computation was successful. Ifstatus > 0then the input covariance matrix is not positive definite (seeLA_CHOLDC.pro), andrand_val = NaN. If not requested for output, then an error message will be printed ifstatus > 0.
Modification History#
2004/09/01: Created (Brandon C. Kelly)
2013/10/01: Use
LA_CHOLDCinstead ofCHOLDCto enable use ofSTATUSkeyword. (W. Landsman)2021/09/01: If
statuskeyword is supplied then no error message will be printed, and the function returns-1. (Erik B. Monson)2021/03/21: Made
nrandan actual optional input (Keith Doore)2021/03/21: Updated documentation (Keith Doore)
2021/03/21: Updated error handling (Keith Doore)
2021/04/07: Removed seed error handling and updated
nranderror handling (Keith Doore)2022/05/17: Added
error_checkkeyword to do error handling (Keith Doore)2022/06/24: Made
rand_val = NaNif Cholesky decomposition failed (Keith Doore)2022/06/24: Fixed issue of
npcreation being inside oferror_check(Keith Doore)