The comparison is not really between i.~f and 
f{iota}f , because f i. f in J is equally as fast 
as i.~f .

The "secret" is that the dyad i. in J has a linear
expected time algorithm for floats even with 
non-zero tolerance.  I think Dyalog APL has a
quadratic time algorithm.  You can test this
by timing
   f {iota} f
where f{is}0.01{times}n{rho}1e6 for n in
1e3 * 1 2 4 8 16 32.  If the ratio from one time
to the next increases, then you've got a quadratic
(or worst) algorithm.  In J:

   tt=: 3 : '6!:2 ''f i.f '' [ f=. 0.01 * y [EMAIL PROTECTED] 1e6'
   2 %~/\ tt"0 ]1e3 * 1 2 4 8 16 32
1.95527 1.98379 1.99087 2.34902 2.02415



----- Original Message -----
From: [EMAIL PROTECTED]
Date: Friday, June 1, 2007 11:14 am
Subject: Re: [Jgeneral] Re: Challenge to expert J'ers

> RH> I suggest you try the benchmarks in
> RH> http://www.jsoftware.com/jwiki/Essays/Index_in_Nub
> RH> in APL.
> 
> I just did ( a simplified version) and there is definitively a 
> major 
> problem with the dyadic iota of Dyalog APL.
> These results points to either a "bug" in both interpreters or a 
> mystery...
> It seems to me that APL implementers of Dyalog would be best to 
> require 
> your services for dyadic iota for float...
> Here are the results (all tests done on my PC,  Dell OptiPlex 
> GX270, 
> Processor       x86 Family 15 Model 2 Stepping 9 GenuineIntel 
> ~2593 Mhz
> 
> i=:2e5$1e5?2e9
> f=:i%i+0.1
>                J       J 6.01  APL     Dyalog 10.0.2 
> Integer         .i~i    0.065   i{iota}i        0.109 
> Float           .i~f    2.826   f{iota}f        1402.875 
> 
> Can anyone confirm these results and add other APL implementations 
> if they 
> so have ?
> Roger ! How can we explain that huge difference between .i~f and 
> f{iota}f 
> ?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to