Mercurial > hg > octave-nkf
diff liboctave/Sparse.cc @ 10509:ddbd812d09aa
properly compress sparse matrices after assembly
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 12 Apr 2010 12:57:44 +0200 |
parents | bdf5d85cfc5e |
children | aac9f4265048 |
line wrap: on
line diff
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -329,7 +329,11 @@ { // This is completely specialized, because the sorts can be simplified. T a0 = a(0); - if (cl == 1) + if (a0 == T()) + { + // Do nothing, it's an empty matrix. + } + else if (cl == 1) { // Sparse column vector. Sort row indices. idx_vector rs = r.sorted (); @@ -516,6 +520,8 @@ rrd[k] = a(rdi[i]); } } + + maybe_compress (true); } else { @@ -606,6 +612,8 @@ } } } + + maybe_compress (true); } }