Devon McCormick wrote:
> 
> This is not as direct as the solutions using expansion with a complex
> expander but it's one of those things I thought of and it worked the first
> time just as I'd conceived it: concatenation under rotation:
> 
>    0,&.(4&|."1)0,&.(4&|.)>:i.5 5
>  1  2  3  4 0  5
>  6  7  8  9 0 10
> 11 12 13 14 0 15
> 16 17 18 19 0 20
>  0  0  0  0 0  0
> 21 22 23 24 0 25
> [...]
> 
It can be done as follows:

ins0=:(&|.)((|:@(0&,)^:2)&.)

   4 4 ins0 >:i.5 5
 1  2  3  4 0  5
 6  7  8  9 0 10
11 12 13 14 0 15
16 17 18 19 0 20
 0  0  0  0 0  0
21 22 23 24 0 25

   2 1 ins0 >:i.5 5
 1 0  2  3  4  5
 6 0  7  8  9 10
 0 0  0  0  0  0
11 0 12 13 14 15
16 0 17 18 19 20
21 0 22 23 24 25

ins0=:(&|.)((|:@(0&,)^:2)&.)



-- 
View this message in context: 
http://www.nabble.com/Matrix-spread-tp21380244s24193p21383760.html
Sent from the J Programming mailing list archive at Nabble.com.

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

Reply via email to