changeset 18455:9fbea0c395ec gui-release

maint: Periodic merge of stable to gui-release.
author John W. Eaton <jwe@octave.org>
date Thu, 13 Feb 2014 12:05:47 -0500
parents 888cd8f62c67 (current diff) 0821a51a9e1b (diff)
children 3afae1432cd6 ebb878596bcf
files
diffstat 9 files changed, 66 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-save.cc	Sat Feb 08 13:33:05 2014 -0800
+++ b/libinterp/corefcn/load-save.cc	Thu Feb 13 12:05:47 2014 -0500
@@ -1143,7 +1143,7 @@
         {
           retval.append (argv[i]);
         }
-      else if (argv[i][0] == '-')
+      else if (argv[i][0] == '-' && argv[i] != "-")
         {
           error ("save: Unrecognized option '%s'", argv[i].c_str ());
         }
--- a/libinterp/corefcn/sparse.cc	Sat Feb 08 13:33:05 2014 -0800
+++ b/libinterp/corefcn/sparse.cc	Thu Feb 13 12:05:47 2014 -0500
@@ -125,21 +125,17 @@
     }
   else if (nargin == 2)
     {
-      octave_idx_type m = 0, n = 0;
-      if (args(0).is_scalar_type () && args(1).is_scalar_type ())
-        {
-          m = args(0).idx_type_value ();
-          n = args(1).idx_type_value ();
-        }
-      else
-        error ("sparse: dimensions M,N must be scalar");
+      octave_idx_type m = 0;
+      octave_idx_type n = 0;
+
+      get_dimensions (args(0), args(1), "sparse", m, n);
 
       if (! error_state)
         {
           if (m >= 0 && n >= 0)
             retval = SparseMatrix (m, n);
           else
-            error ("sparse: dimensions M,N must be positive or zero");
+            error ("sparse: dimensions must be non-negative");
         }
     }
   else if (nargin >= 3)
@@ -169,14 +165,7 @@
 
           if (nargin == 5)
             {
-              if (args(3).is_scalar_type () && args(4).is_scalar_type ())
-                {
-                  m = args(3).idx_type_value ();
-                  n = args(4).idx_type_value ();
-                }
-              else
-                error ("sparse: expecting scalar dimensions");
-
+              get_dimensions (args(3), args(4), "sparse", m, n);
 
               if (! error_state && (m < 0 || n < 0))
                 error ("sparse: dimensions must be non-negative");
--- a/scripts/general/private/__isequal__.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/general/private/__isequal__.m	Thu Feb 13 12:05:47 2014 -0500
@@ -82,8 +82,12 @@
   ## From here on, compare objects as if they were structures.
   if (isobject (x))
     x = builtin ("struct", x);
-    varargin = cellfun (@(x) builtin ("struct", x), varargin,
-                        "uniformoutput", false);
+    for i = 1:numel (varargin)
+      if (! isobject (varargin{i}))
+        break;
+      endif
+      varargin{i} = builtin ("struct", varargin{i});
+    endfor
   endif
 
   if (t)
--- a/scripts/image/image.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/image/image.m	Thu Feb 13 12:05:47 2014 -0500
@@ -156,8 +156,8 @@
       y = [1, rows(img)];
     endif
 
-    xdata = x([1, end]);
-    ydata = y([1, end]);
+    xdata = x([1, end])(:).';  # (:).' is a hack to guarantee row vector
+    ydata = y([1, end])(:).';
 
     if (numel (x) > 2 && numel (y) > 2)
       ## Test data for non-linear spacing which is unsupported
--- a/scripts/signal/freqz.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/signal/freqz.m	Thu Feb 13 12:05:47 2014 -0500
@@ -18,6 +18,9 @@
 
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {[@var{h}, @var{w}] =} freqz (@var{b}, @var{a}, @var{n}, "whole")
+## @deftypefnx {Function File} {[@var{h}, @var{w}] =} freqz (@var{b})
+## @deftypefnx {Function File} {[@var{h}, @var{w}] =} freqz (@var{b}, @var{a})
+## @deftypefnx {Function File} {[@var{h}, @var{w}] =} freqz (@var{b}, @var{a}, @var{n})
 ## @deftypefnx {Function File} {@var{h} =} freqz (@var{b}, @var{a}, @var{w})
 ## @deftypefnx {Function File} {[@dots{}] =} freqz (@dots{}, @var{Fs})
 ## @deftypefnx {Function File} {} freqz (@dots{})
@@ -27,10 +30,10 @@
 ## respectively.  The response is evaluated at @var{n} angular frequencies
 ## between 0 and
 ## @ifnottex
-##  2*pi.
+## 2*pi.
 ## @end ifnottex
 ## @tex
-##  $2\pi$.
+## $2\pi$.
 ## @end tex
 ##
 ## @noindent
@@ -40,17 +43,16 @@
 ## corresponds to a simple FIR filter).
 ##
 ## If @var{n} is omitted, a value of 512 is assumed.
-##
 ## For fastest computation, @var{n} should factor into a small number of
 ## small primes.
 ##
 ## If the fourth argument, @qcode{"whole"}, is omitted the response is
 ## evaluated at frequencies between 0 and
 ## @ifnottex
-##  pi.
+## pi.
 ## @end ifnottex
 ## @tex
-##  $\pi$.
+## $\pi$.
 ## @end tex
 ##
 ## @code{freqz (@var{b}, @var{a}, @var{w})}
@@ -66,8 +68,9 @@
 ##
 ## @code{freqz (@dots{})}
 ##
-## Plot the pass band, stop band and phase response of @var{h} rather
-## than returning them.
+## Plot the magnitude and phase response of @var{h} rather than returning them.
+##
+## @seealso{freqz_plot}
 ## @end deftypefn
 
 ## Author: jwe ???
@@ -109,11 +112,14 @@
     endif
   endif
   if (isempty (Fs))
+    freq_norm = true;
     if (nargout == 0)
       Fs = 2;
     else
       Fs = 2*pi;
     endif
+  else
+    freq_norm = false;
   endif
 
   a = a(:);
@@ -171,7 +177,7 @@
     f_r = f;
   else
     ## Plot and don't return values.
-    freqz_plot (f, h);
+    freqz_plot (f, h, freq_norm);
   endif
 
 endfunction
--- a/scripts/signal/freqz_plot.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/signal/freqz_plot.m	Thu Feb 13 12:05:47 2014 -0500
@@ -17,15 +17,21 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} freqz_plot (@var{w}, @var{h})
-## Plot the pass band, stop band and phase response of @var{h}.
+## @deftypefn  {Function File} {} freqz_plot (@var{w}, @var{h})
+## @deftypefnx {Function File} {} freqz_plot (@var{w}, @var{h}, @var{freq_norm})
+## Plot the magnitude and phase response of @var{h}.
+##
+## If the optional @var{freq_norm} argument is true, the frequency vector
+## @var{w} is in units of normalized radians.  If @var{freq_norm} is false, or
+## not given, then @var{w} is measured in Hertz.
+## @seealso{freqz}
 ## @end deftypefn
 
 ## Author: Paul Kienzle <pkienzle@users.sf.net>
 
-function freqz_plot (w, h)
+function freqz_plot (w, h, freq_norm = false)
 
-  if (nargin != 2)
+  if (nargin < 2 || nargin > 3)
     print_usage ();
   endif
 
@@ -38,30 +44,26 @@
 
   mag = 20 * log10 (abs (h));
   phase = unwrap (arg (h));
-  maxmag = max (mag);
 
-  subplot (3, 1, 1);
-  plot (w, mag);
-  grid ("on");
-  legend ("Pass band (dB)");
-  axis ([w(1), w(n), maxmag-3, maxmag], "labely");
+  if (freq_norm)
+    x_label = 'Normalized Frequency (\times\pi rad/sample)';
+  else
+    x_label = "Frequency (Hz)";
+  endif
 
-  subplot (3, 1, 2);
+  subplot (2, 1, 1);
   plot (w, mag);
   grid ("on");
-  legend ("Stop band (dB)");
-  if (maxmag - min (mag) > 100)
-    axis ([w(1), w(n), maxmag-100, maxmag], "labely");
-  else
-    axis ("autoy", "labely");
-  endif
+  axis ([w(1), w(n)], "autoy");
+  xlabel (x_label);
+  ylabel ("Magnitude (dB)");
 
-  subplot (3, 1, 3);
+  subplot (2, 1, 2);
   plot (w, phase*360/(2*pi));
   grid ("on");
-  legend ("Phase (degrees)");
-  xlabel ("Frequency");
-  axis ([w(1), w(n)], "autoy", "label");
+  axis ([w(1), w(n)], "autoy");
+  xlabel (x_label);
+  ylabel ("Phase (degrees)");
 
 endfunction
 
--- a/scripts/statistics/distributions/logncdf.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/statistics/distributions/logncdf.m	Thu Feb 13 12:05:47 2014 -0500
@@ -20,13 +20,13 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {} logncdf (@var{x})
 ## @deftypefnx {Function File} {} logncdf (@var{x}, @var{mu}, @var{sigma})
-## For each element of @var{x}, compute the cumulative distribution
-## function (CDF) at @var{x} of the lognormal distribution with
-## parameters @var{mu} and @var{sigma}.  If a random variable follows this
-## distribution, its logarithm is normally distributed with mean
-## @var{mu} and standard deviation @var{sigma}.
+## For each element of @var{x}, compute the cumulative distribution function
+## (CDF) at @var{x} of the lognormal distribution with parameters
+## @var{mu} and @var{sigma}.  If a random variable follows this distribution,
+## its logarithm is normally distributed with mean @var{mu} and standard
+## deviation @var{sigma}.
 ##
-## Default values are @var{mu} = 1, @var{sigma} = 1.
+## Default values are @var{mu} = 0, @var{sigma} = 1.
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/logninv.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/statistics/distributions/logninv.m	Thu Feb 13 12:05:47 2014 -0500
@@ -21,12 +21,12 @@
 ## @deftypefn  {Function File} {} logninv (@var{x})
 ## @deftypefnx {Function File} {} logninv (@var{x}, @var{mu}, @var{sigma})
 ## For each element of @var{x}, compute the quantile (the inverse of the
-## CDF) at @var{x} of the lognormal distribution with parameters @var{mu}
-## and @var{sigma}.  If a random variable follows this distribution, its
-## logarithm is normally distributed with mean @code{log (@var{mu})} and
-## variance @var{sigma}.
+## CDF) at @var{x} of the lognormal distribution with parameters
+## @var{mu} and @var{sigma}.  If a random variable follows this distribution,
+## its logarithm is normally distributed with mean @var{mu} and standard
+## deviation @var{sigma}.
 ##
-## Default values are @var{mu} = 1, @var{sigma} = 1.
+## Default values are @var{mu} = 0, @var{sigma} = 1.
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>
--- a/scripts/statistics/distributions/lognpdf.m	Sat Feb 08 13:33:05 2014 -0800
+++ b/scripts/statistics/distributions/lognpdf.m	Thu Feb 13 12:05:47 2014 -0500
@@ -23,10 +23,10 @@
 ## For each element of @var{x}, compute the probability density function
 ## (PDF) at @var{x} of the lognormal distribution with parameters
 ## @var{mu} and @var{sigma}.  If a random variable follows this distribution,
-## its logarithm is normally distributed with mean @var{mu}
-## and standard deviation @var{sigma}.
+## its logarithm is normally distributed with mean @var{mu} and standard
+## deviation @var{sigma}.
 ##
-## Default values are @var{mu} = 1, @var{sigma} = 1.
+## Default values are @var{mu} = 0, @var{sigma} = 1.
 ## @end deftypefn
 
 ## Author: KH <Kurt.Hornik@wu-wien.ac.at>