Mercurial > hg > octave-nkf
changeset 13268:571557ddabb9
maint: periodic merge of stable to default.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 03 Oct 2011 11:01:10 -0700 |
parents | f26ea04b5356 (current diff) 46f5e41c8610 (diff) |
children | b1882a8217ab |
files | NEWS configure.ac scripts/optimization/sqp.m scripts/plot/private/__line__.m scripts/signal/fftshift.m |
diffstat | 9 files changed, 126 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -83,10 +83,15 @@ __error_text__ sylvester_matrix error_text +Summary of important user-visible changes for version 3.4.3: +----------------------------------------------------------- + + ** Octave 3.4.3 is a bug fixing release. + Summary of important user-visible changes for version 3.4.2: ----------------------------------------------------------- - ** Octave 3.2.4 fixes some minor installation problems that affected + ** Octave 3.4.2 fixes some minor installation problems that affected version 3.4.1. Summary of important user-visible changes for version 3.4.1:
--- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg OCTAVE_VERSION="$PACKAGE_VERSION" -OCTAVE_API_VERSION_NUMBER="44" +OCTAVE_API_VERSION_NUMBER="45" OCTAVE_API_VERSION="api-v$OCTAVE_API_VERSION_NUMBER+" OCTAVE_RELEASE_DATE="2011-01-22" OCTAVE_COPYRIGHT="Copyright (C) 2011 John W. Eaton and others."
--- a/etc/HACKING +++ b/etc/HACKING @@ -158,7 +158,21 @@ testfun * unit testing time * time and date functions - src -- the interpreter itself + src -- the interpreter itself plus lots of infrastructure + around it. Octave's extensive octave_value class + hierarchy for polymorphically handling all Octave + types is defined here. The built-in functions are + also defined here, so if "help foo" tells you foo is + built-in, its source will be somewhere in this + directory. + DLD-FUNCTIONS * Dynamically linked oct files. If you see "help foo" + telling you that foo is defined in foo.oct, then + foo.cc will be found here and contain the source + code. + OPERATORS * Definitions and template instantiations for + operators for all possible Octave type + combinations. + TEMPLATE-INST * Some C++ template instantiations. test -- tests for the interpreter test_*.m * fixed tests for the interpreter @@ -170,7 +184,8 @@ jwe@octave.org -Last updated: Sat Jan 22 22:00:25 PST 2011 +Last updated: Wed Sep 28 22:37:37 CDT 2011 + ################################################################################
--- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}) ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}) ## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}) -## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tolerance}) +## @deftypefnx {Function File} {[@dots{}] =} sqp (@var{x0}, @var{phi}, @var{g}, @var{h}, @var{lb}, @var{ub}, @var{maxiter}, @var{tol}) ## Solve the nonlinear program ## @tex ## $$ @@ -62,14 +62,8 @@ ## The first argument is the initial guess for the vector @var{x0}. ## ## The second argument is a function handle pointing to the objective -## function. The objective function must be of the form -## -## @example -## @var{y} = phi (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{y} is a scalar. +## function @var{phi}. The objective function must accept one vector +## argument and return a scalar. ## ## The second argument may also be a 2- or 3-element cell array of ## function handles. The first element should point to the objective @@ -80,40 +74,18 @@ ## differences. If the Hessian function is not supplied, a BFGS update ## formula is used to approximate the Hessian. ## -## When supplied, the gradient function must be of the form -## -## @example -## @var{g} = gradient (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{g} is a vector. -## -## When supplied, the Hessian function must be of the form -## -## @example -## @var{h} = hessian (@var{x}) -## @end example +## When supplied, the gradient function @code{@var{phi}@{2@}} must accept +## one vector argument and return a vector. When supplifed, the Hessian +## function @code{@var{phi}@{3@}} must accept one vector argument and +## return a matrix. ## -## @noindent -## in which @var{x} is a vector and @var{h} is a matrix. -## -## The third and fourth arguments are function handles pointing to -## functions that compute the equality constraints and the inequality -## constraints, respectively. -## -## If the problem does not have equality (or inequality) constraints, -## then use an empty matrix ([]) for @var{cef} (or @var{cif}). -## -## When supplied, the equality and inequality constraint functions must be -## of the form -## -## @example -## @var{r} = f (@var{x}) -## @end example -## -## @noindent -## in which @var{x} is a vector and @var{r} is a vector. +## The third and fourth arguments @var{g} and @var{h} are function +## handles pointing to functions that compute the equality constraints +## and the inequality constraints, respectively. If the problem does +## not have equality (or inequality) constraints, then use an empty +## matrix ([]) for @var{g} (or @var{h}). When supplied, these equality +## and inequality constraint functions must accept one vector argument +## and return a vector. ## ## The third and fourth arguments may also be 2-element cell arrays of ## function handles. The first element should point to the constraint @@ -137,19 +109,20 @@ ## @end example ## ## @end ifnottex -## The fifth and sixth arguments contain lower and upper bounds -## on @var{x}. These must be consistent with the equality and inequality -## constraints @var{g} and @var{h}. If the arguments are vectors then -## @var{x}(i) is bound by @var{lb}(i) and @var{ub}(i). A bound can also -## be a scalar in which case all elements of @var{x} will share the same -## bound. If only one bound (lb, ub) is specified then the other will -## default to (-@var{realmax}, +@var{realmax}). +## The fifth and sixth arguments, @var{lb} and @var{ub}, contain lower +## and upper bounds on @var{x}. These must be consistent with the +## equality and inequality constraints @var{g} and @var{h}. If the +## arguments are vectors then @var{x}(i) is bound by @var{lb}(i) and +## @var{ub}(i). A bound can also be a scalar in which case all elements +## of @var{x} will share the same bound. If only one bound (lb, ub) is +## specified then the other will default to (-@var{realmax}, +## +@var{realmax}). ## -## The seventh argument specifies the maximum number of iterations. -## The default value is 100. +## The seventh argument @var{maxiter} specifies the maximum number of +## iterations. The default value is 100. ## -## The eighth argument specifies the tolerance for the stopping criteria. -## The default value is @code{sqrt(eps)}. +## The eighth argument @var{tol} specifies the tolerance for the +## stopping criteria. The default value is @code{sqrt(eps)}. ## ## The value returned in @var{info} may be one of the following: ## @@ -163,7 +136,7 @@ ## @ifnottex ## delta @var{x}, ## @end ifnottex -## is less than @code{tol * norm (x)}. +## is less than @code{@var{tol} * norm (x)}. ## ## @item 102 ## The BFGS update failed.
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -31,7 +31,7 @@ print_usage (); endif - [fmt, key] = __pltopt__ ("__errplot__", fstr); + [fmt, valid] = __pltopt__ ("__errplot__", fstr); [len, nplots] = size (varargin{1}); h = []; @@ -74,7 +74,7 @@ switch (numel(varargin)) case 2 ydata = varargin{1}(:,i); - xdata = 1:numel(ydata); + xdata = 1:numel (ydata); if (strcmp (ifmt, "xerr") || strcmp (ifmt, "box")) xldata = varargin{2}(:,i); xudata = ldata; @@ -86,12 +86,12 @@ xldata = []; xudata = []; else - error ("errorbar: 2 column errorplot is only valid or xerr or yerr"); + error ("errorbar: 2 column errorplot is only valid for xerr or yerr"); endif case 3 if (strcmp (ifmt, "boxxy") || strcmp (ifmt, "xyerr")) ydata = varargin{1}(:,i); - xdata = 1:numel(ydata); + xdata = 1:numel (ydata); xldata = varargin{2}(:,i); xudata = xldata; ldata = varargin{3}(:,i); @@ -146,7 +146,7 @@ error ("errorbar: error plot with 6 columns only valid for boxxy and xyerr"); endif otherwise - error ("errorbar: error plot requires 2, 3, 4 or 6 arguments"); + error ("errorbar: error plot requires 2, 3, 4, or 6 arguments"); endswitch addproperty ("xdata", hg, "data", xdata(:)); @@ -193,6 +193,34 @@ endfor + ## Process legend key + if (! isempty (fmt.key)) + hlegend = []; + fkids = get (gcf(), "children"); + for i = 1 : numel (fkids) + if (ishandle (fkids(i)) && strcmp (get (fkids(i), "type"), "axes") + && (strcmp (get (fkids(i), "tag"), "legend"))) + udata = get (fkids(i), "userdata"); + if (! isempty (intersect (udata.handle, gca ()))) + hlegend = fkids (i); + break; + endif + endif + endfor + + if (isempty (hlegend)) + hlgnd = []; + tlgnd = {}; + else + [hlgnd, tlgnd] = __getlegenddata__ (hlegend); + endif + + hlgnd(end+1) = hg; + tlgnd(end+1) = fmt.key; + + legend (gca(), hlgnd, tlgnd); + end + endfunction function [xdata, ydata] = errorbar_data (xdata, ydata, ldata, udata, @@ -259,8 +287,10 @@ else error ("errorbar: valid error bar types are xerr, yerr, boxxy, and xyerr"); endif + xdata = xdata.'(:); ydata = ydata.'(:); + endfunction function update_props (hg, dummy, hl)
--- a/scripts/plot/private/__getlegenddata__.m +++ b/scripts/plot/private/__getlegenddata__.m @@ -26,38 +26,33 @@ text_strings = {}; ca = getfield (get (hlegend, "userdata"), "handle"); kids = []; - for i = 1 : numel (ca) - kids = [kids; get(ca (i), "children")]; + for i = 1:numel (ca) + kids = [kids; get(ca(i), "children")]; endfor - k = numel (kids); - while (k > 0) - typ = get (kids(k), "type"); - while (k > 0 - && ! (strcmp (typ, "line") || strcmp (typ, "surface") - || strcmp (typ, "patch") || strcmp (typ, "hggroup"))) - typ = get (kids(--k), "type"); - endwhile - if (k > 0) - if (strcmp (get (kids(k), "type"), "hggroup")) - hgkids = get (kids(k), "children"); + + for i = numel (kids):-1:1 + typ = get (kids(i), "type"); + if (strcmp (typ, "line") || strcmp (typ, "surface") + || strcmp (typ, "patch") || strcmp (typ, "hggroup")) + + if (strcmp (typ, "hggroup")) + hgkids = get (kids(i), "children"); for j = 1 : length (hgkids) hgobj = get (hgkids (j)); - if (isfield (hgobj, "displayname") - && ! isempty (hgobj.displayname)) + if (isfield (hgobj, "displayname") && ! isempty (hgobj.displayname)) hplots = [hplots, hgkids(j)]; text_strings = {text_strings{:}, hgobj.displayname}; break; endif endfor else - if (! isempty (get (kids (k), "displayname"))) - hplots = [hplots, kids(k)]; - text_strings = {text_strings{:}, get(kids (k), "displayname")}; + if (! isempty (get (kids (i), "displayname"))) + hplots = [hplots, kids(i)]; + text_strings = {text_strings{:}, get(kids (i), "displayname")}; endif endif - if (--k == 0) - break; - endif + endif - endwhile + endfor + endfunction
--- a/scripts/plot/private/__line__.m +++ b/scripts/plot/private/__line__.m @@ -45,8 +45,12 @@ num_data_args = 0; endif + if (num_data_args > 0 && ! size_equal (varargin{1:num_data_args})) + error ("line: number of X, Y, and Z points must be equal"); + endif + if (rem (nvargs - num_data_args, 2) != 0) - print_usage ("line"); + error ("line: invalid number of PROPERTY / VALUE pairs"); endif other_args = {};
--- a/scripts/signal/fftshift.m +++ b/scripts/signal/fftshift.m @@ -24,13 +24,15 @@ ## center of the vector or matrix. ## ## If @var{x} is a vector of @math{N} elements corresponding to @math{N} -## time samples spaced of @math{Dt} each, then @code{fftshift (fft -## (@var{x}))} corresponds to frequencies +## time samples spaced by @math{dt}, then +## @code{fftshift (fft (@var{x}))} corresponds to frequencies ## ## @example -## f = ((1:N) - ceil(N/2)) / N / Dt +## f = [ -(ceil((N-1)/2):-1:1)*df 0 (1:floor((N-1)/2))*df ] ## @end example ## +## where @math{df} = 1 / @math{dt}. +## ## If @var{x} is a matrix, the same holds for rows and columns. If ## @var{x} is an array, then the same holds along each dimension. ## @@ -44,15 +46,13 @@ function retval = fftshift (x, dim) - retval = 0; - if (nargin != 1 && nargin != 2) print_usage (); endif if (nargin == 2) - if (!isscalar (dim)) - error ("fftshift: dimension must be an integer scalar"); + if (! (isscalar (dim) && dim > 0 && dim == fix (dim))) + error ("fftshift: dimension DIM must be a positive integer"); endif nd = ndims (x); sz = size (x); @@ -82,6 +82,7 @@ endfunction + %!test %! x = [0:7]; %! y = fftshift (x);
--- a/src/DLD-FUNCTIONS/schur.cc +++ b/src/DLD-FUNCTIONS/schur.cc @@ -60,8 +60,10 @@ DEFUN_DLD (schur, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{S} =} schur (@var{A})\n\ +@deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, \"real\")\n\ @deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, \"complex\")\n\ -@deftypefnx {Loadable Function} {[@var{U}, @var{S}] =} schur (@var{A}, @var{opt})\n\ +@deftypefnx {Loadable Function} {@var{S} =} schur (@var{A}, @var{opt})\n\ +@deftypefnx {Loadable Function} {[@var{U}, @var{S}] =} schur (@var{A}, @dots{})\n\ @cindex Schur decomposition\n\ Compute the Schur@tie{}decomposition of @var{A}\n\ @tex\n\ @@ -104,7 +106,8 @@ @end ifnottex\n\ blocks, when appropriate) are the eigenvalues of @var{A} and @var{S}.\n\ \n\ -A complex decomposition may be forced by passing \"complex\" as @var{opt}.\n\ +The default for real matrices is a real Schur@tie{}decomposition.\n\ +A complex decomposition may be forced by passing the flag \"complex\".\n\ \n\ The eigenvalues are optionally ordered along the diagonal according to\n\ the value of @var{opt}. @code{@var{opt} = \"a\"} indicates that all\n\ @@ -150,7 +153,11 @@ bool force_complex = false; - if (ord == "complex") + if (ord == "real") + { + ord = std::string (); + } + else if (ord == "complex") { force_complex = true; ord = std::string ();