When your data has shape (3,r,c) you can use u;.3"2 to filter components
individually. Much faster than u;.n on a rank-3 array.
Henry Rich
On 6/1/2017 3:36 PM, Brian Schott wrote:
Henry,
I can't quite understand your comment.
I think you are saying that you transpose the RGB with 0 1&|: but I don't
know where to go with u;._3 from there because the RGB data arrives as
shape R C 3, I believe.
In light of Robs trimalt (see my comment about using the right tine as a
pre-process constant), I'm not even sure whether it is worth pursuing u;._3
any further for my case. But I am still interested in your observations.
Thanks,
On Thu, Jun 1, 2017 at 2:44 PM, Henry Rich <[email protected]> wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm