On Thursday, March 20, 2014 8:26:56 AM UTC-4, Paweł Biernat wrote:
>
> # implementation via recursive definition of laguerre polynomials
> function laguerrel_recursive(n::Integer, alpha::Number, x::Number)
> l0 = 1 # L_{0}
> l1 = 1+alpha-x # L_{1}
>
This is not type-stable, because you are initializing e.g. l0 to an
integer, but it turns into a floating-point number in your loop. Changing
this to:
l1 = float(1+alpha-x) # L_{1}
l0 = one(l1) # L_{0}
makes @elapsed [laguerrel_recursive(n,1,n) for n=1:1000] three times faster
on my machine.