On Wed, 20 Jan 2016, Allin Cottrell wrote:
> Perhaps we should offer a prize for the first example of actual time-saving
> (and/or improvement in accuracy) in sending a calculation of the sort that
> might be required in gretl out to julia for computation.
Easy: just take Oleh's recursion example.
<hansl>
set echo off
set messages off
function scalar fib(scalar n)
return n<2 ? n : fib(n-1) + fib(n-2)
end function
set stopwatch
eval fib(30)
native = $stopwatch
foreign language=julia
function fib(n)
if n<2
return n
else
return fib(n-1)+fib(n-2)
end
end
println(fib(30))
end foreign
julia = $stopwatch
print native julia
</hansl>
<output>
832040
832040
native = 71.920384
julia = 4.4912745
</output>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel