Mercurial > hg > octave-nkf
changeset 17688:8031fc73f291
Remove zeros from sparse matrices after use of real/imag (bug # 40305)
* dSparse.CC (SparseMatrix real (const SparseComplexMatrix&),
SparseMatrix imag (const SparseComplexMatrix&)) : Use maybe_compress to
remove zeros from the return matrix.
author | David Bateman <dbateman@free.fr> |
---|---|
date | Fri, 18 Oct 2013 23:13:45 +0200 |
parents | cf43cc342bfa |
children | dd8db3f1c1da |
files | liboctave/array/dSparse.cc |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/array/dSparse.cc +++ b/liboctave/array/dSparse.cc @@ -653,6 +653,7 @@ r.ridx (i) = a.ridx (i); } + r.maybe_compress (true); return r; } @@ -673,9 +674,17 @@ r.ridx (i) = a.ridx (i); } + r.maybe_compress (true); return r; } +/* + +%!assert(nnz(real(sparse([1i,1]))),1) +%!assert(nnz(real(sparse([1i,1]))),1) + +*/ + SparseMatrix atan2 (const double& x, const SparseMatrix& y) {