When I do image work I use RGB planes (shape 3 512 512 for example). u;.n is much faster on rank 2 than on higher ranks.

Henry Rich

On 6/1/2017 2:30 PM, robert therriault wrote:
Brian,

I thought that as well, but I just finished a slightly different approach where 
I went directly to the selection of the triples from the matrix. It looks more 
complicated but is at least twice as fast and a third of the space.

     trim1 =: >@(tess &(cp;._3))@:(<"1)
    100000 timespacex 'trim1 i. 7 10 3'
5.78836e_6 21632

     trimalt=: {~ <@:(>:@:(3 * i.)@:<.@:(%&3)&.>)@:}:@:$    NB. Hook with {~ 
the left tine
     100000 timespacex 'trimalt i. 7 10 3'
2.41935e_6 7040

6.17228e_6 21632

    (trim1-:trimh) i."1 _3[\ , >,&3 each {3&+@:i. each 15 ;15 NB. combinations 
from 3 3 3 to 15 15 3
1

For indices of less than 3 there is a difference in the shape produced, so 
watch out for that boundary.

     $ trimalt i. 2 2 3
0 0 3
    $ trim1 i. 2 2 3
0 0

Cheers, bob

On Jun 1, 2017, at 11:18 AM, Brian Schott <[email protected]> wrote:

That's very thorough and appears to suggest that no dramatic improvements
can be made
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


---
This email has been checked for viruses by AVG.
http://www.avg.com

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

Reply via email to