This is a multi-part message in MIME format. Hi,
I find PDL very useful in my work. Thanks!
I noticed that svd (Singular Value Decomposition) does not work properly
when there is only one row or one column in the input matrix. Attached
is a little wrapper "mysvd.pl" that I use to work around this bug.
When I say "does not work properly", what I mean is that it should
always be possible to reconstruct the input matrix from its SVD. That
is, given an input matrix $mat, we should be able to make an identical
matrix $matcopy from the SVD of $mat, as follows:
($u, $s_diag, $v) = svd($mat)
$s = zeroes($v)
$s->diagonal(0,1) .= $s_diag
$vt = transpose($v)
$matcopy = $u x $s x $vt
This assumes:
$mat = m rows x n columns
$u = m rows x n columns
$s_diag = n elements
$s = n rows x n columns
$v = n rows x n columns
With the current svd routine in PDL, $matcopy does not equal $mat when
there is only one row or column in $mat.
Best wishes,
Peter.
mysvd.pl
Description: Perl program
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|