Mercurial > hg > octave-lojdl
changeset 10152:b6b65e71049b
optimize cumsum with logicals
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 20 Jan 2010 21:14:52 +0100 |
parents | c2f1cdb59821 |
children | 2c28f9d0360f |
files | liboctave/ChangeLog liboctave/boolNDArray.cc |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-01-20 Jaroslav Hajek <highegg@gmail.com> + + * boolNDArray.cc (boolNDArray::cumsum): Sum directly in double to + avoid a copy. + 2010-01-20 John W. Eaton <jwe@octave.org> * dim-vector.h: Style fixes. Remove Emacs local variables block.
--- a/liboctave/boolNDArray.cc +++ b/liboctave/boolNDArray.cc @@ -72,15 +72,16 @@ NDArray boolNDArray::sum (int dim) const { - // NOTE: going via octave_idx_type is faster even though it requires a conversion. + // NOTE: going via octave_idx_type is typically faster even though it + // requires a conversion. return do_mx_red_op<Array<octave_idx_type> , bool> (*this, dim, mx_inline_count); } NDArray boolNDArray::cumsum (int dim) const { - // NOTE: going via octave_idx_type is faster even though it requires a conversion. - return do_mx_cum_op<Array<octave_idx_type> , bool> (*this, dim, mx_inline_cumcount); + // In this case, it's better to sum directly to doubles. + return do_mx_cum_op<NDArray , bool> (*this, dim, mx_inline_cumcount); } boolNDArray