Mercurial > hg > octave-lyh
changeset 6079:802aec2b1a2e
[project @ 2006-10-25 01:40:26 by jwe]
author | jwe |
---|---|
date | Wed, 25 Oct 2006 01:40:26 +0000 |
parents | 34b1758d3247 |
children | 40ab35ab651c |
files | liboctave/ChangeLog liboctave/Sparse.cc |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2006-10-24 David Bateman <dbateman@free.fr> + + * Sparse.cc (assign (Sparse<LT>&, const Sparse<RT>&)): Resize the + lhs at the point we know the assignment can succeed if the lhs is + empty. + 2006-10-23 John W. Eaton <jwe@octave.org> * Array.cc (assign2): Don't require vector assignments to be oriented.
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -2471,6 +2471,11 @@ Sparse<LT> stmp (new_nr, new_nc, new_nzmx); + // Started with an empty matrix. Now that we know + // the assignment will succeed, resize lhs + if (lhs_nr <= 0 || lhs_nc <= 0) + lhs = Sparse<RT>(n, m); + octave_idx_type jji = 0; octave_idx_type jj = idx_j.elem (jji); octave_idx_type kk = 0; @@ -2623,6 +2628,11 @@ Sparse<LT> stmp (new_nr, new_nc, new_nzmx); + // Started with an empty matrix. Now that we know + // the assignment will succeed, resize lhs + if (lhs_nr <= 0 || lhs_nc <= 0) + lhs = Sparse<RT>(n, m); + octave_idx_type jji = 0; octave_idx_type jj = idx_j.elem (jji); octave_idx_type kk = 0;