I can't follow what the verb is doing, but I tried it on some other
cases & it produced correct results.
Needless to say, a much faster version is needed. Even the little piece
excP,
which potentially runs the verb < on each atom, would be too slow.
Henry Rich
On 2/29/2016 5:36 PM, Brian Schott wrote:
I have a non iterative script which seems to work on the test sample.
Can you tell me if it works more generally, please?
H =: 99 NB. can be any large value, like 1e6
L =: _1
D =: H, H, 1, H, 5, H, 8, H, 11, L, L, H, H, 20,3
P =: 1, 1, 1, 2, 4, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2
excP =: (1,L=])<;._1 L,[ NB. exclude L from left arg: P
excD =: (1,L=])<;._1 L,] NB. exclude L from right arg: D
lineup =: -@#{.!.H every]
e =: each each
P( (L~:]) #inv!.L (<"0 each@excD) ;@:(<./@lineup@:(<@(([,+)every))each)
(+/\e)@(}.e)@(<\.each)@excP) D
On Fri, Feb 26, 2016 at 5:19 AM, Henry Rich <[email protected]> wrote:
No.
The first atom of the array might potentially affect the result in the
last atom.
I need a method that takes at most a couple of dozen machine instructions
per atom. Any method that starts a verb on each atom of the array is too
slow.
Henry Rich
On 2/25/2016 10:35 PM, Brian Schott wrote:
Does your really fast algorithm start with something like my mask, but
instead of a while. loop on the whole array, do you just check to update
the indices one above each altered atom of the revised D?
On Wed, Feb 24, 2016 at 11:43 AM, Henry Rich <[email protected]>
wrote:
That looks like the right result.
Henry Rich
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm