Re: question for compiling a function
- To: mathgroup at smc.vnet.net
- Subject: [mg113137] Re: question for compiling a function
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Fri, 15 Oct 2010 13:49:46 -0400 (EDT)
- References: <201010140327.XAA06163@smc.vnet.net>
Hi Ramiro, For your particular example, you don't really need Compile. You can use the fact that Gamma is Listable: exampleAlt[n_, \[Alpha]_] := Gamma[Total[n] + \[Alpha]]/Times @@ Gamma[n + 1] Regards, Leonid On Wed, Oct 13, 2010 at 8:27 PM, Ramiro <ramiro.barrantes at gmail.com> wrote: > Hello, > > I am doing some MCMC on mathematica and performance is becoming an > issue. So the low hanging fruit would be compiling some functions. > Below is an portion of the key one: > > example[n_, \[Alpha]_] := > Gamma[Plus @@ n + \[Alpha]]/Times @@ (Gamma[# + 1] & /@ n) > > "n" is a vector of positive reals. However, I don't know how big it > is, it will usually be just 4 o 5 numbers but could be anything from 1 > to 200 size vector. > > Any suggestions? > > Thanks in advance, > Ramiro > >
- References:
- question for compiling a function
- From: Ramiro <ramiro.barrantes@gmail.com>
- question for compiling a function