Sure, ...

The , , ,: approach is cleaner than the > ; ; ; approach (and it's
generically useful both for symmetric numeric matrices and for
constructing constant matrices).

Meanwhile, the -: trick is clever and concise (but not generic).

Thanks,

-- 
Raul

On Wed, Oct 23, 2019 at 5:23 AM 'Mike Day' via Programming
<[email protected]> wrote:
>
> Or:
>
>    (+|:)-:0,3 0,4 3,:5 4 3 0
>
> ?
>
> This generalises the lean but ad hoc expression:
>    -:@(+|:)@:(|.@(,\.))@:({. 3+i.@-@<: ) 5. NB. eg for 5 x 5
>   0 1.5   2 2.5   3
> 1.5   0 1.5   2 2.5
>   2 1.5   0 1.5   2
> 2.5   2 1.5   0 1.5
>   3 2.5   2 1.5   0
> ... the 3+ bit could be generalised with a bit more work...
>
> Mike
> Sent from my iPad
>
> > On 23 Oct 2019, at 04:38, 'Jim Russell' via Programming 
> > <[email protected]> wrote:
> >
> >  D=: (+|:)>'';1.5;2 1.5;2.5 2 1.5 0
> ----------------------------------------------------------------------
> 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