Well... I did get as far as doing basic timings:
tim=:2 :0
:
u ratetime v"0
)
ratetime=:2 :0
u NB. force x and y to be verb args
:
try.
assert. x<:y
tV=.6!:2 'rV=. x v y'
tU=.6!:2 'rU=. x u y'
tU%tV
catch.
rV=.rU=.0
_
end.
assert. rV -:&(/:~)&:(/:~"1)&:(/:~&.>) rU
)
9!:11]2 NB. shrink precision to be more social
G=:parRDM tim mdconst
(1+i.10) G table 1+i.10
┌──┬─────────────────────────────────────────────────┐
│G │ 1 2 3 4 5 6 7 8 9 10│
├──┼─────────────────────────────────────────────────┤
│ 1│0.58 0.8 1 0.67 1 0.67 1.5 0.67 1.5 0.67│
│ 2│ _ 2.7 0.15 0.14 0.22 0.21 0.29 0.23 0.42 0.45│
│ 3│ _ _ 0.83 1 1.3 1.3 0.72 1.1 1.1 0.99│
│ 4│ _ _ _ 0.8 0.85 1.2 1.2 1 1.2 1.2│
│ 5│ _ _ _ _ 0.89 0.74 0.93 1.1 1.2 1│
│ 6│ _ _ _ _ _ 0.9 0.53 0.59 0.73 0.83│
│ 7│ _ _ _ _ _ _ 0.91 0.33 0.27 0.53│
│ 8│ _ _ _ _ _ _ _ 0.83 0.17 0.16│
│ 9│ _ _ _ _ _ _ _ _ 0.78 0.082│
│10│ _ _ _ _ _ _ _ _ _ 0.75│
└──┴─────────────────────────────────────────────────┘
(Beware proportionally spaced fonts: they are messy...)
parRDM from http://jsoftware.com/pipermail/programming/2017-October/049451.html
mdconst from http://jsoftware.com/pipermail/programming/2017-October/049453.html
I did sort of like the idea of pre-computing partition sizes and
building up from there, But I have not deeply studied your code yet.
(It is on my todo list, though...)
Thanks,
--
Raul
On Tue, Oct 31, 2017 at 10:33 AM, 'Mike Day' via Programming
<[email protected]> wrote:
> Well done! I too was trying to see how to remove the recursion,
>
> without success.
>
> Have you considered the (trivial) modification, to rename "r" as "a",
>
> and "a" as something else, to allow easier comparison with your verb?
>
>
> BTW, I'd be interested to see reactions to my offering of a "constructive"
>
> approach, sent some time yesterday. I've complicated it somewhat in
>
> slightly reducing the amount of redundancy necessitating filtering out
>
> unsuitable rows, but won't trouble the forum with those changes yet,
>
> if ever.
>
>
> Also, apologies to you and Lippu Esa for getting your names wrong. My
>
> lame excuse is that I was sending messages from iPad, re work on a laptop.
>
>
> Mike
>
>
> On 31/10/2017 09:23, Erling Hellenäs wrote:
>>
>> parRuskey =: 4 : 0
>> r=. (i.y) S (x-1);y-1
>> r </."1 i.y
>> )
>>
>> S =: 4 : 0
>> 'k n' =. y
>> a=.x
>> r=. (0,_1{.$a)$0
>> if. k=n do.
>> r=.a
>> else.
>> for_i. i.k+1 do.
>> r=.r, (i n } a) S k;n-1
>> end.
>> if. k > 0 do.
>> r=.r, (k n } a) S (k-1);n-1
>> end.
>> end.
>> r
>> )
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm