# HG changeset patch # User Rik # Date 1373405979 25200 # Node ID a7b2fc7fe1a9a1861c43bb924fdd5785c40408d0 # Parent 48f5b993b819266d61d08164553834fc07d6f991 binocdf.m: Reverse calling convention to betaincinv to preserve accuracy when p =~ 1. * scripts/statistics/distributions/binocdf.m: Reverse calling convention to betaincinv to preserve accuracy when p =~ 1. diff -r 48f5b993b819 -r a7b2fc7fe1a9 doc/interpreter/expr.txi --- a/doc/interpreter/expr.txi Tue Jul 09 14:16:35 2013 -0700 +++ b/doc/interpreter/expr.txi Tue Jul 09 14:39:39 2013 -0700 @@ -796,7 +796,7 @@ @DOCSTRING(isequal) -@DOCSTRING(isequalwithequalnans) +@DOCSTRING(isequaln) @opindex <= @DOCSTRING(le) diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/deprecated/isequalwithequalnans.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/isequalwithequalnans.m Tue Jul 09 14:39:39 2013 -0700 @@ -0,0 +1,50 @@ +## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} isequalwithequalnans (@var{x1}, @var{x2}, @dots{}) +## This function has been deprecated. Use @code{@file{isequaln}} instead. +## @seealso{isequaln} +## @end deftypefn + +## Deprecated in 3.8 + +function retval = isequalwithequalnans (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "isequalwithequalnans is obsolete and will be removed from a future version of Octave, please use isequaln instead"); + endif + + retval = isequaln (varargin{:}); + +endfunction + + +## test for equality +%!assert (isequalwithequalnans ({1,2,NaN,4},{1,2,NaN,4}), true) +%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,NaN,4]), true) +## test for inequality +%!assert (isequalwithequalnans ([1,2,NaN,4],[1,NaN,3,4]), false) +%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,3,4]), false) +## test for equality (struct) +%!assert (isequalwithequalnans (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true) +%!assert (isequalwithequalnans (1,2,1), false) + diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/deprecated/module.mk --- a/scripts/deprecated/module.mk Tue Jul 09 14:16:35 2013 -0700 +++ b/scripts/deprecated/module.mk Tue Jul 09 14:39:39 2013 -0700 @@ -9,6 +9,7 @@ deprecated/java_debug.m \ deprecated/error_text.m \ deprecated/gen_doc_cache.m \ + deprecated/isequalwithequalnans.m \ deprecated/isstr.m \ deprecated/java_convert_matrix.m \ deprecated/java_get.m \ diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/general/isequal.m --- a/scripts/general/isequal.m Tue Jul 09 14:16:35 2013 -0700 +++ b/scripts/general/isequal.m Tue Jul 09 14:39:39 2013 -0700 @@ -19,7 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} isequal (@var{x1}, @var{x2}, @dots{}) ## Return true if all of @var{x1}, @var{x2}, @dots{} are equal. -## @seealso{isequalwithequalnans} +## @seealso{isequaln} ## @end deftypefn function retval = isequal (x1, varargin) @@ -74,3 +74,7 @@ ## test for inequality (struct) %!assert (isequal (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), false) +## Input validation +%!error isequal () +%!error isequal (1) + diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/general/isequaln.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/general/isequaln.m Tue Jul 09 14:39:39 2013 -0700 @@ -0,0 +1,50 @@ +## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} isequaln (@var{x1}, @var{x2}, @dots{}) +## Return true if all of @var{x1}, @var{x2}, @dots{} are equal under the +## additional assumption that NaN == NaN (no comparison of NaN placeholders +## in dataset). +## @seealso{isequal} +## @end deftypefn + +function retval = isequaln (x1, varargin) + + if (nargin < 2) + print_usage (); + endif + + retval = __isequal__ (true, x1, varargin{:}); + +endfunction + + +## test for equality +%!assert (isequaln ({1,2,NaN,4},{1,2,NaN,4}), true) +%!assert (isequaln ([1,2,NaN,4],[1,2,NaN,4]), true) +## test for inequality +%!assert (isequaln ([1,2,NaN,4],[1,NaN,3,4]), false) +%!assert (isequaln ([1,2,NaN,4],[1,2,3,4]), false) +## test for equality (struct) +%!assert (isequaln (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true) +%!assert (isequaln (1,2,1), false) + +## Input validation +%!error isequaln () +%!error isequaln (1) diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/general/isequalwithequalnans.m --- a/scripts/general/isequalwithequalnans.m Tue Jul 09 14:16:35 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -## Copyright (C) 2005-2012 William Poetra Yoga Hadisoeseno -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## . - -## -*- texinfo -*- -## @deftypefn {Function File} {} isequalwithequalnans (@var{x1}, @var{x2}, @dots{}) -## Assuming NaN == NaN, return true if all of @var{x1}, @var{x2}, @dots{} -## are equal. -## @seealso{isequal} -## @end deftypefn - -function retval = isequalwithequalnans (x1, varargin) - - if (nargin < 2) - print_usage (); - endif - - retval = __isequal__ (true, x1, varargin{:}); - -endfunction - - -## test for equality -%!assert (isequalwithequalnans ({1,2,NaN,4},{1,2,NaN,4}), true) -%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,NaN,4]), true) -## test for inequality -%!assert (isequalwithequalnans ([1,2,NaN,4],[1,NaN,3,4]), false) -%!assert (isequalwithequalnans ([1,2,NaN,4],[1,2,3,4]), false) -## test for equality (struct) -%!assert (isequalwithequalnans (struct ('a',NaN,'b',2),struct ('a',NaN,'b',2),struct ('a',NaN,'b',2)), true) -%!assert (isequalwithequalnans (1,2,1), false) - diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/general/module.mk --- a/scripts/general/module.mk Tue Jul 09 14:16:35 2013 -0700 +++ b/scripts/general/module.mk Tue Jul 09 14:39:39 2013 -0700 @@ -46,7 +46,7 @@ general/iscolumn.m \ general/isdir.m \ general/isequal.m \ - general/isequalwithequalnans.m \ + general/isequaln.m \ general/isrow.m \ general/isscalar.m \ general/issquare.m \ diff -r 48f5b993b819 -r a7b2fc7fe1a9 scripts/statistics/distributions/binocdf.m --- a/scripts/statistics/distributions/binocdf.m Tue Jul 09 14:16:35 2013 -0700 +++ b/scripts/statistics/distributions/binocdf.m Tue Jul 09 14:39:39 2013 -0700 @@ -60,9 +60,9 @@ k = (x >= 0) & (x < n) & (n == fix (n)) & (p >= 0) & (p <= 1); tmp = floor (x(k)); if (isscalar (n) && isscalar (p)) - cdf(k) = 1 - betainc (p, tmp + 1, n - tmp); + cdf(k) = betainc (1 - p, n - tmp, tmp + 1); else - cdf(k) = 1 - betainc (p(k), tmp + 1, n(k) - tmp); + cdf(k) = betainc (1 .- p(k), n(k) - tmp, tmp + 1); endif endfunction