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

The only advantage it might have would be for inserting non-zero rows or
columns.

The symmetry of inserting both the same row and column makes me wonder if
there's a more general, adverbial method to do both at once.
Experimentation showed me this:

   (0&,&.(4&|.)) (1 : 'u u"1 y')mat
 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

Which extends interestingly (though maybe not usefully):

   (0 99&,&.(4&|.)) (1 : 'u u"1 y')mat
 1  2  3  4 0 99  5
 6  7  8  9 0 99 10
11 12 13 14 0 99 15
16 17 18 19 0 99 20
 0 99  0  0 0  0  0
21 22 23 24 0 99 25

On Fri, Jan 9, 2009 at 4:47 PM, Raul Miller <[email protected]> wrote:

> On Fri, Jan 9, 2009 at 4:40 PM, Brian Schott <[email protected]>
> wrote:
> > I think this is more complete.
> >
> >   1 1 1 1j1 1 #"1]1 1 1 1j1 1 #>: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
>
> Yes, thank you, I did not read carefully enough.
>
> Or:
>   m=:1+i.5 5
>   b=:1 1 1 1 0 1
>   b #inv b#inv"1 m
>  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
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to