Mercurial > hg > octave-lyh
diff liboctave/CMatrix.cc @ 1549:d1fe5918e16b
[project @ 1995-10-08 00:11:52 by jwe]
author | jwe |
---|---|
date | Sun, 08 Oct 1995 00:11:52 +0000 |
parents | 9f9131a8d706 |
children | ffee86c37931 |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -817,6 +817,8 @@ ComplexMatrix ComplexMatrix::pseudo_inverse (double tol) { + ComplexMatrix retval; + ComplexSVD result (*this); DiagMatrix S = result.singular_values (); @@ -841,14 +843,16 @@ r--; if (r < 0) - return ComplexMatrix (nc, nr, 0.0); + retval = ComplexMatrix (nc, nr, 0.0); else { ComplexMatrix Ur = U.extract (0, 0, nr-1, r); DiagMatrix D = DiagMatrix (sigma.extract (0, r)) . inverse (); ComplexMatrix Vr = V.extract (0, 0, nc-1, r); - return Vr * D * Ur.hermitian (); + retval = Vr * D * Ur.hermitian (); } + + return retval; } ComplexMatrix