comparison scripts/deprecated/spdiag.m @ 8911:eeed8d649811

spdiag.m: ensure sparse result
author John W. Eaton <jwe@octave.org>
date Thu, 05 Mar 2009 02:56:37 -0500
parents 8dee145c777d
children eb63fbe60fab
comparison
equal deleted inserted replaced
8910:6e9f26506804 8911:eeed8d649811
16 ## along with Octave; see the file COPYING. If not, see 16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} spdiag (@var{v}, @var{k}) 20 ## @deftypefn {Function File} {} spdiag (@var{v}, @var{k})
21 ## This function has been deprecated. Use @code{diag} instead. 21 ## This function has been deprecated. Use @code{sparse (diag (...))} instead.
22 ## @end deftypefn 22 ## @end deftypefn
23 23
24 ## Deprecated in version 3.2 24 ## Deprecated in version 3.2
25 25
26 function retval = spdiag (varargin) 26 function retval = spdiag (varargin)
27 persistent warned = false; 27 persistent warned = false;
28 if (! warned) 28 if (! warned)
29 warned = true; 29 warned = true;
30 warning ("Octave:deprecated-function", 30 warning ("Octave:deprecated-function",
31 "spdiag is obsolete and will be removed from a future version of Octave; please use diag instead"); 31 "spdiag is obsolete and will be removed from a future version of Octave; please use sparse (diag (...)) instead");
32 endif 32 endif
33 33
34 retval = diag (varargin{:}); 34 retval = sparse (diag (varargin{:}));
35 35
36 endfunction 36 endfunction