Henry,
I can now see how a slight improvement on D++/\\.P can accomplish the
desired result,
but can you say if even that much is too slow.
If that is not two slow, then my next question is this:
The +/\\.P constructs a square matrix with incrementally more 0 fills on
each row. I want the fills to be on the front of each row instead of at the
end of each row and I want the fills to be H instead of 0. With enough time
I think I can answer the matrix question, but would rather know first if
the whole approach is fast enough. If not, maybe you could give another
hint?
Btw, I have already determined that the following approach can finesse the
excP and excD and a level of boxing, but I suppose "faster" (below) is
slow, also.
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
lineup =: -@#{.!.H every]
faster =: ] (<./@lineup@:(<@(([,+)every))) (+/\each)@(}.each)@(<\.) @ [
hfl=:(H"_)`(L I.@:=])`[} NB. H from L
lfl=:(L"_)`(L I.@:=])`[} NB. L from L
P (] lfl~ hfl faster ]hfl ]) D
On Mon, Feb 29, 2016 at 9:32 PM, Henry Rich <[email protected]> wrote:
> 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
>
>
>
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm