Mercurial > hg > octave-shane
changeset 6689:8e0444d90050
[project @ 2007-06-04 22:28:19 by dbateman]
author | dbateman |
---|---|
date | Mon, 04 Jun 2007 22:28:19 +0000 |
parents | b26a8e0e42cd |
children | fd242dccd221 |
files | liboctave/ChangeLog liboctave/Sparse.cc scripts/ChangeLog |
diffstat | 3 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2007-06-04 David Bateman <dbateman@free.fr> + + * Sparse.cc (Sparse<T> Sparse<T>::reshape): If length of new + dimensions is greater than 2, collapse to 2-D. + 2007-06-02 David Bateman <dbateman@free.fr> * SparseCmplxQR.cc: Changes to support CXSparse 2.2.0.
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -730,14 +730,22 @@ Sparse<T>::reshape (const dim_vector& new_dims) const { Sparse<T> retval; - - if (dimensions != new_dims) + dim_vector dims2 = new_dims; + + if (dims2.length () > 2) { - if (dimensions.numel () == new_dims.numel ()) + for (octave_idx_type i = 2; i < dims2.length(); i++) + dims2 (1) *= dims2(i); + dims2.resize (2); + } + + if (dimensions != dims2) + { + if (dimensions.numel () == dims2.numel ()) { octave_idx_type new_nnz = nnz (); - octave_idx_type new_nr = new_dims (0); - octave_idx_type new_nc = new_dims (1); + octave_idx_type new_nr = dims2 (0); + octave_idx_type new_nc = dims2 (1); octave_idx_type old_nr = rows (); octave_idx_type old_nc = cols (); retval = Sparse<T> (new_nr, new_nc, new_nnz);
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,17 +1,12 @@ -<<<<<<< ChangeLog -<<<<<<< ChangeLog 2007-06-03 Søren Hauberg <soren@hauberg.org> * plot/axes.m: Eliminate redundant else clause. -======= -======= 2007-06-03 David Bateman <dbateman@free.fr> * polynomial/spline.m: Add a small tolerance to spline tests. * pkg/pkg.m: Protect against multiple actions being define. ->>>>>>> 1.846 2007-06-01 David Bateman <dbateman@free.fr> * pkg.m (pkg:is_superuser): Remove function used in one place and @@ -19,7 +14,6 @@ (pkg:install): Check for existence of files to install before globbing and warn the user if they don't exist. ->>>>>>> 1.844 2007-05-31 David Bateman <dbateman@free.fr> * miscellaneous/copyfile.m: Split copying of multiple files to a