Sorry, I figured it out:

I just needed one more 0...

   ]  S * (4 4 $  1 0 0 0 0)
4 0       0 0
0 3       0 0
0 0 2.23607 0
0 0       0 0

On Wed, Feb 26, 2014 at 10:02 PM, Joe Bogner <[email protected]> wrote:
> I'm experimenting with svd and am looking for a nicer way of creating
> a matrix from the S diagonal
>
> 4 3 2.23607 0
>
> needs to be
>
> ]   (4 4 $ 4 0 0 0 0 3 0 0 0 0 2.23607  0 0 0 0 0 )
> 4 0       0 0
> 0 3       0 0
> 0 0 2.23607 0
> 0 0       0 0
>
> What would be the idiomatic way to make that conversion? I tried
> various versions of reshape and insert.
>
> Not quite...
>
> ],\ S
> 4 0       0 0
> 4 3       0 0
> 4 3 2.23607 0
> 4 3 2.23607 0
>
> I also thought about multiplying it by a diagonal matrix of 0s and 1s
> but couldn't get that figured out either
>
> Thanks
> Joe
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to