Mercurial > hg > octave-lyh
changeset 10509:ddbd812d09aa
properly compress sparse matrices after assembly
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 12 Apr 2010 12:57:44 +0200 |
parents | 9a5e2d13fa5a |
children | 62ebba45054e |
files | liboctave/ChangeLog liboctave/Sparse.cc |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-04-12 Jaroslav Hajek <highegg@gmail.com> + + * Sparse.cc (Sparse<T>::Sparse (const Array<T>&, const idx_vector&, + const idx_vector&, ...)): Call maybe_compress after matrix is created. + 2010-04-09 Jaroslav Hajek <highegg@gmail.com> * Sparse.cc (Sparse<T>::diag): Change nzmax to nnz where appropriate.
--- 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); } }