Mercurial > hg > octave-nkf
changeset 5056:9379d8716407
[project @ 2004-10-22 14:58:05 by jwe]
author | jwe |
---|---|
date | Fri, 22 Oct 2004 14:58:50 +0000 |
parents | 51a4406317e9 |
children | 3bc00c1098e1 |
files | src/ChangeLog src/DLD-FUNCTIONS/filter.cc |
diffstat | 2 files changed, 22 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2004-10-22 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/filter.cc: Remove some unnecessary parens. + +2004-10-22 David Bateman <dbateman@free.fr> + + * DLD-FUNCTIONS/filter.cc (filter (MArray<T>&, MArray<T>&, + MArrayN<T>&, MArrayN<T>&, int)): If value to filter is + dimensionality 2 it might still be a vector, use special case. + 2004-10-21 John W. Eaton <jwe@octave.org> * ov-base.cc (INT_CONV_METHOD): Apply saturation semantics here too.
--- a/src/DLD-FUNCTIONS/filter.cc +++ b/src/DLD-FUNCTIONS/filter.cc @@ -71,7 +71,7 @@ } dim_vector x_dims = x.dims (); - if ((dim < 0) || (dim > x_dims.length ())) + if (dim < 0 || dim > x_dims.length ()) { error ("filter: filtering over invalid dimension"); return y; @@ -88,14 +88,13 @@ return y; } - if (si_dims.length() == 1) + if (si_dims.length () == 1) { - // Special case as x_dims.length() might be 2, but be a vector - if (x_dims.length() > 2 || - (x_dims.length () == 2 && ((x_dims(0) != 1 || - x_dims(1) != si_dims(0)) && - (x_dims(1) != 1 || - x_dims(0) != si_dims(0))))) + // Special case as x_dims.length () might be 2, but be a vector. + if (x_dims.length () > 2 + || (x_dims.length () == 2 + && (x_dims(0) != 1 || x_dims(1) != si_dims(0)) + && (x_dims(1) != 1 || x_dims(0) != si_dims(0)))) { error ("filter: dimensionality of si and x must agree"); return y; @@ -129,7 +128,7 @@ b = b / norm; } - if ((a_len <= 1) && (si_len <= 0)) + if (a_len <= 1 && si_len <= 0) return b(0) * x; y.resize (x_dims, 0.0); @@ -229,7 +228,7 @@ if (dim < 0) { // Find first non-singleton dimension - while ((dim < x_dims.length()) && (x_dims (dim) <= 1)) + while (dim < x_dims.length () && x_dims (dim) <= 1) dim++; // All dimensions singleton, pick first dimension @@ -382,7 +381,7 @@ { // Find first non-singleton dimension dim = 0; - while ((dim < x_dims.length()) && (x_dims (dim) <= 1)) + while (dim < x_dims.length () && x_dims (dim) <= 1) dim++; // All dimensions singleton, pick first dimension @@ -423,7 +422,7 @@ dim_vector si_dims = args (3).dims (); bool si_is_vector = true; for (int i=0; i < si_dims.length (); i++) - if ((si_dims (i) != 1) && (si_dims (i) < si_dims.numel ())) + if (si_dims (i) != 1 && si_dims (i) < si_dims.numel ()) { si_is_vector = false; break; @@ -481,7 +480,7 @@ dim_vector si_dims = args (3).dims (); bool si_is_vector = true; for (int i=0; i < si_dims.length (); i++) - if ((si_dims (i) != 1) && (si_dims (i) < si_dims.numel ())) + if (si_dims (i) != 1 && si_dims (i) < si_dims.numel ()) { si_is_vector = false; break;