Thanks Raul,

Nothing much to understand, really.
I liked the simplicity of your suggestion:
  (0 2 |: _2 ]\ ]) i. 6 3

So I thought that if I just reshape my 2M x N matrix into an M x 2 x N
then I can apply your idea!
Which is all my reshape2s verb does, i.e. reshape a 2N x into an M x 2 X N
I am sure that there are more elegant, J-like ways to do it, but hey, it
works.

(I am still studying the other suggestions)

Regards
AG


On 21 November 2012 23:38, Raul Miller <[email protected]> wrote:

> I do not understand the question, but here's something that operates on i.
> 6 3:
>
>    (0 2 |: _2 ]\ ]) i. 6 3
>
> Note that this is almost identical to Roger Hui's suggestion.
>
> --
> Raul
>
> On Wed, Nov 21, 2012 at 1:12 PM, Alex Giannakopoulos
> <[email protected]> wrote:
> > Well, I'm having a bit of trouble getting my head around "key", I'll keep
> > at it though...
> > However I was inspired by Raul's solution to come up with something that
> > worked and I understood.
> > Well, sort of understood anyway, why does the evenoddrows verb not need
> to
> > be (0 2 |: @ reshape2s) ?
> >
> >    reshape2s =. ;$~(2%~0{$),2,1{$
> >    evenoddrows =. 0 2 |: reshape2s
> >    evenoddrows i. 8 4
> >  0  1  2  3
> >  8  9 10 11
> > 16 17 18 19
> > 24 25 26 27
> >
> >  4  5  6  7
> > 12 13 14 15
> > 20 21 22 23
> > 28 29 30 31
> >
> > Hope that's not too inefficient
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to