Random Normal deviates within compiled function?
- To: mathgroup at smc.vnet.net
- Subject: [mg62282] Random Normal deviates within compiled function?
- From: Gareth Russell <russell at njit.edu>
- Date: Sat, 19 Nov 2005 05:54:02 -0500 (EST)
- Organization: New Jersey Institute of Technology
- Sender: owner-wri-mathgroup at wolfram.com
I have a function which needs to be quick as it's used in simulations,
and it requires the internal generation of a large vector of random
normal deviates (up to 50,000). It appears that a function like
Random[NormalDistribution[0,s]] cannot be compiled. Can anyone suggest
an algorithm for getting such numbers that would work within a Compile
statement and still be quicker than using the non-compiled function?
The non-compiled function would look as follows:
f[v_,r_,k_,s_,q_]:=Select[v*Exp[r*(1 - v/k) +
Length[v]]], # > q &]
where v is a vector of 50,000 reals, and r, k, s and q are scalar reals.
(If anyone is interested, this is for population projection in
population viability analysis.)
Prev by Date:
Hardcopy or electronic books?
Next by Date:
Re: Re: Types in Mathematica
Previous by thread:
Re: Hardcopy or electronic books?
Next by thread:
Mathematica Personal Grid Edition