Mercurial > hg > octave-lojdl
changeset 10431:5dd7a7bf4950
simplify sparse->full conversions in liboctave
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 22 Mar 2010 12:05:33 +0100 |
parents | f1567b3e1108 |
children | 10207338603a |
files | liboctave/CSparse.cc liboctave/ChangeLog liboctave/dSparse.cc |
diffstat | 3 files changed, 7 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CSparse.cc +++ b/liboctave/CSparse.cc @@ -634,15 +634,7 @@ ComplexMatrix SparseComplexMatrix::matrix_value (void) const { - octave_idx_type nr = rows (); - octave_idx_type nc = cols (); - ComplexMatrix retval (nr, nc, Complex (0.0, 0.0)); - - for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) - retval.elem (ridx(i), j) = data (i); - - return retval; + return Sparse<Complex>::array_value (); } SparseComplexMatrix
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-03-22 Jaroslav Hajek <highegg@gmail.com> + + * dSparse.cc (SparseMatrix::matrix_value): Simplify. + * CSparse.cc (SparseComplexMatrix::matrix_value): Simplify. + 2010-03-19 Jaroslav Hajek <highegg@gmail.com> * Array-util.cc (gripe_invalid_resize): Move here from Array.cc.
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -7554,15 +7554,7 @@ Matrix SparseMatrix::matrix_value (void) const { - octave_idx_type nr = rows (); - octave_idx_type nc = cols (); - - Matrix retval (nr, nc, 0.0); - for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) - retval.elem (ridx(i), j) = data (i); - - return retval; + return Sparse<double>::array_value (); } std::ostream&