Mercurial > hg > octave-nkf
comparison liboctave/boolNDArray.cc @ 10152:b6b65e71049b
optimize cumsum with logicals
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 20 Jan 2010 21:14:52 +0100 |
parents | 26abff55f6fe |
children | 4c0cdbe0acca |
comparison
equal
deleted
inserted
replaced
10151:c2f1cdb59821 | 10152:b6b65e71049b |
---|---|
70 } | 70 } |
71 | 71 |
72 NDArray | 72 NDArray |
73 boolNDArray::sum (int dim) const | 73 boolNDArray::sum (int dim) const |
74 { | 74 { |
75 // NOTE: going via octave_idx_type is faster even though it requires a conversion. | 75 // NOTE: going via octave_idx_type is typically faster even though it |
76 // requires a conversion. | |
76 return do_mx_red_op<Array<octave_idx_type> , bool> (*this, dim, mx_inline_count); | 77 return do_mx_red_op<Array<octave_idx_type> , bool> (*this, dim, mx_inline_count); |
77 } | 78 } |
78 | 79 |
79 NDArray | 80 NDArray |
80 boolNDArray::cumsum (int dim) const | 81 boolNDArray::cumsum (int dim) const |
81 { | 82 { |
82 // NOTE: going via octave_idx_type is faster even though it requires a conversion. | 83 // In this case, it's better to sum directly to doubles. |
83 return do_mx_cum_op<Array<octave_idx_type> , bool> (*this, dim, mx_inline_cumcount); | 84 return do_mx_cum_op<NDArray , bool> (*this, dim, mx_inline_cumcount); |
84 } | 85 } |
85 | 86 |
86 boolNDArray | 87 boolNDArray |
87 boolNDArray::concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx) | 88 boolNDArray::concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx) |
88 { | 89 { |