# HG changeset patch # User jwe # Date 1028876203 0 # Node ID 8cb8eff3f44c5a5dafc61a6f3a98d3f391a34881 # Parent cfb762dc92595fb31c7b6cd06105dc8e9a9e9bed [project @ 2002-08-09 06:54:46 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2002-08-09 John W. Eaton + + * general/isscalar.m: Rename from is_scalar.m. + * general/issquare.m: Rename from is_square.m. + * general/issymmetric.m: Rename from is_symmetric.m. + * general/isvector.m: Rename from is_vector.m. + 2002-08-05 John W. Eaton * statistics/base/mean.m: Allow empty matrices. diff --git a/scripts/deprecated/is_scalar.m b/scripts/deprecated/is_scalar.m new file mode 100644 --- /dev/null +++ b/scripts/deprecated/is_scalar.m @@ -0,0 +1,31 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} is_scalar (@var{a}) +## This function has been deprecated. Use isscalar instead. +## @end deftypefn + +## Author: jwe + +function retval = is_scalar (varargin) + + retval = isscalar (varargin{:}); + +endfunction diff --git a/scripts/deprecated/is_square.m b/scripts/deprecated/is_square.m new file mode 100644 --- /dev/null +++ b/scripts/deprecated/is_square.m @@ -0,0 +1,31 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} is_square (@var{x}) +## This function has been deprecated. Use issquare instead. +## @end deftypefn + +## Author: jwe + +function retval = is_square (varargin) + + retval = issquare (varargin{:}); + +endfunction diff --git a/scripts/deprecated/is_symmetric.m b/scripts/deprecated/is_symmetric.m new file mode 100644 --- /dev/null +++ b/scripts/deprecated/is_symmetric.m @@ -0,0 +1,31 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} issymmetric (@var{x}, @var{tol}) +## This function has been deprecated. Use issymmetric instead. +## @end deftypefn + +## Author: jwe + +function retval = is_symmetric (varargin) + + retval = issymmetric (varargin{:}); + +endfunction diff --git a/scripts/deprecated/is_vector.m b/scripts/deprecated/is_vector.m new file mode 100644 --- /dev/null +++ b/scripts/deprecated/is_vector.m @@ -0,0 +1,31 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} is_vector (@var{a}) +## This function has been deprecated. Use isvector instead. +## @end deftypefn + +## Author: jwe + +function retval = is_vector (varargin) + + retval = isvector (varargin{:}); + +endfunction diff --git a/scripts/general/is_scalar.m b/scripts/general/is_scalar.m deleted file mode 100644 --- a/scripts/general/is_scalar.m +++ /dev/null @@ -1,41 +0,0 @@ -## Copyright (C) 1996, 1997 John W. Eaton -## -## 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 2, 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, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} is_scalar (@var{a}) -## Return 1 if @var{a} is a scalar. Otherwise, return 0. -## @end deftypefn -## @seealso{size, rows, columns, length, is_scalar, and is_matrix} - -## Author: jwe - -function retval = is_scalar (x) - - retval = 0; - - if (nargin == 1) - if (is_matrix (x)) - [nr, nc] = size (x); - retval = (nr == 1 && nc == 1); - endif - else - usage ("is_scalar (x)"); - endif - -endfunction diff --git a/scripts/general/is_square.m b/scripts/general/is_square.m deleted file mode 100644 --- a/scripts/general/is_square.m +++ /dev/null @@ -1,46 +0,0 @@ -## Copyright (C) 1996, 1997 John W. Eaton -## -## 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 2, 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, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} is_square (@var{x}) -## If @var{x} is a square matrix, then return the dimension of @var{x}. -## Otherwise, return 0. -## @end deftypefn -## @seealso{size, rows, columns, length, is_matrix, is_scalar, and is_vector} - -## Author: A. S. Hodel -## Created: August 1993 -## Adapted-By: jwe - -function retval = is_square (x) - - retval = 0; - - if (nargin == 1) - if (is_matrix (x)) - [nr, nc] = size (x); - if (nr == nc && nr > 0) - retval = nr; - endif - endif - else - usage ("is_square (x)"); - endif - -endfunction diff --git a/scripts/general/is_symmetric.m b/scripts/general/is_symmetric.m deleted file mode 100644 --- a/scripts/general/is_symmetric.m +++ /dev/null @@ -1,49 +0,0 @@ -## Copyright (C) 1996, 1997 John W. Eaton -## -## 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 2, 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, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} is_symmetric (@var{x}, @var{tol}) -## If @var{x} is symmetric within the tolerance specified by @var{tol}, -## then return the dimension of @var{x}. Otherwise, return 0. If -## @var{tol} is omitted, use a tolerance equal to the machine precision. -## @end deftypefn -## @seealso{size, rows, columns, length, is_matrix, is_scalar, -## is_square, and is_vector} - -## Author: A. S. Hodel -## Created: August 1993 -## Adapted-By: jwe - -function retval = is_symmetric (x,tol) - - if (nargin == 1 || nargin == 2) - retval = is_square (x); - if (retval != 0) - if (nargin == 1) - tol = eps; - endif - if (norm (x - x') / norm(x) > tol) - retval = 0; - endif - endif - else - usage ("is_symmetric (x {,tol})"); - endif - -endfunction diff --git a/scripts/general/is_vector.m b/scripts/general/is_vector.m deleted file mode 100644 --- a/scripts/general/is_vector.m +++ /dev/null @@ -1,41 +0,0 @@ -## Copyright (C) 1996, 1997 John W. Eaton -## -## 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 2, 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, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} is_vector (@var{a}) -## Return 1 if @var{a} is a vector. Otherwise, return 0. -## @end deftypefn -## @seealso{size, rows, columns, length, is_scalar, and is_matrix} - -## Author: jwe - -function retval = is_vector (x) - - retval = 0; - - if (nargin == 1) - if (is_matrix (x)) - [nr, nc] = size (x); - retval = ((nr == 1 && nc >= 1) || (nc == 1 && nr >= 1)); - endif - else - usage ("is_vector (x)"); - endif - -endfunction diff --git a/scripts/general/isscalar.m b/scripts/general/isscalar.m new file mode 100644 --- /dev/null +++ b/scripts/general/isscalar.m @@ -0,0 +1,41 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} isscalar (@var{a}) +## Return 1 if @var{a} is a scalar. Otherwise, return 0. +## @end deftypefn +## @seealso{size, rows, columns, length, isscalar, and ismatrix} + +## Author: jwe + +function retval = isscalar (x) + + retval = 0; + + if (nargin == 1) + if (ismatrix (x)) + [nr, nc] = size (x); + retval = (nr == 1 && nc == 1); + endif + else + usage ("isscalar (x)"); + endif + +endfunction diff --git a/scripts/general/issquare.m b/scripts/general/issquare.m new file mode 100644 --- /dev/null +++ b/scripts/general/issquare.m @@ -0,0 +1,46 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} issquare (@var{x}) +## If @var{x} is a square matrix, then return the dimension of @var{x}. +## Otherwise, return 0. +## @end deftypefn +## @seealso{size, rows, columns, length, ismatrix, isscalar, and isvector} + +## Author: A. S. Hodel +## Created: August 1993 +## Adapted-By: jwe + +function retval = issquare (x) + + retval = 0; + + if (nargin == 1) + if (ismatrix (x)) + [nr, nc] = size (x); + if (nr == nc && nr > 0) + retval = nr; + endif + endif + else + usage ("issquare (x)"); + endif + +endfunction diff --git a/scripts/general/issymmetric.m b/scripts/general/issymmetric.m new file mode 100644 --- /dev/null +++ b/scripts/general/issymmetric.m @@ -0,0 +1,49 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} issymmetric (@var{x}, @var{tol}) +## If @var{x} is symmetric within the tolerance specified by @var{tol}, +## then return the dimension of @var{x}. Otherwise, return 0. If +## @var{tol} is omitted, use a tolerance equal to the machine precision. +## @end deftypefn +## @seealso{size, rows, columns, length, ismatrix, isscalar, +## issquare, and isvector} + +## Author: A. S. Hodel +## Created: August 1993 +## Adapted-By: jwe + +function retval = issymmetric (x,tol) + + if (nargin == 1 || nargin == 2) + retval = issquare (x); + if (retval != 0) + if (nargin == 1) + tol = eps; + endif + if (norm (x - x') / norm(x) > tol) + retval = 0; + endif + endif + else + usage ("issymmetric (x {,tol})"); + endif + +endfunction diff --git a/scripts/general/isvector.m b/scripts/general/isvector.m new file mode 100644 --- /dev/null +++ b/scripts/general/isvector.m @@ -0,0 +1,41 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## 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 2, 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, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} isvector (@var{a}) +## Return 1 if @var{a} is a vector. Otherwise, return 0. +## @end deftypefn +## @seealso{size, rows, columns, length, isscalar, and ismatrix} + +## Author: jwe + +function retval = isvector (x) + + retval = 0; + + if (nargin == 1) + if (ismatrix (x)) + [nr, nc] = size (x); + retval = ((nr == 1 && nc >= 1) || (nc == 1 && nr >= 1)); + endif + else + usage ("isvector (x)"); + endif + +endfunction