....and there's always that rank thing. So for speeding up:
PB=: 4 : 0 "1
n=. x
'd os'=. y
'w pm m pr'=. d
t1=. w*pm
z=.i.0, #x
for_op. os do.
f=. m+pr*((*%+/@(n*w*((%*-.@:^@:-...@])m&+)@(pr*])))^:_ 2:)`...@.(<&2) op
b=. +/t1*n*^-spt*f
r=. (b<bp){ ( ({...@$ )rh),({ ~...@$ ) rl
z=. z, n=. r,}: n*^-f
end.
)
This one:
ts 'n PB 1e3 $ ,: da;option'
1.13673 2127744
The one hereafter:
ts 'n PB 1e3 $ ,: da;option'
1.381286 2127744
:
> By making the anonymous explicit function tacit the globals can be made
> local again.
>
> PB=: 4 : 0 "1
> ni=. x
> 'd os'=. y
> 'w pm m pr'=. d
> t1=. w*pm
> z=.i.0, #x
> for_op. os do.
> f=. m+pr*((*%+/@(ni*w*((%...@^@-...@])m&+)@(pr*])))^:_ 2:)`...@.(<&2) op
> b=. +/t1*ni*^-spt*f
> r=. (b<bp){ ( ({...@$ )rh),({ ~...@$ ) rl
> z=. z, ni=. r,}: ni*^-f
> end.
> )
>
> I also shortened long names. :-)
>
> Use: n PB 2 $ ,: da;option
>
>
>
>
>> Sorry, more globals needed inside PB:
>>
>> PB=: 4 : 0 "1
>> ni=: x
>> 'd os'=. y
>> 'w per_mat m pr' =: d
>> z=.i.0, #w
>> for_o. os do.
>> f=. m + pr * ( 4 : 'y * x % +/ w * (f % z) * ni * 1 - ^ - z=. m + f=.
>> pr * y'^:_ 2:)`...@.(<&2) o
>> b=. +/ per_mat * w * ni * ^ - spawn_t * f
>> r=. (b<breakpoint){ ( ({...@$ )recruit_h),({ ~...@$ ) recruit_l
>> z=. z, ni=: r,}: ni * ^ - f
>> end.
>> )
>>
>> I hope this will do. :-(
>>
>>
>>
>
--
Met vriendelijke groet,
=@@i
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm