I added the display step. I also modified the index in a, changed them from y to y-1 since J has zero as index origin.

I guess 99% of the time is spent in the r=: r,a step. /Erling


Den 2017-10-30 kl. 15:43, skrev Raul Miller:
Hmm... you're right, that deals with some cases quite a bit better than mine.

I can dip into most of them like this:

parRDM=:4 :0
   select. x
     case.1 do.
       ,.< i.y
     case.2 do.
       ((y#2)#:"1 0 }.i.2^y-1) </."1 i.y
     case.y do.
       ,:<"0 i.y
     case.do.
       x (1+y-x) P y
    end.
)

... keeping the definition of P (and combine) from
http://jsoftware.com/pipermail/programming/2017-October/049423.html

That said, parRuskey still is more efficient for the case where x =
y-2 and and y>3 and that's worth some thought.

Generally speaking, parRuskey has an advantage of working with
partition id rather than partition contents, until the very last step.
That's a clean performance advantage (no boxed arrays for most of the
work). But ... still needs thought.

Thanks,


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to