Given that the shapes returned by the SVD are already conformable for matrix
multiplication, do you really need to get "M" involved at all?
You can just multiply the result "s" simply like this:
>mp&.>/s
Be aware that this multiplies in the order "a mp (b mp c)" where 'a b c'=.
s.
On 1/15/08, Yoel Jacobsen <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I want to implement matrix approximation using SVD.
> The SVD algorithm returns three boxed matrices of the shapes x x ; x y ;
> y y
> I want to chop and multiply back:
> Step 1: reshape as - x M; M M ; M y where M is a small value
> Step 2: Unbox and multiply (x M * M M * M y => x y)
>
> My current implementation is:
>
> s =. dgesvd ...
> a =. M {. "1 (> 0 { s)
> b =. M {. "1 (M {. (> 1 { s))
> c =. M {. (> 2 { s)
>
> mp =: +/ . *
> approximated =. a mp b mp c
>
> Now this is 1) ugly (for me) and 2) slow as hell.
>
> Suggestions?
>
> Thanks,
> Yoel
> ----------------------------------------------------------------------
> 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