# HG changeset patch # User jwe # Date 1161740426 0 # Node ID 802aec2b1a2e8deca281f08e56268a492886479e # Parent 34b1758d3247b72c5be9cbf5c2e5e63510339c86 [project @ 2006-10-25 01:40:26 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2006-10-24 David Bateman + + * Sparse.cc (assign (Sparse&, const Sparse&)): Resize the + lhs at the point we know the assignment can succeed if the lhs is + empty. + 2006-10-23 John W. Eaton * Array.cc (assign2): Don't require vector assignments to be oriented. diff --git a/liboctave/Sparse.cc b/liboctave/Sparse.cc --- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -2471,6 +2471,11 @@ Sparse 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(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 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(n, m); + octave_idx_type jji = 0; octave_idx_type jj = idx_j.elem (jji); octave_idx_type kk = 0;