One way to improve   m+/\.y   is to exploit the identity
   (m+/\.y) -: (+/y) -"_ _1 m+/\y

For example:
   m=: 3
   y=: 5000 3 [EMAIL PROTECTED] 100
   (m+/\.y) -: (+/y) -"_ _1 m+/\y
1

   ts=: 6!:2 , 7!:[EMAIL PROTECTED]
   ts 'm+/\.y'
0.57866 3.37773e7
   ts '(+/y) -"_ _1 m+/\y'
0.000440279 133184



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Wednesday, December 12, 2007 9:55
Subject: Re: [Jprogramming] 61 statements
To: Programming forum <[email protected]>

> > Calculating R took maybe an hour
> 
> This is almost certainly due to a performance bug in
> 1 f/\. y  and more basically in  f/\y  when y is 
> extended precision.  e.g.
> 
>    6!:2 '>./\ x' [ x=: 1000 [EMAIL PROTECTED] 1000x
> 0.311459
>    6!:2 '>./\ x' [ x=: 2000 [EMAIL PROTECTED] 1000x
> 1.35379
>    6!:2 '>./\ x' [ x=: 4000 [EMAIL PROTECTED] 1000x
> 6.72068
> 
> Similar timings for 1 >./\.x . These have been fixed for the 
> next J6.02 beta.
> 
> In comparison:
> 
>    6!:2 '>./\. x' [ x=: 1000 [EMAIL PROTECTED] 1000x
> 0.000956267
>    6!:2 '>./\. x' [ x=: 2000 [EMAIL PROTECTED] 1000x
> 0.00187817
>    6!:2 '>./\. x' [ x=: 4000 [EMAIL PROTECTED] 1000x
> 0.0050445
> 
> These should also have been the times for >./\x .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to