# HG changeset patch # User Jaroslav Hajek # Date 1258701521 -3600 # Node ID 6f1ea8241c9902039b29ab2d031e1164ea969213 # Parent c0b54271904bd83e708d526a9ceb41e19700185b make isnumeric yield false on logicals diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Jaroslav Hajek + + * general/__isequal__.m: Check for isnumeric|islogical. + * testfun/assert.m: Ditto. + 2009-11-19 Jaroslav Hajek * specfun/perms.m: Avoid recursion. Simplify assignments. Allow empty diff --git a/scripts/general/__isequal__.m b/scripts/general/__isequal__.m --- a/scripts/general/__isequal__.m +++ b/scripts/general/__isequal__.m @@ -66,8 +66,8 @@ ## numeric values. t = (all (strcmp (class(x), cellfun (@class, varargin, "UniformOutput", false))) - || (isnumeric (x) - && all (cellfun (@isnumeric, varargin, "UniformOutput", true)))); + || ((isnumeric (x) || islogical (x)) + && all ((cellfun (@isnumeric, varargin) | cellfun (@islogical, varargin))))); if (t) ## Test that everything has the same number of dimensions. diff --git a/scripts/testfun/assert.m b/scripts/testfun/assert.m --- a/scripts/testfun/assert.m +++ b/scripts/testfun/assert.m @@ -65,7 +65,7 @@ in = cstrcat ("(", in, ")"); if (nargin == 1 || (nargin > 1 && islogical (cond) && ischar (varargin{1}))) - if (! isnumeric (cond) || ! all (cond(:))) + if ((! isnumeric (cond) && ! islogical (cond)) || ! all (cond(:))) if (nargin == 1) ## Say which elements failed? error ("assert %s failed", in); diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Jaroslav Hajek + + * ov-bool.h (octave_bool::is_numeric_type): New overload. + * ov-bool-mat.h (octave_bool-matrix::is_numeric_type): New overload. + 2009-11-19 Jaroslav Hajek * ov-base.h (unary_mapper_t): New member: umap_erfinv. diff --git a/src/ov-bool-mat.h b/src/ov-bool-mat.h --- a/src/ov-bool-mat.h +++ b/src/ov-bool-mat.h @@ -88,6 +88,8 @@ bool is_real_type (void) const { return true; } + bool is_numeric_type (void) const { return false; } + int8NDArray int8_array_value (void) const { return int8NDArray (matrix); } diff --git a/src/ov-bool.h b/src/ov-bool.h --- a/src/ov-bool.h +++ b/src/ov-bool.h @@ -83,6 +83,8 @@ bool is_real_type (void) const { return true; } + bool is_numeric_type (void) const { return false; } + bool is_true (void) const { return scalar; } int8NDArray