MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Compilation options question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115870] Re: Compilation options question
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Sun, 23 Jan 2011 05:37:13 -0500 (EST)
  • References: <ihbjs8$dhm$1@smc.vnet.net>

On Jan 21, 1:32 am, Ramiro <ramiro.barran... at gmail.com> wrote:
> [...]
> p.s. My main program is basically multiplying the function in question
> (exampleN) many many times, that's why I put multiply over the same
> call.
>
> In[170]:=
> example0 =
>   Compile[{{n, _Real, 1}, {a, _Real}, {b, _Real}, {t, _Real, 1}},
>    With[{tn = Total[n]},
>     b^a*Exp[LogGamma[
>         tn + a] - (Total[LogGamma[n + 1]] + LogGamma[a]) +
>        Total[n*Log[t]] - (tn + a)*Log[Total[t] + b]]]];
> Times @@ Table[
>    example0[{1, 1, 1, 1}, 1, 1, {3, 3, 3, 3}], {i,
>     10000}] // AbsoluteTiming
> [...]

Then why not change  b^a*Exp[...]  to  a*Log@b + ...,
add the results instead of multiplying them,
and exponentiate the sum?

Also, and independently, why not change  Total[n*Log[t]]  to  n.Log@t?


  • Prev by Date: Re: Plot works in Mathematca 7 but not in Mathematica 8
  • Next by Date: Re: complex output for real integral
  • Previous by thread: Re: Compilation options question
  • Next by thread: Re: Compilation options question