Dan,

I believe you have analyzed the situation correctly, especially by
replacing part of my code with I. . Your abbreviation wPE solution
probably needs to deal with the left hand argument more explictly,
though. Thanks for your keen observations.

On Fri, May 27, 2011 at 6:02 PM, Dan Bron <[email protected]> wrote:
> Brian wrote:
>  [snip]  Actually, because +. is a fairly expensive operation, it
> may have exacerbated the performance issue (as opposed to, e.g., Roger's
> [0,1)-scaling mechanism which relies on the cheap + function).
>
> Here's a demonstration of the performance issue:
>
>           wP =: (([?@#+/@]){(;@((#~)</.]# ;@(i.@#)))@])
>
>           0 ": (%"1<./)ts&> '100 wP 5 3 4 2 * ' ,L:0 ] 10 <@":@^ 1+i.5
>           1    1
>           3    7
>          35   56
>         190  841
>        2346 6847
>
> BTW, without thinking about it too much, I believe your code is equivalent
> to  wPE =: (?@# +/) { I.@]   , or with your scaling mechanism as a
> preprocessor, wPES =: wPE (% +./) .
>
> -Dan
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to