Mercurial > hg > octave-lyh
diff liboctave/boolNDArray.cc @ 8756:d0755c9db5ed
implement fast logical sum (counting)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 16 Feb 2009 12:41:55 +0100 |
parents | 1bd918cfb6e2 |
children | b756ce0002db |
line wrap: on
line diff
--- a/liboctave/boolNDArray.cc +++ b/liboctave/boolNDArray.cc @@ -57,10 +57,11 @@ return do_mx_red_op<boolNDArray> (*this, dim, mx_inline_any); } -boolNDArray +NDArray boolNDArray::sum (int dim) const { - MX_ND_REDUCTION (retval(result_idx) |= elem (iter_idx), true, boolNDArray); + // NOTE: going via octave_idx_type is faster even though it requires a conversion. + return do_mx_red_op<Array<octave_idx_type> > (*this, dim, mx_inline_count); } boolNDArray