# HG changeset patch # User John W. Eaton # Date 1316546926 14400 # Node ID 536c6a5ab70582b2f79a1d8bb18fbda18cf8e6b8 # Parent 19b9f17d22aff18feab1a2731c34cede2bb343a0# Parent 796dc1d75e0682bb05f26fb0117dcffa92d3f26c maint: periodic merge of stable to default diff --git a/doc/interpreter/contrib.txi b/doc/interpreter/contrib.txi --- a/doc/interpreter/contrib.txi +++ b/doc/interpreter/contrib.txi @@ -6,12 +6,12 @@ @c under the terms of the GNU General Public License as published by the @c Free Software Foundation; either version 3 of the License, or (at @c your option) any later version. -@c +@c @c Octave is distributed in the hope that it will be useful, but WITHOUT @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License @c for more details. -@c +@c @c You should have received a copy of the GNU General Public License @c along with Octave; see the file COPYING. If not, see @c . @@ -23,7 +23,7 @@ This chapter is dedicated to those who wish to contribute code to Octave. -@menu +@menu * How to Contribute:: * General Guidelines:: * Octave Sources (m-files):: @@ -56,7 +56,7 @@ @example @group hg clone http://www.octave.org/hg/octave - # make a local copy of the octave + # make a local copy of the octave # source repository cd octave # change some sources@dots{} @@ -71,13 +71,13 @@ @end example You may want to get familiar with Mercurial queues to manage your -changesets. Here is a slightly more complex example using Mercurial +changesets. Here is a slightly more complex example using Mercurial queues, where work on two unrelated changesets is done in parallel and -one of the changesets is updated after discussion on the maintainers mailing -list: +one of the changesets is updated after discussion on the maintainers +mailing list: @example -hg qnew nasty_bug # create a new patch +hg qnew nasty_bug # create a new patch # change sources@dots{} hg qref # save the changes into the patch # change even more@dots{} @@ -89,7 +89,7 @@ hg qpop # undo the application of the patch # and remove the changes from the # source tree -hg qnew doc_improvements # create an unrelated patch +hg qnew doc_improvements # create an unrelated patch # change doc sources@dots{} hg qref -m "could not find myfav.m in the doc" # save the changes into the patch @@ -122,7 +122,7 @@ ## 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 +## either version 3 of the License, or (at your option) any ## later version. ## ## Octave is distributed in the hope that it will be useful, @@ -136,40 +136,50 @@ ## see . @end example -Always include ChangeLog entries in changesets. After making your -source changes, record and briefly describe the changes in the nearest -ChangeLog file upwards in the directory tree. Use the previous entries -as a template. Your entry should contain your name and email, and the -path to the modified source file relative to the parent directory of the -ChangeLog file. If there are more functions in the file, you should -also include the name of the modified function (in parentheses after -file path). Example: +Always include commit messages in changesets. After making your source +changes, record and briefly describe the changes in your commit message. +You should have previously configured your @file{.hgrc} (or +@file{Mercurial.ini} on Windows) with your name and email, which will +get automatically added to your commit message. Your commit message +should have a brief one-line explanation of what the commit does. If you +are patching a bug, this one-line explanation should mention the bug +number at the end. If your change is small and only touches one file, +this is typically sufficient. If you are modifying several files or +several parts of one file, you should enumerate your changes roughly +following the GNU coding standards on changelogs, like the following +example: @example @group -2010-04-13 David Bateman +look for methods before constructors - * DLD-FUNCTIONS/regexp.cc (octregexp_list): Handle repeated matches - in the list of matches returned by pcre. +* symtab.cc (symbol_table::fcn_info::fcn_info_rep::find): +Look for class methods before constructors, contrary to Matlab +documentation. + +* test/ctor-vs-method: New directory of test classes. +* test/test_ctor_vs_method.m: New file. +* test/Makefile.am: Include ctor-vs-method/module.mk. +(FCN_FILES): Include test_ctor_vs_method.m in the list. @end group @end example @noindent -The ChangeLog entries should describe what is changed, not why. Any -explanation of why a change is needed should appear as comments in the -code, particularly if there is something that might not be obvious to -someone reading it later. +In this example, the names of files is mentioned, and in parentheses the +name of the function in that file that was modified. There is no need to +mention the function for m-files that only contain one function. The +commit message should describe what is changed, not why. Any explanation +of why a change is needed should appear as comments in the code, +particularly if there is something that might not be obvious to someone +reading it later. -When submitting code which addresses a known bug on the Octave bug tracker -(@url{http://bugs.octave.org}), please add '(bug #XXXXX)' to the ChangeLog -and Mercurial commit messages. Example: +When submitting code which addresses a known bug on the Octave bug +tracker (@url{http://bugs.octave.org}), please add '(bug #XXXXX)' to the +first line of the commit messages. For example: @example @group -2011-03-29 Michael Creel - - * statistics/base/ols.m: Fix erroneous degrees of freedom when - computing the covariance estimator (bug #32892). +Fix bug for complex input for gradient (bug #34292). @end group @end example @@ -208,7 +218,7 @@ @end example @noindent -but +but @example A([1:i-1;i+1:n], XI(:,2:n-1)) @@ -223,7 +233,7 @@ @code{endswitch}) rather than generic @code{end}. Enclose the @code{if}, @code{while}, @code{until} and @code{switch} -conditions in parentheses, like in C: +conditions in parentheses, like in C: @example @group @@ -267,7 +277,7 @@ for both function definitions and function calls. Recommended indent is 2 spaces. When indenting, indent the statement -after control structures (like @code{if}, @code{while}, etc.). If there +after control structures (like @code{if}, @code{while}, etc.). If there is a compound statement, indent @emph{both} the curly braces and the body of the statement (so that the body gets indented by @emph{two} indents). Example: @@ -286,7 +296,7 @@ @noindent If you have nested @code{if} statements, use extra braces for extra -clarification. +clarification. Split long expressions in such a way that a continuation line starts with an operator rather than identifier. If the split occurs inside diff --git a/scripts/general/interpn.m b/scripts/general/interpn.m --- a/scripts/general/interpn.m +++ b/scripts/general/interpn.m @@ -92,7 +92,7 @@ if (nargs == 2) if (ischar (varargin{2})) method = varargin{2}; - elseif (isnumeric (m) && isscalar (m) && round (m) == m) + elseif (isnumeric (m) && isscalar (m) && fix (m) == m) m = varargin{2}; else print_usage (); diff --git a/scripts/image/image.m b/scripts/image/image.m --- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -164,6 +164,7 @@ endfunction %!demo +%! clf %! img = 1 ./ hilb (11); %! x = -5:5; %! y = x; @@ -186,4 +187,40 @@ %! set (h, "cdatamapping", "scaled") %! title ('image (-x, -y, img)') +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! imagesc (g, g, sin (h)); +%! hold on +%! imagesc (g, g+12, cos (h/2)); +%! axis ([0 10 0 22]) +%! hold off +%! title ("two consecutive images") +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! imagesc (g, g, sin (h)); +%! hold all +%! plot (g, 11.0 * ones (size (g))) +%! imagesc (g, g+12, cos (h/2)); +%! axis ([0 10 0 22]) +%! hold off +%! title ("image, line, image") + +%!demo +%! clf +%! g = 0.1:0.1:10; +%! h = g'*g; +%! plot (g, 10.5 * ones (size (g))) +%! hold all +%! imagesc (g, g, sin (h)); +%! plot (g, 11.0 * ones (size (g))) +%! imagesc (g, g+12, cos (h/2)); +%! plot (g, 11.5 * ones (size (g))) +%! axis ([0 10 0 22]) +%! hold off +%! title ("line, image, line, image, line") + diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -350,6 +350,7 @@ endfunction %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(221); @@ -372,6 +373,7 @@ %! axis("normal"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(121); @@ -385,6 +387,7 @@ %! axis("xy"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(331); @@ -433,6 +436,7 @@ %! axis("on"); %!demo +%! clf %! t=0:0.01:2*pi; x=sin(t); %! %! subplot(321); @@ -493,3 +497,8 @@ %! legend ({"x >= 1", "x <= 1"}, "location", "north") %! title ("ylim = [1, 10]") +%!demo +%! clf +%! loglog (1:20, "-s") +%! axis tight + diff --git a/scripts/plot/contour.m b/scripts/plot/contour.m --- a/scripts/plot/contour.m +++ b/scripts/plot/contour.m @@ -71,11 +71,22 @@ endfunction %!demo +%! clf () %! [x, y, z] = peaks (); %! contour (x, y, z); %!demo +%! clf () %! [theta, r] = meshgrid (linspace (0, 2*pi, 64), linspace(0,1,64)); %! [X, Y] = pol2cart (theta, r); %! Z = sin(2*theta).*(1-r); %! contour(X, Y, abs(Z), 10) + +%!demo +%! clf () +%! x = linspace (-2, 2); +%! [x, y] = meshgrid (x); +%! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2+1); +%! contourf (x, y, z, [0.4, 0.4]) +%! title ("The hole should be filled with the background color") + diff --git a/scripts/plot/private/__contour__.m b/scripts/plot/private/__contour__.m --- a/scripts/plot/private/__contour__.m +++ b/scripts/plot/private/__contour__.m @@ -319,10 +319,18 @@ else ## Special case unclosed contours endif + if (isnan(cont_lev(idx))) + fc = get (ca, "color"); + if (strcmp (fc, "none")) + fc = get (ancestor (ca, "figure"), "color"); + endif + else + fc = "flat"; + endif h = [h; __go_patch__(ca, "xdata", ctmp(1, :)(:), "ydata", ctmp(2, :)(:), "vertices", ctmp.', "faces", 1:(cont_len(idx)-1), "facevertexcdata", cont_lev(idx), - "facecolor", "flat", "cdata", cont_lev(idx), + "facecolor", fc, "cdata", cont_lev(idx), "edgecolor", lc, "linestyle", ls, "linewidth", lw, "parent", hg)]; endfor diff --git a/scripts/plot/private/__go_draw_axes__.m b/scripts/plot/private/__go_draw_axes__.m --- a/scripts/plot/private/__go_draw_axes__.m +++ b/scripts/plot/private/__go_draw_axes__.m @@ -1583,6 +1583,13 @@ fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{1}, titlespec{1}, withclause{1}); elseif (is_image_data (1)) + if (numel (is_image_data) > 1 && is_image_data(2)) + ## Remove terminating semicolon + n = max (strfind (withclause{1}, ";")); + if (! isempty(n)) + withclause{1} = withclause{1}(1:n-1); + endif + endif fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, usingclause{1}, titlespec{1}, withclause{1}); else @@ -1604,9 +1611,20 @@ fputs (plot_stream, "unset obj 2; \\\n"); fg_is_set = false; endif + if (numel (is_image_data) > i && is_image_data(i+1)) + ## Remove terminating semicolon + n = max (strfind (withclause{i}, ";")); + if (! isempty(n)) + withclause{i} = withclause{i}(1:n-1); + endif + endif + fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, + usingclause{i}, titlespec{i}, withclause{i}); + else + ## For consecutive images continue with the same plot command + fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", ",", + usingclause{i}, titlespec{i}, withclause{i}); endif - fprintf (plot_stream, "%s \"-\" %s %s %s \\\n", plot_cmd, - usingclause{i}, titlespec{i}, withclause{i}); elseif (is_image_data (i-1)) if (bg_is_set) fputs (plot_stream, "unset obj 1; \\\n"); @@ -1973,61 +1991,67 @@ do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "border", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.xscale); + obj.interpreter, obj.xscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "border", - "", "", fontname, fontspec, obj.interpreter, obj.xscale); + "", "", fontname, fontspec, obj.interpreter, obj.xscale, + gnuplot_term); elseif (strcmpi (obj.xaxislocation, "zero")) do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "axis", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.xscale); + obj.interpreter, obj.xscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "axis", - "", "", fontname, fontspec, obj.interpreter, obj.xscale); + "", "", fontname, fontspec, obj.interpreter, obj.xscale, + gnuplot_term); else do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "border", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.xscale); + obj.interpreter, obj.xscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "border", - "", "", fontname, fontspec, obj.interpreter, obj.xscale); + "", "", fontname, fontspec, obj.interpreter, obj.xscale, + gnuplot_term); endif if (strcmpi (obj.yaxislocation, "right")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "border", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.yscale); + obj.interpreter, obj.yscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "border", - "", "", fontname, fontspec, obj.interpreter, obj.yscale); + "", "", fontname, fontspec, obj.interpreter, obj.yscale, + gnuplot_term); elseif (strcmpi (obj.yaxislocation, "zero")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "axis", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.yscale); + obj.interpreter, obj.yscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "axis", - "", "", fontname, fontspec, obj.interpreter, obj.yscale); + "", "", fontname, fontspec, obj.interpreter, obj.yscale, + gnuplot_term); else do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "border", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.yscale); + obj.interpreter, obj.yscale, gnuplot_term); do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "border", - "", "", fontname, fontspec, obj.interpreter, obj.yscale); + "", "", fontname, fontspec, obj.interpreter, obj.yscale, + gnuplot_term); endif do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode, obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono, "border", obj.tickdir, ticklength, fontname, fontspec, - obj.interpreter, obj.zscale); + obj.interpreter, obj.zscale, gnuplot_term); endfunction function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax, plot_stream, mirror, mono, axispos, tickdir, ticklength, - fontname, fontspec, interpreter, scale) + fontname, fontspec, interpreter, scale, gnuplot_term) persistent warned_latex = false; if (strcmpi (interpreter, "tex")) for n = 1 : numel(labels) @@ -2040,8 +2064,12 @@ endif endif if (strcmp (scale, "log")) - fmt = "10^{%T}"; num_mtics = 10; + if (any (strcmp (gnuplot_term, {"tikz", "pstex", "pslatex", "epslatex"}))) + fmt = "$10^{%T}$"; + else + fmt = "10^{%T}"; + endif else fmt = "%g"; num_mtics = 5; diff --git a/scripts/time/weekday.m b/scripts/time/weekday.m --- a/scripts/time/weekday.m +++ b/scripts/time/weekday.m @@ -61,7 +61,7 @@ if (nargout > 1) if (strcmpi (format, "long")) - names = {"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" + names = {"Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" \ "Friday" "Saturday"}; else names = {"Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat"}; @@ -96,6 +96,12 @@ %!assert(weekday('7-Feb-2008'),5) ## Test fractional dates %!assert(weekday(728647.1),2) +## Test "long" option +%!test +%! [a, b] = weekday ("25-Dec-1994", "long"); +%! assert (a, 1); +%! assert (b, "Sunday"); + # demos %!demo %! [n, s] = weekday (now ()) diff --git a/src/OPERATORS/op-fcm-fcm.cc b/src/OPERATORS/op-fcm-fcm.cc --- a/src/OPERATORS/op-fcm-fcm.cc +++ b/src/OPERATORS/op-fcm-fcm.cc @@ -214,7 +214,9 @@ DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix, float_complex_array, assign) -DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, complex_matrix, +DEFNDASSIGNOP_FN (dbl_clx_assign, float_complex_matrix, complex_matrix, + float_complex_array, assign) +DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, matrix, float_complex_array, assign) DEFNULLASSIGNOP_FN (null_assign, float_complex_matrix, delete_elements) @@ -308,7 +310,9 @@ INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_float_complex_matrix, assign); INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, - octave_complex_matrix, dbl_assign); + octave_complex_matrix, dbl_clx_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + octave_matrix, dbl_assign); INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_null_matrix, null_assign); diff --git a/src/OPERATORS/op-m-s.cc b/src/OPERATORS/op-m-s.cc --- a/src/OPERATORS/op-m-s.cc +++ b/src/OPERATORS/op-m-s.cc @@ -29,6 +29,7 @@ #include "ov.h" #include "ov-re-mat.h" #include "ov-flt-re-mat.h" +#include "ov-flt-cx-mat.h" #include "ov-scalar.h" #include "ov-typeinfo.h" #include "ops.h" @@ -106,6 +107,7 @@ DEFNDASSIGNOP_FN (assign, matrix, scalar, scalar, assign) DEFNDASSIGNOP_FN (sgl_assign, float_matrix, scalar, float_scalar, assign) +DEFNDASSIGNOP_FN (clx_sgl_assign, float_complex_matrix, scalar, float_complex, assign) DEFNDASSIGNOP_OP (assign_add, matrix, scalar, scalar, +=) DEFNDASSIGNOP_OP (assign_sub, matrix, scalar, scalar, -=) @@ -144,6 +146,7 @@ INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_scalar, assign); INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_scalar, sgl_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_scalar, clx_sgl_assign); INSTALL_ASSIGNOP (op_add_eq, octave_matrix, octave_scalar, assign_add); INSTALL_ASSIGNOP (op_sub_eq, octave_matrix, octave_scalar, assign_sub);