# HG changeset patch # User Rik # Date 1386019743 28800 # Node ID 3fef9a2d2550dfb0aa9d7970e7ec011866599783 # Parent 46c131e5676ecd568b5ab677e737370368d1847f maint: Remove functions deprecated in 3.6 for 4.0 release. * NEWS: Add notice about removal of deprecated functions. * etc/NEWS.3: Correct deprecation list from 3.6 which incorrectly named is_duplicate_entry. * scripts/deprecated/module.mk: Remove deprecated scripts from build system. * scripts/deprecated/__error_text__.m, scripts/deprecated/cor.m, scripts/deprecated/corrcoef.m, scripts/deprecated/cut.m, scripts/deprecated/error_text.m, scripts/deprecated/polyderiv.m, scripts/deprecated/shell_cmd.m, scripts/deprecated/studentize.m, scripts/deprecated/sylvester_matrix.m: Remove files from source control. diff -r 46c131e5676e -r 3fef9a2d2550 NEWS --- a/NEWS Mon Dec 02 13:07:38 2013 -0800 +++ b/NEWS Mon Dec 02 13:29:03 2013 -0800 @@ -5,6 +5,23 @@ validateattributes + ** Deprecated functions. + + The following functions were deprecated in Octave 3.6 and have been + removed from Octave 4.0. + + cut polyderiv + cor shell_cmd + corrcoef studentize + __error_text__ sylvester_matrix + error_text + + The following functions have been deprecated in Octave 4.0 and will + be removed from Octave 4.4 (or whatever version is the second major + release after 4.0): + + *none* + --------------------------------------------------------- See NEWS.3 for old news. diff -r 46c131e5676e -r 3fef9a2d2550 etc/NEWS.3 --- a/etc/NEWS.3 Mon Dec 02 13:07:38 2013 -0800 +++ b/etc/NEWS.3 Mon Dec 02 13:29:03 2013 -0800 @@ -603,11 +603,11 @@ be removed from Octave 3.10 (or whatever version is the second major release after 3.6): - cut is_duplicate_entry - cor polyderiv - corrcoef shell_cmd - __error_text__ studentize - error_text sylvester_matrix + cut polyderiv + cor shell_cmd + corrcoef studentize + __error_text__ sylvester_matrix + error_text ** The following functions have been modified for Matlab compatibility: diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/__error_text__.m --- a/scripts/deprecated/__error_text__.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -## Copyright (C) 2012-2013 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 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 {Built-in Function} {[@var{msg}, @var{msgid}] =} __error_text__ (@var{msg}, @var{msgid}) -## This function has been deprecated. Use @code{lasterr} instead. -## @seealso{lasterr} -## @end deftypefn - -function [msg, msgid] = __error_text__ (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "__error_text__ is obsolete and will be removed from a future version of Octave, please use lasterr instead"); - endif - - [msg, msgid] = lasterr (varargin{:}); - -endfunction - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/cor.m --- a/scripts/deprecated/cor.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -## Copyright (C) 1995-2013 Kurt Hornik -## -## 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} {} cor (@var{x}) -## @deftypefnx {Function File} {} cor (@var{x}, @var{y}) -## Compute matrix of correlation coefficients. -## -## This is an alias for @code{corrcoef}. -## @seealso{corrcoef} -## @end deftypefn - -function retval = cor (x, y = x) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "cor is obsolete and will be removed from a future version of Octave; please use corr instead"); - endif - - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - retval = corrcoef (x, y); - -endfunction - - -%!test -%! x = rand (10, 2); -%! assert (cor (x), corrcoef (x), 5*eps); -%! assert (cor (x(:,1), x(:,2)) == corrcoef (x(:,1), x(:,2))); - -%% Test input validation -%!error corrcoef (); -%!error corrcoef (1, 2, 3); - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/corrcoef.m --- a/scripts/deprecated/corrcoef.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -## Copyright (C) 1996-2013 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 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} {} corrcoef (@var{x}) -## @deftypefnx {Function File} {} corrcoef (@var{x}, @var{y}) -## Compute matrix of correlation coefficients. -## -## If each row of @var{x} and @var{y} is an observation and each column is -## a variable, then the @w{(@var{i}, @var{j})-th} entry of -## @code{corrcoef (@var{x}, @var{y})} is the correlation between the -## @var{i}-th variable in @var{x} and the @var{j}-th variable in @var{y}. -## @tex -## $$ -## {\rm corrcoef}(x,y) = {{\rm cov}(x,y) \over {\rm std}(x) {\rm std}(y)} -## $$ -## @end tex -## @ifnottex -## -## @example -## corrcoef(x,y) = cov(x,y)/(std(x)*std(y)) -## @end example -## -## @end ifnottex -## If called with one argument, compute @code{corrcoef (@var{x}, @var{x})}, -## the correlation between the columns of @var{x}. -## @seealso{cov} -## @end deftypefn - -## Author: Kurt Hornik -## Created: March 1993 -## Adapted-By: jwe - -function retval = corrcoef (x, y = []) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "corrcoef is not equivalent to Matlab and will be removed from a future version of Octave; for similar functionality see corr"); - endif - - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - ## Input validation is done by cov.m. Don't repeat tests here - - ## Special case, scalar is always 100% correlated with itself - if (isscalar (x)) - if (isa (x, 'single')) - retval = single (1); - else - retval = 1; - endif - return; - endif - - ## No check for division by zero error, which happens only when - ## there is a constant vector and should be rare. - if (nargin == 2) - c = cov (x, y); - s = std (x)' * std (y); - retval = c ./ s; - else - c = cov (x); - s = sqrt (diag (c)); - retval = c ./ (s * s'); - endif - -endfunction - - -%!test -%! x = rand (10); -%! cc1 = corrcoef (x); -%! cc2 = corrcoef (x, x); -%! assert (size (cc1) == [10, 10] && size (cc2) == [10, 10]); -%! assert (cc1, cc2, sqrt (eps)); - -%!test -%! x = [1:3]'; -%! y = [3:-1:1]'; -%! assert (corrcoef (x,y), -1, 5*eps) -%! assert (corrcoef (x,flipud (y)), 1, 5*eps) -%! assert (corrcoef ([x, y]), [1 -1; -1 1], 5*eps) - -%!test -%! x = single ([1:3]'); -%! y = single ([3:-1:1]'); -%! assert (corrcoef (x,y), single (-1), 5*eps) -%! assert (corrcoef (x,flipud (y)), single (1), 5*eps) -%! assert (corrcoef ([x, y]), single ([1 -1; -1 1]), 5*eps) - -%!assert (corrcoef (5), 1); -%!assert (corrcoef (single(5)), single(1)); - -%% Test input validation -%!error corrcoef (); -%!error corrcoef (1, 2, 3); -%!error corrcoef ([1; 2], ["A", "B"]); -%!error corrcoef (ones (2,2,2)); -%!error corrcoef (ones (2,2), ones (2,2,2)); - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/cut.m --- a/scripts/deprecated/cut.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -## Copyright (C) 1996-2013 Kurt Hornik -## -## 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} {} cut (@var{x}, @var{breaks}) -## Create categorical data from numerical or continuous data by -## cutting into intervals. -## -## If @var{breaks} is a scalar, the data is cut into that many -## equal-width intervals. If @var{breaks} is a vector of break points, -## the category has @code{length (@var{breaks}) - 1} groups. -## -## The returned value is a vector of the same size as @var{x} telling -## which group each point in @var{x} belongs to. Groups are labelled -## from 1 to the number of groups; points outside the range of -## @var{breaks} are labelled by @code{NaN}. -## @seealso{histc} -## @end deftypefn - -## Author: KH -## Description: Cut data into intervals - -function group = cut (x, breaks) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "cut is obsolete and will be removed from a future version of Octave; please use histc instead"); - endif - - if (nargin != 2) - print_usage (); - endif - - if (!isvector (x)) - error ("cut: X must be a vector"); - endif - if (isscalar (breaks)) - breaks = linspace (min (x), max (x), breaks + 1); - breaks(1) = breaks(1) - 1; - elseif (isvector (breaks)) - breaks = sort (breaks); - else - error ("cut: BREAKS must be a scalar or vector"); - endif - - group = NaN (size (x)); - m = length (breaks); - if (any (k = find ((x >= min (breaks)) & (x < max (breaks))))) - n = length (k); - group(k) = sum ((ones (m, 1) * reshape (x(k), 1, n)) - >= (reshape (breaks, m, 1) * ones (1, n))); - endif - -endfunction - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/error_text.m --- a/scripts/deprecated/error_text.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -## Copyright (C) 2012-2013 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 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 {Built-in Function} {[@var{msg}, @var{msgid}] =} error_text (@var{msg}, @var{msgid}) -## This function has been deprecated. Use @code{lasterr} instead. -## @seealso{lasterr} -## @end deftypefn - -function [msg, msgid] = error_text (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "error_text is obsolete and will be removed from a future version of Octave, please use lasterr instead"); - endif - - [msg, msgid] = lasterr (varargin{:}); - -endfunction - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/module.mk --- a/scripts/deprecated/module.mk Mon Dec 02 13:07:38 2013 -0800 +++ b/scripts/deprecated/module.mk Mon Dec 02 13:29:03 2013 -0800 @@ -1,12 +1,7 @@ FCN_FILE_DIRS += deprecated deprecated_FCN_FILES = \ - deprecated/__error_text__.m \ - deprecated/cor.m \ - deprecated/corrcoef.m \ - deprecated/cut.m \ deprecated/default_save_options.m \ - deprecated/error_text.m \ deprecated/gen_doc_cache.m \ deprecated/interp1q.m \ deprecated/isequalwithequalnans.m \ @@ -20,13 +15,9 @@ deprecated/java_set.m \ deprecated/javafields.m \ deprecated/javamethods.m \ - deprecated/polyderiv.m \ deprecated/re_read_readline_init_file.m \ deprecated/read_readline_init_file.m \ - deprecated/saving_history.m \ - deprecated/shell_cmd.m \ - deprecated/studentize.m \ - deprecated/sylvester_matrix.m + deprecated/saving_history.m FCN_FILES += $(deprecated_FCN_FILES) diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/polyderiv.m --- a/scripts/deprecated/polyderiv.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -## Copyright (C) 1994-2013 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 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} {} polyderiv (@var{p}) -## @deftypefnx {Function File} {[@var{k}] =} polyderiv (@var{a}, @var{b}) -## @deftypefnx {Function File} {[@var{q}, @var{d}] =} polyderiv (@var{b}, @var{a}) -## Return the coefficients of the derivative of the polynomial whose -## coefficients are given by the vector @var{p}. If a pair of polynomials -## is given, return the derivative of the product @math{@var{a}*@var{b}}. -## If two inputs and two outputs are given, return the derivative of the -## polynomial quotient @math{@var{b}/@var{a}}. The quotient numerator is -## in @var{q} and the denominator in @var{d}. -## @seealso{poly, polyint, polyreduce, roots, conv, deconv, residue, -## filter, polygcd, polyval, polyvalm} -## @end deftypefn - -## Author: Tony Richardson -## Created: June 1994 -## Adapted-By: jwe - -function [q, d] = polyderiv (p, a) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "polyderiv is obsolete and will be removed from a future version of Octave; please use polyder instead"); - endif - - if (nargin == 1 || nargin == 2) - if (! isvector (p)) - error ("polyderiv: argument must be a vector"); - endif - if (nargin == 2) - if (! isvector (a)) - error ("polyderiv: argument must be a vector"); - endif - if (nargout == 1) - ## derivative of p*a returns a single polynomial - q = polyderiv (conv (p, a)); - else - ## derivative of p/a returns numerator and denominator - d = conv (a, a); - if (numel (p) == 1) - q = -p * polyderiv (a); - elseif (numel (a) == 1) - q = a * polyderiv (p); - else - q = conv (polyderiv (p), a) - conv (p, polyderiv (a)); - q = polyreduce (q); - endif - - ## remove common factors from numerator and denominator - x = polygcd (q, d); - if (length(x) != 1) - q = deconv (q, x); - d = deconv (d, x); - endif - - ## move all the gain into the numerator - q = q/d(1); - d = d/d(1); - endif - else - lp = numel (p); - if (lp == 1) - q = 0; - return; - elseif (lp == 0) - q = []; - return; - endif - - ## Force P to be a row vector. - p = p(:).'; - - q = p(1:(lp-1)) .* [(lp-1):-1:1]; - endif - else - print_usage (); - endif - -endfunction - - -%!assert(all (all (polyderiv ([1, 2, 3]) == [2, 2]))); - -%!assert(polyderiv (13) == 0); - -%!error polyderiv ([]); - -%!error polyderiv ([1, 2; 3, 4]); - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/shell_cmd.m --- a/scripts/deprecated/shell_cmd.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -## Copyright (C) 2012-2013 Rik Wehbring -## -## 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 {Built-in Function} {} shell_cmd (@var{string}) -## @deftypefnx {Built-in Function} {} shell_cmd (@var{string}, @var{return_output}) -## @deftypefnx {Built-in Function} {} shell_cmd (@var{string}, @var{return_output}, @var{type}) -## @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} shell_cmd (@dots{}) -## @deftypefnx {Built-in Function} {[@var{status}, @var{output}] =} shell_cmd (@var{string}, @var{return_output}, @var{type}) -## Execute a shell command specified by @var{string}. -## If the optional argument @var{type} is @qcode{"async"}, the process -## is started in the background and the process id of the child process -## is returned immediately. Otherwise, the process is started and -## Octave waits until it exits. If the @var{type} argument is omitted, it -## defaults to a value of @qcode{"sync"}. -## -## If the optional argument @var{return_output} is true and the subprocess -## is started synchronously, or if @var{shell_cmd} is called with one input -## argument and one or more output arguments, then the output from the command -## is returned. Otherwise, if the subprocess is executed synchronously, its -## output is sent to the standard output. -## -## The @code{shell_cmd} function can return two values. The first is the -## exit status of the command and the second is any output from the -## command that was written to the standard output stream. For example, -## -## @example -## [status, output] = shell_cmd ("echo foo; exit 2"); -## @end example -## -## @noindent -## will set the variable @code{output} to the string @samp{foo}, and the -## variable @code{status} to the integer @samp{2}. -## -## For commands run asynchronously, @var{status} is the process id of the -## command shell that is started to run the command. -## @seealso{system, unix, dos} -## @end deftypefn - -## Deprecated in version 3.6 - -function [status, output] = shell_cmd (varargin) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "shell_cmd is obsolete and will be removed from a future version of Octave; please use system instead"); - endif - - [status, output] = system (varargin{:}); - -endfunction - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/studentize.m --- a/scripts/deprecated/studentize.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -## Copyright (C) 1995-2013 Kurt Hornik -## -## 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} {} studentize (@var{x}) -## @deftypefnx {Function File} {} studentize (@var{x}, @var{dim}) -## If @var{x} is a vector, subtract its mean and divide by its standard -## deviation. -## -## If @var{x} is a matrix, do the above along the first non-singleton -## dimension. -## If the optional argument @var{dim} is given, operate along this dimension. -## @seealso{center} -## @end deftypefn - -## Author: KH -## Description: Subtract mean and divide by standard deviation - -function t = studentize (x, dim) - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "studentize is obsolete and will be removed from a future version of Octave; please use zscore instead"); - endif - - if (nargin != 1 && nargin != 2) - print_usage (); - endif - - if (! isnumeric(x)) - error ("studentize: X must be a numeric vector or matrix"); - endif - - if (isinteger (x)) - x = double (x); - endif - - nd = ndims (x); - sz = size (x); - if (nargin != 2) - ## Find the first non-singleton dimension. - dim = find (sz > 1, 1); - if (isempty (dim)) - dim = 1; - endif - else - if (!(isscalar (dim) && dim == fix (dim)) - || !(1 <= dim && dim <= nd)) - error ("studentize: DIM must be an integer and a valid dimension"); - endif - endif - - c = sz(dim); - if (c == 0) - t = x; - else - idx = ones (1, nd); - idx(dim) = c; - t = x - repmat (mean (x, dim), idx); - t = t ./ repmat (max (cat (dim, std(t, [], dim), ! any (t, dim)), [], dim), idx); - endif - -endfunction - - -%!assert(studentize ([1,2,3]), [-1,0,1]) -%!assert(studentize (int8 ([1,2,3])), [-1,0,1]) -#%!assert(studentize (ones (3,2,0,2)), zeros (3,2,0,2)) -%!assert(studentize ([2,0,-2;0,2,0;-2,-2,2]), [1,0,-1;0,1,0;-1,-1,1]) - -%% Test input validation -%!error studentize () -%!error studentize (1, 2, 3) -%!error studentize ([true true]) -%!error studentize (1, ones(2,2)) -%!error studentize (1, 1.5) -%!error studentize (1, 0) -%!error studentize (1, 3) - diff -r 46c131e5676e -r 3fef9a2d2550 scripts/deprecated/sylvester_matrix.m --- a/scripts/deprecated/sylvester_matrix.m Mon Dec 02 13:07:38 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -## Copyright (C) 1996-2013 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 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} {} sylvester_matrix (@var{k}) -## Return the Sylvester matrix of order -## @tex -## $n = 2^k$. -## @end tex -## @ifnottex -## n = 2^@var{k}. -## @end ifnottex -## -## @seealso{toeplitz, hankel} -## @end deftypefn - -## Author: jwe - -function retval = sylvester_matrix (k) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "sylvester_matrix is obsolete and will be removed from a future version of Octave; please use hadamard(2^k) instead"); - endif - - if (nargin != 1) - print_usage (); - endif - - if (isscalar (k)) - if (k < 1) - retval = 1; - else - tmp = sylvester_matrix (k-1); - retval = [tmp, tmp; tmp, -tmp]; - endif - else - error ("sylvester_matrix: expecting scalar argument"); - endif - -endfunction - - -%!assert((sylvester_matrix (1) == [1, 1; 1, -1] -%! && (sylvester_matrix (2) -%! == [1, 1, 1, 1; 1, -1, 1, -1; 1, 1, -1, -1; 1, -1, -1, 1]))); - -%!error sylvester_matrix ([1, 2; 3, 4]); - -%!error sylvester_matrix (); - -%!error sylvester_matrix (1, 2); -