Mercurial > hg > octave-nkf
changeset 1627:8f798f963805
[project @ 1995-11-13 14:37:05 by jwe]
author | jwe |
---|---|
date | Mon, 13 Nov 1995 14:37:10 +0000 |
parents | 90bbeec37a0e |
children | 40fe8e7c4ee9 |
files | liboctave/CDiagMatrix.cc liboctave/dDiagMatrix.cc |
diffstat | 2 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CDiagMatrix.cc +++ b/liboctave/CDiagMatrix.cc @@ -404,7 +404,7 @@ retval.elem (i, i) = 1.0 / elem (i, i); } - return *this; + return retval; } // diagonal matrix by diagonal matrix -> diagonal matrix operations
--- a/liboctave/dDiagMatrix.cc +++ b/liboctave/dDiagMatrix.cc @@ -286,23 +286,21 @@ return DiagMatrix (); } + DiagMatrix retval (nr, nc); + info = 0; - double *tmp_data = dup (data (), len); for (int i = 0; i < len; i++) { if (elem (i, i) == 0.0) { info = -1; - copy (tmp_data, data (), len); // Restore contents. - break; + return *this; } else - { - tmp_data[i] = 1.0 / elem (i, i); - } + retval.elem (i, i) = 1.0 / elem (i, i); } - return DiagMatrix (tmp_data, nr, nc); + return retval; } // diagonal matrix by diagonal matrix -> diagonal matrix operations