Mercurial > hg > octave-lyh
changeset 7113:a018c140f8aa
[project @ 2007-11-07 00:28:01 by dbateman]
author | dbateman |
---|---|
date | Wed, 07 Nov 2007 00:28:01 +0000 |
parents | f90a8188c9c2 |
children | a67d30883ee0 |
files | liboctave/ChangeLog liboctave/boolNDArray.cc liboctave/boolNDArray.h liboctave/intNDArray.cc liboctave/intNDArray.h |
diffstat | 5 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,11 @@ 2007-11-06 David Bateman <dbateman@free.fr> + * intNDArray.cc (intNDArray<T> intNDArray<T>::sum (int) const): + New method. + * intNDarray.h (intNDArray sum (int) const): Declare it. + * boolNDArray.cc (boolNDArray boolNDArray::sum (int) const): + New method. + * boolNDarray.cc (boolNDArray sum (int) const): Declare it. * MArray-def.h (MARRAY_NORM_BODY): Scale frobenius norm by infinity norm to avoid issues of over- and underflow. From Rolf Fabian <Rolf.Fabian@gmx.de>.
--- a/liboctave/boolNDArray.cc +++ b/liboctave/boolNDArray.cc @@ -57,6 +57,12 @@ MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false); } +boolNDArray +boolNDArray::sum (int dim) const +{ + MX_ND_REDUCTION (retval(result_idx) |= elem (iter_idx), true, boolNDArray); +} + boolNDArray boolNDArray::concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx) {
--- a/liboctave/boolNDArray.h +++ b/liboctave/boolNDArray.h @@ -66,6 +66,8 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; + boolNDArray sum (int dim = -1) const; + boolNDArray concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx); boolNDArray& insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c);
--- a/liboctave/intNDArray.cc +++ b/liboctave/intNDArray.cc @@ -222,6 +222,13 @@ return is; } +template <class T> +intNDArray<T> +intNDArray<T>::sum (int dim) const +{ + MX_ND_REDUCTION (retval(result_idx) += intNDArray<T>::elem (iter_idx), 0, intNDArray<T>); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***