# HG changeset patch # User David Bateman # Date 1382130825 -7200 # Node ID 8031fc73f2915a9d9d0ec8d2f93329b6596a5be7 # Parent cf43cc342bfa4a24df4d492a75ed5a61a1e04579 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. diff -r cf43cc342bfa -r 8031fc73f291 liboctave/array/dSparse.cc --- a/liboctave/array/dSparse.cc Fri Oct 18 13:56:56 2013 -0700 +++ b/liboctave/array/dSparse.cc Fri Oct 18 23:13:45 2013 +0200 @@ -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) {