Mercurial > octave
changeset 22637:859d48b5648d
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Oct 2016 16:26:10 -0400 |
parents | ddbc3f9f0136 (diff) c44d57c0a925 (current diff) |
children | 2d9393be9a18 |
files | scripts/plot/util/private/__gnuplot_draw_axes__.m |
diffstat | 52 files changed, 1394 insertions(+), 1876 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Mon Oct 17 16:24:55 2016 -0400 +++ b/NEWS Mon Oct 17 16:26:10 2016 -0400 @@ -1,3 +1,45 @@ +Summary of important user-visible changes for version 4.4: +--------------------------------------------------------- + + ** Other new functions added in 4.4: + + gsvd + + ** Deprecated functions. + + The following functions have been deprecated in Octave 4.4 and will + be removed from Octave 4.8 (or whatever version is the second major + release after 4.4): + + Function | Replacement + ---------------------|------------------ + + + ** The following functions were deprecated in Octave 4.0 and have been + removed from Octave 4.4. + + allow_noninteger_range_as_index + bicubic + delaunay3 + do_braindead_shortcircuit_evaluation + dump_prefs + find_dir_in_path + finite + fmod + fnmatch + gmap40 + loadaudio + luinc + mouse_wheel_zoom + nfields + octave_tmp_file_name + playaudio + saveaudio + setaudio + syl + usage + + Summary of important user-visible changes for version 4.2: ---------------------------------------------------------
--- a/configure.ac Mon Oct 17 16:24:55 2016 -0400 +++ b/configure.ac Mon Oct 17 16:26:10 2016 -0400 @@ -19,14 +19,14 @@ ### <http://www.gnu.org/licenses/>. AC_PREREQ([2.63]) -AC_INIT([GNU Octave], [4.2.0-rc2], [http://octave.org/bugs.html], [octave]) +AC_INIT([GNU Octave], [4.3.0+], [http://octave.org/bugs.html], [octave]) dnl Note that the version number is duplicated here and in AC_INIT dnl because AC_INIT requires it to be static, not computed from dnl shell variables. OCTAVE_MAJOR_VERSION=4 -OCTAVE_MINOR_VERSION=2 -OCTAVE_PATCH_VERSION=0-rc2 +OCTAVE_MINOR_VERSION=3 +OCTAVE_PATCH_VERSION=0+ dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg OCTAVE_VERSION="$PACKAGE_VERSION"
--- a/doc/interpreter/expr.txi Mon Oct 17 16:24:55 2016 -0400 +++ b/doc/interpreter/expr.txi Mon Oct 17 16:26:10 2016 -0400 @@ -319,8 +319,6 @@ @DOCSTRING(isindex) -@DOCSTRING(allow_noninteger_range_as_index) - @node Calling Functions @section Calling Functions @@ -1009,12 +1007,10 @@ @sc{matlab} has special behavior that allows the operators @samp{&} and @samp{|} to short-circuit when used in the truth expression for @code{if} and -@code{while} statements. Octave also behaves the same way by default, -though the use of the @samp{&} and @samp{|} operators in this way is -strongly discouraged. Instead, you should use the @samp{&&} and @samp{||} -operators that always have short-circuit behavior. - -@DOCSTRING(do_braindead_shortcircuit_evaluation) +@code{while} statements. Octave behaves the same way for compatibility, +however, the use of the @samp{&} and @samp{|} operators in this way is +strongly discouraged and a warning will be issued. Instead, you should use +the @samp{&&} and @samp{||} operators that always have short-circuit behavior. Finally, the ternary operator (?:) is not supported in Octave. If short-circuiting is not important, it can be replaced by the @code{ifelse}
--- a/doc/interpreter/grammar.txi Mon Oct 17 16:24:55 2016 -0400 +++ b/doc/interpreter/grammar.txi Mon Oct 17 16:26:10 2016 -0400 @@ -64,8 +64,7 @@ The parser has a number of variables that affect its internal operation. These variables are generally documented in the manual alongside the code that -they affect. For example, @code{allow_noninteger_range_as_index} is discussed -in the section on index expressions. +they affect. In addition, there are three non-specific parser customization functions. @code{add_input_event_hook} can be used to schedule a user function for
--- a/doc/interpreter/linalg.txi Mon Oct 17 16:24:55 2016 -0400 +++ b/doc/interpreter/linalg.txi Mon Oct 17 16:26:10 2016 -0400 @@ -108,6 +108,8 @@ @DOCSTRING(givens) +@DOCSTRING(gsvd) + @DOCSTRING(planerot) @DOCSTRING(inv)
--- a/libgui/graphics/QtHandlesUtils.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libgui/graphics/QtHandlesUtils.cc Mon Oct 17 16:26:10 2016 -0400 @@ -124,7 +124,7 @@ mapsInitialized = true; } - f.setPointSizeF (props.get_fontsize_points (height)); + f.setPointSizeF (props.get___fontsize_points__ (height)); f.setWeight (weightMap[props.get_fontweight ()]); f.setStyle (angleMap[props.get_fontangle ()]);
--- a/libinterp/corefcn/data.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/data.cc Mon Oct 17 16:26:10 2016 -0400 @@ -3549,6 +3549,49 @@ return retval; } +/* +%!error <undefined> 1+Infj +%!error <undefined> 1+Infi + +%!test <31974> +%! assert (Inf + Inf*i, complex (Inf, Inf)) +%! +%! assert (1 + Inf*i, complex (1, Inf)) +%! assert (1 + Inf*j, complex (1, Inf)) +%! +%! ## whitespace should not affect parsing +%! assert (1+Inf*i, complex (1, Inf)) +%! assert (1+Inf*j, complex (1, Inf)) +%! +%! assert (NaN*j, complex (0, NaN)) +%! +%! assert (Inf * 4j, complex (0, Inf)) + +%!test <31974> +%! x = Inf; +%! assert (x * j, complex (0, Inf)) +%! j = complex (0, 1); +%! assert (Inf * j, complex (0, Inf)) + +%!test <31974> +%! exp = complex (zeros (2, 2), Inf (2, 2)); +%! assert (Inf (2, 2) * j, exp) +%! assert (Inf (2, 2) .* j, exp) +%! assert (Inf * (ones (2, 2) * j), exp) +%! assert (Inf (2, 2) .* (ones (2, 2) * j), exp) + +%!test <31974> +%! assert ([Inf; 0] * [i, 0], complex ([NaN NaN; 0 0], [Inf NaN; 0 0])) +%! assert ([Inf, 0] * [i; 0], complex (NaN, Inf)) +%! assert ([Inf, 0] .* [i, 0], complex ([0 0], [Inf 0])) + +%!test <31974> +%! m = @(x, y) x * y; +%! d = @(x, y) x / y; +%! assert (m (Inf, i), complex (0, +Inf)) +%! assert (d (Inf, i), complex (0, -Inf)) +*/ + DEFUN (isreal, args, , doc: /* -*- texinfo -*- @deftypefn {} {} isreal (@var{x})
--- a/libinterp/corefcn/dlmread.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/dlmread.cc Mon Oct 17 16:26:10 2016 -0400 @@ -302,8 +302,10 @@ // correspond to whitespace as delimter. if (! sep.length ()) { - size_t n = line.find_first_of (",:; \t", - line.find_first_of ("0123456789")); + // Skip leading whitespace. + size_t pos1 = line.find_first_not_of (" \t"); + + size_t n = line.find_first_of (",:; \t", pos1); if (n == std::string::npos) { sep = " \t";
--- a/libinterp/corefcn/gl-render.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/gl-render.cc Mon Oct 17 16:26:10 2016 -0400 @@ -1376,7 +1376,7 @@ && (minorgridstyle != "none")); bool do_xminortick = props.is_xminortick (); Matrix xticks = xform.xscale (props.get_xtick ().matrix_value ()); - Matrix xmticks = xform.xscale (props.get_xmtick ().matrix_value ()); + Matrix xmticks = xform.xscale (props.get_xminortickvalues ().matrix_value ()); string_vector xticklabels = props.get_xticklabel ().string_vector_value (); int wmax = 0; int hmax = 0; @@ -1513,7 +1513,7 @@ && (minorgridstyle != "none")); bool do_yminortick = props.is_yminortick (); Matrix yticks = xform.yscale (props.get_ytick ().matrix_value ()); - Matrix ymticks = xform.yscale (props.get_ymtick ().matrix_value ()); + Matrix ymticks = xform.yscale (props.get_yminortickvalues ().matrix_value ()); string_vector yticklabels = props.get_yticklabel ().string_vector_value (); int wmax = 0; int hmax = 0; @@ -1641,7 +1641,7 @@ && (minorgridstyle != "none")); bool do_zminortick = props.is_zminortick (); Matrix zticks = xform.zscale (props.get_ztick ().matrix_value ()); - Matrix zmticks = xform.zscale (props.get_zmtick ().matrix_value ()); + Matrix zmticks = xform.zscale (props.get_zminortickvalues ().matrix_value ()); string_vector zticklabels = props.get_zticklabel ().string_vector_value (); int wmax = 0; int hmax = 0; @@ -3587,7 +3587,7 @@ txt_renderer.set_font (props.get ("fontname").string_value (), props.get ("fontweight").string_value (), props.get ("fontangle").string_value (), - props.get ("fontsize_points").double_value ()); + props.get ("__fontsize_points__").double_value ()); } void
--- a/libinterp/corefcn/gl2ps-print.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/gl2ps-print.cc Mon Oct 17 16:26:10 2016 -0400 @@ -678,7 +678,7 @@ if (props.has_property ("interpreter")) set_interpreter (props.get ("interpreter").string_value ()); - fontsize = props.get ("fontsize_points").double_value (); + fontsize = props.get ("__fontsize_points__").double_value (); caseless_str fn = props.get ("fontname").xtolower ().string_value (); bool isbold =
--- a/libinterp/corefcn/graphics.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/graphics.cc Mon Oct 17 16:26:10 2016 -0400 @@ -4552,10 +4552,10 @@ xset (zlabel.handle_value (), "clipping", "off"); xset (title.handle_value (), "clipping", "off"); - xset (xlabel.handle_value (), "autopos_tag", "xlabel"); - xset (ylabel.handle_value (), "autopos_tag", "ylabel"); - xset (zlabel.handle_value (), "autopos_tag", "zlabel"); - xset (title.handle_value (), "autopos_tag", "title"); + xset (xlabel.handle_value (), "__autopos_tag__", "xlabel"); + xset (ylabel.handle_value (), "__autopos_tag__", "ylabel"); + xset (zlabel.handle_value (), "__autopos_tag__", "zlabel"); + xset (title.handle_value (), "__autopos_tag__", "title"); adopt (xlabel.handle_value ()); adopt (ylabel.handle_value ()); @@ -4743,7 +4743,7 @@ xset (xlabel.handle_value (), "verticalalignmentmode", "auto"); xset (xlabel.handle_value (), "clipping", "off"); xset (xlabel.handle_value (), "color", get_xcolor ()); - xset (xlabel.handle_value (), "autopos_tag", "xlabel"); + xset (xlabel.handle_value (), "__autopos_tag__", "xlabel"); update_xlabel_position (); } @@ -4757,7 +4757,7 @@ xset (ylabel.handle_value (), "verticalalignmentmode", "auto"); xset (ylabel.handle_value (), "clipping", "off"); xset (ylabel.handle_value (), "color", get_ycolor ()); - xset (ylabel.handle_value (), "autopos_tag", "ylabel"); + xset (ylabel.handle_value (), "__autopos_tag__", "ylabel"); update_ylabel_position (); } @@ -4771,7 +4771,7 @@ xset (zlabel.handle_value (), "verticalalignmentmode", "auto"); xset (zlabel.handle_value (), "clipping", "off"); xset (zlabel.handle_value (), "color", get_zcolor ()); - xset (zlabel.handle_value (), "autopos_tag", "zlabel"); + xset (zlabel.handle_value (), "__autopos_tag__", "zlabel"); update_zlabel_position (); } @@ -4785,7 +4785,7 @@ xset (title.handle_value (), "verticalalignment", "bottom"); xset (title.handle_value (), "verticalalignmentmode", "auto"); xset (title.handle_value (), "clipping", "off"); - xset (title.handle_value (), "autopos_tag", "title"); + xset (title.handle_value (), "__autopos_tag__", "title"); update_title_position (); } @@ -5013,10 +5013,10 @@ xset (zlabel.handle_value (), "clipping", "off"); xset (title.handle_value (), "clipping", "off"); - xset (xlabel.handle_value (), "autopos_tag", "xlabel"); - xset (ylabel.handle_value (), "autopos_tag", "ylabel"); - xset (zlabel.handle_value (), "autopos_tag", "zlabel"); - xset (title.handle_value (), "autopos_tag", "title"); + xset (xlabel.handle_value (), "__autopos_tag__", "xlabel"); + xset (ylabel.handle_value (), "__autopos_tag__", "ylabel"); + xset (zlabel.handle_value (), "__autopos_tag__", "zlabel"); + xset (title.handle_value (), "__autopos_tag__", "title"); update_transform (); sync_positions (); @@ -6264,7 +6264,7 @@ txt_renderer.set_font (get ("fontname").string_value (), get ("fontweight").string_value (), get ("fontangle").string_value (), - get ("fontsize_points").double_value ()); + get ("__fontsize_points__").double_value ()); } // The INTERNAL flag defines whether position or outerposition is used. @@ -6588,7 +6588,7 @@ } double -axes::properties::get_fontsize_points (double box_pix_height) const +axes::properties::get___fontsize_points__ (double box_pix_height) const { double fontsz = get_fontsize (); double parent_height = box_pix_height; @@ -8040,7 +8040,7 @@ txt_renderer.set_font (get ("fontname").string_value (), get ("fontweight").string_value (), get ("fontangle").string_value (), - get ("fontsize_points").double_value ()); + get ("__fontsize_points__").double_value ()); txt_renderer.set_color (get_color_rgb ()); } @@ -8082,17 +8082,17 @@ // performed in get_extent. set_extent (bbox); - if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") - || autopos_tag_is ("zlabel") || autopos_tag_is ("title")) + if (__autopos_tag___is ("xlabel") || __autopos_tag___is ("ylabel") + || __autopos_tag___is ("zlabel") || __autopos_tag___is ("title")) update_autopos ("sync"); } void text::properties::request_autopos (void) { - if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") - || autopos_tag_is ("zlabel") || autopos_tag_is ("title")) - update_autopos (get_autopos_tag ()); + if (__autopos_tag___is ("xlabel") || __autopos_tag___is ("ylabel") + || __autopos_tag___is ("zlabel") || __autopos_tag___is ("title")) + update_autopos (get___autopos_tag__ ()); } void @@ -8131,7 +8131,7 @@ } double -text::properties::get_fontsize_points (double box_pix_height) const +text::properties::get___fontsize_points__ (double box_pix_height) const { double fontsz = get_fontsize (); double parent_height = box_pix_height; @@ -8871,7 +8871,7 @@ } double -uicontrol::properties::get_fontsize_points (double box_pix_height) const +uicontrol::properties::get___fontsize_points__ (double box_pix_height) const { double fontsz = get_fontsize (); double parent_height = box_pix_height; @@ -9003,7 +9003,7 @@ } double -uibuttongroup::properties::get_fontsize_points (double box_pix_height) const +uibuttongroup::properties::get___fontsize_points__ (double box_pix_height) const { double fontsz = get_fontsize (); double parent_height = box_pix_height; @@ -9174,7 +9174,7 @@ } double -uipanel::properties::get_fontsize_points (double box_pix_height) const +uipanel::properties::get___fontsize_points__ (double box_pix_height) const { double fontsz = get_fontsize (); double parent_height = box_pix_height;
--- a/libinterp/corefcn/graphics.in.h Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/graphics.in.h Mon Oct 17 16:26:10 2016 -0400 @@ -3661,7 +3661,7 @@ Matrix get_extent (bool with_text = false, bool only_text_height=false) const; - double get_fontsize_points (double box_pix_height = 0) const; + double get___fontsize_points__ (double box_pix_height = 0) const; void update_boundingbox (void) { @@ -3927,7 +3927,7 @@ // Octave-specific properties double_property mousewheelzoom , 0.5 // hidden properties for alignment of subplots - radio_property autopos_tag h , "{none}|subplot" + radio_property __autopos_tag__ h , "{none}|subplot" // hidden properties for inset array_property looseinset hu , Matrix (1, 4, 0.0) // hidden properties for transformation computation @@ -3937,11 +3937,11 @@ array_property x_normrendertransform h , Matrix (4, 4, 0.0) array_property x_rendertransform h , Matrix (4, 4, 0.0) // hidden properties for minor ticks - row_vector_property xmtick h , Matrix () - row_vector_property ymtick h , Matrix () - row_vector_property zmtick h , Matrix () + row_vector_property xminortickvalues h , Matrix () + row_vector_property yminortickvalues h , Matrix () + row_vector_property zminortickvalues h , Matrix () // hidden property for text rendering - double_property fontsize_points hgr , 0 + double_property __fontsize_points__ hgr , 0 END_PROPERTIES protected: @@ -4036,8 +4036,8 @@ { if (xtickmode.is ("auto")) { - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), - xscale.is ("log")); + calc_ticks_and_lims (xlim, xtick, xminortickvalues, + xlimmode.is ("auto"), xscale.is ("log")); update_xtick (); } } @@ -4045,8 +4045,8 @@ { if (ytickmode.is ("auto")) { - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), - yscale.is ("log")); + calc_ticks_and_lims (ylim, ytick, yminortickvalues, + ylimmode.is ("auto"), yscale.is ("log")); update_ytick (); } } @@ -4054,8 +4054,8 @@ { if (ztickmode.is ("auto")) { - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), - zscale.is ("log")); + calc_ticks_and_lims (zlim, ztick, zminortickvalues, + zlimmode.is ("auto"), zscale.is ("log")); update_ztick (); } } @@ -4218,8 +4218,8 @@ void update_xlim () { if (xtickmode.is ("auto")) - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), - xscale.is ("log")); + calc_ticks_and_lims (xlim, xtick, xminortickvalues, + xlimmode.is ("auto"), xscale.is ("log")); if (xticklabelmode.is ("auto")) calc_ticklabels (xtick, xticklabel, xscale.is ("log")); @@ -4233,8 +4233,8 @@ void update_ylim (void) { if (ytickmode.is ("auto")) - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), - yscale.is ("log")); + calc_ticks_and_lims (ylim, ytick, yminortickvalues, + ylimmode.is ("auto"), yscale.is ("log")); if (yticklabelmode.is ("auto")) calc_ticklabels (ytick, yticklabel, yscale.is ("log")); @@ -4248,8 +4248,8 @@ void update_zlim (void) { if (ztickmode.is ("auto")) - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), - zscale.is ("log")); + calc_ticks_and_lims (zlim, ztick, zminortickvalues, + zlimmode.is ("auto"), zscale.is ("log")); if (zticklabelmode.is ("auto")) calc_ticklabels (ztick, zticklabel, zscale.is ("log")); @@ -4447,7 +4447,7 @@ class OCTINTERP_API properties : public base_properties { public: - double get_fontsize_points (double box_pix_height = 0) const; + double get___fontsize_points__ (double box_pix_height = 0) const; void set_position (const octave_value& val) { @@ -4510,9 +4510,9 @@ radio_property rotationmode hu , "{auto}|manual" radio_property horizontalalignmentmode hu , "{auto}|manual" radio_property verticalalignmentmode hu , "{auto}|manual" - radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title" + radio_property __autopos_tag__ h , "{none}|xlabel|ylabel|zlabel|title" // hidden property for text rendering - double_property fontsize_points hgr , 0 + double_property __fontsize_points__ hgr , 0 END_PROPERTIES Matrix get_data_position (void) const; @@ -5375,7 +5375,7 @@ double_property position , 0 bool_property separator , "off" // Octave-specific properties - string_property fltk_label h , "" + string_property __fltk_label__ h , "" END_PROPERTIES protected: @@ -5486,7 +5486,7 @@ Matrix get_boundingbox (bool internal = false, const Matrix& parent_pix_size = Matrix ()) const; - double get_fontsize_points (double box_pix_height = 0) const; + double get___fontsize_points__ (double box_pix_height = 0) const; // See the genprops.awk script for an explanation of the // properties declarations. @@ -5584,7 +5584,7 @@ Matrix get_boundingbox (bool internal = false, const Matrix& parent_pix_size = Matrix ()) const; - double get_fontsize_points (double box_pix_height = 0) const; + double get___fontsize_points__ (double box_pix_height = 0) const; // See the genprops.awk script for an explanation of the // properties declarations. @@ -5669,7 +5669,7 @@ Matrix get_boundingbox (bool internal = false, const Matrix& parent_pix_size = Matrix ()) const; - double get_fontsize_points (double box_pix_height = 0) const; + double get___fontsize_points__ (double box_pix_height = 0) const; // See the genprops.awk script for an explanation of the // properties declarations.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libinterp/corefcn/gsvd.cc Mon Oct 17 16:26:10 2016 -0400 @@ -0,0 +1,402 @@ +// Copyright (C) 2016 Barbara Lócsi +// Copyright (C) 2006, 2010 Pascal Dupuis <Pascal.Dupuis@uclouvain.be> +// Copyright (C) 1996, 1997 John W. Eaton +// +// This program 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. +// +// This program 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 +// this program; if not, see <http://www.gnu.org/licenses/>. + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "dMatrix.h" +#include "CMatrix.h" +#include "dDiagMatrix.h" +#include "gsvd.h" + +#include "defun.h" +#include "defun-int.h" +#include "error.h" +#include "errwarn.h" +#include "utils.h" +#include "ovl.h" +#include "ov.h" + + +template <typename T> +static typename octave::math::gsvd<T>::Type +gsvd_type (int nargout) +{ + return ((nargout == 0 || nargout == 1) + ? octave::math::gsvd<T>::Type::sigma_only + : (nargout > 5) ? octave::math::gsvd<T>::Type::std + : octave::math::gsvd<T>::Type::economy); +} + +// Named like this to avoid conflicts with the gsvd class. +template <typename T> +static octave_value_list +function_gsvd (const T& A, const T& B, const octave_idx_type nargout) +{ + octave::math::gsvd<T> result (A, B, gsvd_type<T> (nargout)); + + octave_value_list retval (nargout); + if (nargout < 2) + { + DiagMatrix sigA = result.singular_values_A (); + DiagMatrix sigB = result.singular_values_B (); + for (int i = sigA.rows () - 1; i >= 0; i--) + sigA.dgxelem(i) /= sigB.dgxelem(i); + retval(0) = sigA.diag (); + } + else + { + retval(0) = result.left_singular_matrix_A (); + retval(1) = result.left_singular_matrix_B (); + if (nargout > 2) + retval(2) = result.right_singular_matrix (); + if (nargout > 3) + retval(3) = result.singular_values_A (); + if (nargout > 4) + retval(4) = result.singular_values_B (); + if (nargout > 5) + retval(5) = result.R_matrix (); + } + return retval; +} + +DEFUN (gsvd, args, nargout, + doc: /* -*- texinfo -*- +@deftypefn {} {@var{S} =} gsvd (@var{A}, @var{B}) +@deftypefnx {} {[@var{U}, @var{V}, @var{X}, @var{C}, @var{S}] =} gsvd (@var{A}, @var{B}) +@deftypefnx {} {[@var{U}, @var{V}, @var{X}, @var{C}, @var{S}] =} gsvd (@var{A}, @var{B}, 0) +Compute the generalized singular value decomposition of (@var{A}, @var{B}): + +@tex +$$ A = U C X^\dagger $$ +$$ B = V S X^\dagger $$ +$$ C^\dagger C + S^\dagger S = eye (columns (A)) $$ +@end tex +@ifnottex + +@example +@group +A = U*C*X' +B = V*S*X' +C'*C + S'*S = eye (columns (A)) +@end group +@end example + +@end ifnottex + +The function @code{gsvd} normally returns just the vector of generalized singular values +@tex +$$ \sqrt{{{diag (C^\dagger C)} \over {diag (S^\dagger S)}}} $$ +@end tex +@ifnottex +@code{sqrt (diag (C'*C) ./ diag (S'*S))}. +@end ifnottex +If asked for five return values, it also computes +@tex +$U$, $V$, $X$, and $C$. +@end tex +@ifnottex +U, V, X, and C. +@end ifnottex + +If the optional third input is present, @code{gsvd} constructs the +"economy-sized" decomposition where the number of columns of @var{U}, @var{V} +and the number of rows of @var{C}, @var{S} is less than or equal to the number +of columns of @var{A}. This option is not yet implemented. + +Programming Note: the code is a wrapper to the corresponding @sc{lapack} dggsvd +and zggsvd routines. + +@seealso{svd} +@end deftypefn */) +{ + int nargin = args.length (); + + if (nargin < 2 || nargin > 3) + print_usage (); + else if (nargin == 3) + warning ("gsvd: economy-sized decomposition is not yet implemented, returning full decomposition"); + + octave_value_list retval; + + octave_value argA = args(0); + octave_value argB = args(1); + + octave_idx_type nr = argA.rows (); + octave_idx_type nc = argA.columns (); + + octave_idx_type np = argB.columns (); + + // FIXME: This "special" case should be handled in the gsvd class, not here + if (nr == 0 || nc == 0) + { + retval = octave_value_list (nargout); + if (nargout < 2) // S = gsvd (A, B) + retval(0) = Matrix (0, 1); + else // [U, V, X, C, S, R] = gsvd (A, B) + { + retval(0) = identity_matrix (nc, nc); + retval(1) = identity_matrix (nc, nc); + if (nargout > 2) + retval(2) = identity_matrix (nr, nr); + if (nargout > 3) + retval(3) = Matrix (nr, nc); + if (nargout > 4) + retval(4) = identity_matrix (nr, nr); + if (nargout > 5) + retval(5) = identity_matrix (nr, nr); + } + } + else + { + if (nc != np) + print_usage (); + + // FIXME: Remove when interface to gsvd single class has been written + if (argA.is_single_type () && argB.is_single_type ()) + warning ("gsvd: no implementation for single matrices, converting to double"); + + if (argA.is_real_type () && argB.is_real_type ()) + { + Matrix tmpA = argA.xmatrix_value ("gsvd: A must be a real or complex matrix"); + Matrix tmpB = argB.xmatrix_value ("gsvd: B must be a real or complex matrix"); + + if (tmpA.any_element_is_inf_or_nan ()) + error ("gsvd: A cannot have Inf or NaN values"); + if (tmpB.any_element_is_inf_or_nan ()) + error ("gsvd: B cannot have Inf or NaN values"); + + retval = function_gsvd (tmpA, tmpB, nargout); + } + else if (argA.is_complex_type () || argB.is_complex_type ()) + { + ComplexMatrix ctmpA = argA.xcomplex_matrix_value ("gsvd: A must be a real or complex matrix"); + ComplexMatrix ctmpB = argB.xcomplex_matrix_value ("gsvd: B must be a real or complex matrix"); + + if (ctmpA.any_element_is_inf_or_nan ()) + error ("gsvd: A cannot have Inf or NaN values"); + if (ctmpB.any_element_is_inf_or_nan ()) + error ("gsvd: B cannot have Inf or NaN values"); + + retval = function_gsvd (ctmpA, ctmpB, nargout); + } + else + error ("gsvd: A and B must be real or complex matrices"); + } + + return retval; +} + +/* + +## Basic test of decomposition +%!test <48807> +%! A = reshape (1:15,5,3); +%! B = magic (3); +%! [U,V,X,C,S] = gsvd (A,B); +%! assert (U*C*X', A, 50*eps); +%! assert (V*S*X', B, 50*eps); +%! S0 = gsvd (A, B); +%! S1 = svd (A / B); +%! assert (S0, S1, 10*eps); + +## a few tests for gsvd.m +%!shared A, A0, B, B0, U, V, C, S, X, R, D1, D2 +%! A0 = randn (5, 3); +%! B0 = diag ([1 2 4]); +%! A = A0; +%! B = B0; + +## A (5x3) and B (3x3) are full rank +%!test <48807> +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros (5, 3); D1(1:3, 1:3) = C; +%! D2 = S; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 5x3 full rank, B: 3x3 rank deficient +%!test <48807> +%! B(2, 2) = 0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros (5, 3); D1(1, 1) = 1; D1(2:3, 2:3) = C; +%! D2 = [zeros(2, 1) S; zeros(1, 3)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 5x3 rank deficient, B: 3x3 full rank +%!test <48807> +%! B = B0; +%! A(:, 3) = 2*A(:, 1) - A(:, 2); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 3); D1(1:3, 1:3) = C; +%! D2 = S; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A and B are both rank deficient +%!test <48807> +%! B(:, 3) = 2*B(:, 1) - B(:, 2); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 2); D1(1:2, 1:2) = C; +%! D2 = [S; zeros(1, 2)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*[zeros(2, 1) R]) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*[zeros(2, 1) R]) <= 1e-6); + +## A (now 3x5) and B (now 5x5) are full rank +%!test <48807> +%! A = A0.'; +%! B0 = diag ([1 2 4 8 16]); +%! B = B0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = [C zeros(3,2)]; +%! D2 = [S zeros(3,2); zeros(2, 3) eye(2)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 3x5 full rank, B: 5x5 rank deficient +%!test <48807> +%! B(2, 2) = 0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(3, 5); D1(1, 1) = 1; D1(2:3, 2:3) = C; +%! D2 = zeros(5, 5); D2(1:2, 2:3) = S; D2(3:4, 4:5) = eye (2); +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 3x5 rank deficient, B: 5x5 full rank +%!test <48807> +%! B = B0; +%! A(3, :) = 2*A(1, :) - A(2, :); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros (3, 5); D1(1:3, 1:3) = C; +%! D2 = zeros (5, 5); D2(1:3, 1:3) = S; D2(4:5, 4:5) = eye (2); +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A and B are both rank deficient +%!test <48807> +%! A = A0.'; B = B0.'; +%! A(:, 3) = 2*A(:, 1) - A(:, 2); +%! B(:, 3) = 2*B(:, 1) - B(:, 2); +%! [U, V, X, C, S, R]=gsvd (A, B); +%! D1 = zeros(3, 4); D1(1:3, 1:3) = C; +%! D2 = eye (4); D2(1:3, 1:3) = S; D2(5,:) = 0; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*[zeros(4, 1) R]) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*[zeros(4, 1) R]) <= 1e-6); + +## A: 5x3 complex full rank, B: 3x3 complex full rank +%!test <48807> +%! A0 = A0 + j*randn (5, 3); +%! B0 = diag ([1 2 4]) + j*diag ([4 -2 -1]); +%! A = A0; +%! B = B0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 3); D1(1:3, 1:3) = C; +%! D2 = S; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 5x3 complex full rank, B: 3x3 complex rank deficient +%!test <48807> +%! B(2, 2) = 0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 3); D1(1, 1) = 1; D1(2:3, 2:3) = C; +%! D2 = [zeros(2, 1) S; zeros(1, 3)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 5x3 complex rank deficient, B: 3x3 complex full rank +%!test <48807> +%! B = B0; +%! A(:, 3) = 2*A(:, 1) - A(:, 2); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 3); D1(1:3, 1:3) = C; +%! D2 = S; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A (5x3) and B (3x3) are both complex rank deficient +%!test <48807> +%! B(:, 3) = 2*B(:, 1) - B(:, 2); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(5, 2); D1(1:2, 1:2) = C; +%! D2 = [S; zeros(1, 2)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*[zeros(2, 1) R]) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*[zeros(2, 1) R]) <= 1e-6); + +## A (now 3x5) complex and B (now 5x5) complex are full rank +## now, A is 3x5 +%!test <48807> +%! A = A0.'; +%! B0 = diag ([1 2 4 8 16]) + j*diag ([-5 4 -3 2 -1]); +%! B = B0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = [C zeros(3,2)]; +%! D2 = [S zeros(3,2); zeros(2, 3) eye(2)]; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 3x5 complex full rank, B: 5x5 complex rank deficient +%!test <48807> +%! B(2, 2) = 0; +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(3, 5); D1(1, 1) = 1; D1(2:3, 2:3) = C; +%! D2 = zeros(5,5); D2(1:2, 2:3) = S; D2(3:4, 4:5) = eye (2); +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (2, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A: 3x5 complex rank deficient, B: 5x5 complex full rank +%!test <48807> +%! B = B0; +%! A(3, :) = 2*A(1, :) - A(2, :); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(3, 5); D1(1:3, 1:3) = C; +%! D2 = zeros(5,5); D2(1:3, 1:3) = S; D2(4:5, 4:5) = eye (2); +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*R) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*R) <= 1e-6); + +## A and B are both complex rank deficient +%!test <48807> +%! A = A0.'; +%! B = B0.'; +%! A(:, 3) = 2*A(:, 1) - A(:, 2); +%! B(:, 3) = 2*B(:, 1) - B(:, 2); +%! [U, V, X, C, S, R] = gsvd (A, B); +%! D1 = zeros(3, 4); D1(1:3, 1:3) = C; +%! D2 = eye (4); D2(1:3, 1:3) = S; D2(5,:) = 0; +%! assert (norm (diag (C).^2 + diag (S).^2 - ones (3, 1)) <= 1e-6); +%! assert (norm ((U'*A*X) - D1*[zeros(4, 1) R]) <= 1e-6); +%! assert (norm ((V'*B*X) - D2*[zeros(4, 1) R]) <= 1e-6); + +*/ +
--- a/libinterp/corefcn/module.mk Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/module.mk Mon Oct 17 16:26:10 2016 -0400 @@ -173,6 +173,7 @@ libinterp/corefcn/gl2ps-print.cc \ libinterp/corefcn/graphics.cc \ libinterp/corefcn/gripes.cc \ + libinterp/corefcn/gsvd.cc \ libinterp/corefcn/hash.cc \ libinterp/corefcn/help.cc \ libinterp/corefcn/hess.cc \
--- a/libinterp/corefcn/svd.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/corefcn/svd.cc Mon Oct 17 16:26:10 2016 -0400 @@ -38,13 +38,22 @@ template <typename T> static typename octave::math::svd<T>::Type -svd_type (int nargin, int nargout) +svd_type (int nargin, int nargout, const octave_value_list & args, const T & A) { - return ((nargout == 0 || nargout == 1) - ? octave::math::svd<T>::Type::sigma_only - : ((nargin == 2) - ? octave::math::svd<T>::Type::economy - : octave::math::svd<T>::Type::std)); + if (nargout == 0 || nargout == 1) + return octave::math::svd<T>::Type::sigma_only; + else if (nargin == 1) + return octave::math::svd<T>::Type::std; + else + if (! args(1).is_real_scalar ()) + return octave::math::svd<T>::Type::economy; + else + { + if (A.rows () > A.columns ()) + return octave::math::svd<T>::Type::economy; + else + return octave::math::svd<T>::Type::std; + } } template <typename T> @@ -60,7 +69,8 @@ doc: /* -*- texinfo -*- @deftypefn {} {@var{s} =} svd (@var{A}) @deftypefnx {} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}) -@deftypefnx {} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}, @var{econ}) +@deftypefnx {} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}, "econ") +@deftypefnx {} {[@var{U}, @var{S}, @var{V}] =} svd (@var{A}, 0) @cindex singular value decomposition Compute the singular value decomposition of @var{A} @tex @@ -135,9 +145,14 @@ @end group @end example -If given a second argument, @code{svd} returns an economy-sized +When given a second argument that is not 0, @code{svd} returns an economy-sized decomposition, eliminating the unnecessary rows or columns of @var{U} or @var{V}. + +If the second argument is exactly 0, then the choice of decomposition is based +on the matrix @var{A}. If @var{A} has more rows than columns then an +economy-sized decomposition is returned, otherwise a regular decomposition +is calculated. @seealso{svd_driver, svds, eig, lu, chol, hess, qr, qz} @end deftypefn */) { @@ -165,7 +180,8 @@ error ("svd: cannot take SVD of matrix containing Inf or NaN values"); octave::math::svd<FloatMatrix> result - (tmp, svd_type<FloatMatrix> (nargin, nargout), + (tmp, + svd_type<FloatMatrix> (nargin, nargout, args, tmp), svd_driver<FloatMatrix> ()); FloatDiagMatrix sigma = result.singular_values (); @@ -185,7 +201,8 @@ error ("svd: cannot take SVD of matrix containing Inf or NaN values"); octave::math::svd<FloatComplexMatrix> result - (ctmp, svd_type<FloatComplexMatrix> (nargin, nargout), + (ctmp, + svd_type<FloatComplexMatrix> (nargin, nargout, args, ctmp), svd_driver<FloatComplexMatrix> ()); FloatDiagMatrix sigma = result.singular_values (); @@ -208,7 +225,8 @@ error ("svd: cannot take SVD of matrix containing Inf or NaN values"); octave::math::svd<Matrix> result - (tmp, svd_type<Matrix> (nargin, nargout), + (tmp, + svd_type<Matrix> (nargin, nargout, args, tmp), svd_driver<Matrix> ()); DiagMatrix sigma = result.singular_values (); @@ -228,7 +246,8 @@ error ("svd: cannot take SVD of matrix containing Inf or NaN values"); octave::math::svd<ComplexMatrix> result - (ctmp, svd_type<ComplexMatrix> (nargin, nargout), + (ctmp, + svd_type<ComplexMatrix> (nargin, nargout, args, ctmp), svd_driver<ComplexMatrix> ()); DiagMatrix sigma = result.singular_values (); @@ -255,7 +274,6 @@ [u,s,v] = svd (a); assert (a, u * s * v', 128 * eps); - %!test %! [u, s, v] = svd ([1, 2; 2, 1]); %! x = 1 / sqrt (2); @@ -326,6 +344,12 @@ %! assert (size (s), [0, 0]); %! assert (size (v), [0, 0]); +%!test <49309> +%! [~,~,v] = svd ([1, 1, 1], 0); +%! assert (size (v), [3 3]); +%! [~,~,v] = svd ([1, 1, 1], "econ"); +%! assert (size (v), [3 1]); + %!error svd () %!error svd ([1, 2; 4, 5], 2, 3) %!error [u, v] = svd ([1, 2; 3, 4])
--- a/libinterp/dldfcn/__init_fltk__.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/dldfcn/__init_fltk__.cc Mon Oct 17 16:26:10 2016 -0400 @@ -423,7 +423,7 @@ void delete_entry (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); int idx = find_index_by_name (fltk_label.c_str ()); if (idx >= 0) @@ -432,7 +432,7 @@ void update_accelerator (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item ( @@ -451,7 +451,7 @@ void update_callback (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item ( @@ -469,7 +469,7 @@ void update_enable (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item ( @@ -486,7 +486,7 @@ void update_foregroundcolor (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item ( @@ -509,7 +509,7 @@ // Matlab places the separator before the current // menu entry, while fltk places it after. So we need to find // the previous item in this menu/submenu. (Kai) - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { int itemflags = 0, idx; @@ -539,7 +539,7 @@ void update_visible (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { Fl_Menu_Item* item @@ -563,7 +563,7 @@ void add_entry (uimenu::properties& uimenup) { - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); if (! fltk_label.empty ()) { @@ -606,7 +606,7 @@ } } while (! item_added); - uimenup.set_fltk_label (fltk_label); + uimenup.set___fltk_label__ (fltk_label); } } @@ -615,7 +615,7 @@ std::vector<int> delayed_menus; Matrix kids = find_uimenu_children (uimenup); int len = kids.numel (); - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); int count = 0; add_entry (uimenup); @@ -897,7 +897,7 @@ { uimenu::properties& uimenup = dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ()); - std::string fltk_label = uimenup.get_fltk_label (); + std::string fltk_label = uimenup.get___fltk_label__ (); graphics_object fig = uimenu_obj.get_ancestor ("figure"); figure::properties& figp = dynamic_cast<figure::properties&> (fig.get_properties ()); @@ -2218,7 +2218,7 @@ } } - void uimenu_set_fltk_label (graphics_object uimenu_obj) + void uimenu_set___fltk_label__ (graphics_object uimenu_obj) { if (uimenu_obj.valid_object ()) { @@ -2228,7 +2228,7 @@ graphics_object go = gh_manager::get_object (uimenu_obj.get_parent ()); if (go.isa ("uimenu")) fltk_label = dynamic_cast<const uimenu::properties&> - (go.get_properties ()).get_fltk_label () + (go.get_properties ()).get___fltk_label__ () + "/" + fltk_label; else if (go.isa ("figure") || go.isa ("uicontextmenu")) @@ -2236,7 +2236,7 @@ else error ("invalid parent object\n"); - uimenup.set_fltk_label (fltk_label); + uimenup.set___fltk_label__ (fltk_label); } } @@ -2295,7 +2295,7 @@ else if (go.isa ("uimenu")) { if (id == uimenu::properties::ID_LABEL) - uimenu_set_fltk_label (go); + uimenu_set___fltk_label__ (go); graphics_object fig = go.get_ancestor ("figure"); figure_manager::uimenu_update (fig.get_handle (), go.get_handle (), id);
--- a/libinterp/octave-value/ov-range.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/octave-value/ov-range.cc Mon Oct 17 16:26:10 2016 -0400 @@ -57,8 +57,6 @@ #include "ls-hdf5.h" #include "ls-utils.h" -// If TRUE, allow ranges with non-integer elements as array indices. -static bool Vallow_noninteger_range_as_index = true; DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_range, "range", "double"); @@ -173,9 +171,7 @@ return *idx_cache; else { - if (require_integers - || ! Vallow_noninteger_range_as_index - || range.all_elements_are_ints ()) + if (require_integers || range.all_elements_are_ints ()) return set_idx_cache (idx_vector (range)); else { @@ -780,52 +776,3 @@ : octave_value (); } -DEFUN (allow_noninteger_range_as_index, args, nargout, - doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} allow_noninteger_range_as_index () -@deftypefnx {} {@var{old_val} =} allow_noninteger_range_as_index (@var{new_val}) -@deftypefnx {} {} allow_noninteger_range_as_index (@var{new_val}, "local") -Query or set the internal variable that controls whether non-integer -ranges are allowed as indices. - -This might be useful for @sc{matlab} compatibility; however, it is still not -entirely compatible because @sc{matlab} treats the range expression -differently in different contexts. - -When called from inside a function with the @qcode{"local"} option, the -variable is changed locally for the function and any subroutines it calls. -The original variable value is restored when exiting the function. -@end deftypefn */) -{ - static bool warned = false; - if (! warned) - { - warned = true; - warning_with_id ("Octave:deprecated-function", - "allow_noninteger_range_as_index is obsolete and will be removed from a future version of Octave"); - } - - return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index); -} - -/* -%!test -%! x = 0:10; -%! warning ("off", "Octave:deprecated-function", "local"); -%! save = allow_noninteger_range_as_index (); -%! warn_state = warning ("query", "Octave:noninteger-range-as-index"); -%! unwind_protect -%! allow_noninteger_range_as_index (false); -%! fail ("x(2.1:5)"); -%! assert (x(2:5), 1:4); -%! allow_noninteger_range_as_index (true); -%! warning ("off", "Octave:noninteger-range-as-index"); -%! assert (x(2.49:5), 1:3); -%! assert (x(2.5:5), 2:4); -%! assert (x(2.51:5), 2:4); -%! unwind_protect_cleanup -%! allow_noninteger_range_as_index (save); -%! warning (warn_state.state, warn_state.identifier); -%! end_unwind_protect -*/ -
--- a/libinterp/parse-tree/pt-binop.cc Mon Oct 17 16:24:55 2016 -0400 +++ b/libinterp/parse-tree/pt-binop.cc Mon Oct 17 16:26:10 2016 -0400 @@ -34,9 +34,6 @@ #include "pt-walk.h" #include "variables.h" -// TRUE means we mark | and & expressions for braindead short-circuit -// behavior. -static bool Vdo_braindead_shortcircuit_evaluation = true; // Binary expressions. @@ -69,8 +66,7 @@ { octave_value retval; - if (Vdo_braindead_shortcircuit_evaluation - && eligible_for_braindead_shortcircuit) + if (eligible_for_braindead_shortcircuit) { if (op_lhs) { @@ -259,47 +255,3 @@ return new_be; } -DEFUN (do_braindead_shortcircuit_evaluation, args, nargout, - doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} do_braindead_shortcircuit_evaluation () -@deftypefnx {} {@var{old_val} =} do_braindead_shortcircuit_evaluation (@var{new_val}) -@deftypefnx {} {} do_braindead_shortcircuit_evaluation (@var{new_val}, "local") -Query or set the internal variable that controls whether Octave will -do short-circuit evaluation of @samp{|} and @samp{&} operators inside the -conditions of if or while statements. - -This feature is only provided for compatibility with @sc{matlab} and should -not be used unless you are porting old code that relies on this feature. - -To obtain short-circuit behavior for logical expressions in new programs, -you should always use the @samp{&&} and @samp{||} operators. - -When called from inside a function with the @qcode{"local"} option, the -variable is changed locally for the function and any subroutines it calls. -The original variable value is restored when exiting the function. -@end deftypefn */) -{ - static bool warned = false; - if (! warned) - { - warned = true; - warning_with_id ("Octave:deprecated-function", - "do_braindead_shortcircuit_evaluation is obsolete and will be removed from a future version of Octave"); - } - - return SET_INTERNAL_VARIABLE (do_braindead_shortcircuit_evaluation); -} - -/* -%!test -%! x = 0; -%! do_braindead_shortcircuit_evaluation (0); -%! if (1 | (x = 1)) -%! endif -%! assert (x, 1); -%! do_braindead_shortcircuit_evaluation (1); -%! if (1 | (x = 0)) -%! endif -%! assert (x, 1); -*/ -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/numeric/gsvd.cc Mon Oct 17 16:26:10 2016 -0400 @@ -0,0 +1,371 @@ +// Copyright (C) 2016 Barbara Lócsi +// Copyright (C) 2006 Pascal Dupuis <Pascal.Dupuis@uclouvain.be> +// Copyright (C) 1996, 1997 John W. Eaton +// +// This program 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. +// +// This program 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 +// this program; if not, see <http://www.gnu.org/licenses/>. + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <vector> + +#include "gsvd.h" + +#include "lo-error.h" +#include "lo-lapack-proto.h" +#include "dMatrix.h" +#include "fMatrix.h" +#include "CMatrix.h" +#include "fCMatrix.h" +#include "dDiagMatrix.h" +#include "fDiagMatrix.h" + +namespace octave +{ + namespace math + { + template <> + void + gsvd<Matrix>::ggsvd (char& jobu, char& jobv, char& jobq, + octave_idx_type m, octave_idx_type n, + octave_idx_type p, + octave_idx_type& k, octave_idx_type& l, + double *tmp_dataA, octave_idx_type m1, + double *tmp_dataB, octave_idx_type p1, Matrix& alpha, + Matrix& beta, double *u, octave_idx_type nrow_u, + double *v, octave_idx_type nrow_v, double *q, + octave_idx_type nrow_q, + Matrix& work, octave_idx_type* iwork, + octave_idx_type& info) + { + F77_XFCN (dggsvd, DGGSVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), + F77_CONST_CHAR_ARG2 (&jobv, 1), + F77_CONST_CHAR_ARG2 (&jobq, 1), + m, n, p, k, l, tmp_dataA, m1, + tmp_dataB, p1, alpha.fortran_vec (), + beta.fortran_vec (), u, nrow_u, + v, nrow_v, q, nrow_q, work.fortran_vec (), + iwork, info + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1))); + } + + template <> + void + gsvd<FloatMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, + octave_idx_type m, octave_idx_type n, + octave_idx_type p, + octave_idx_type& k, octave_idx_type& l, + float *tmp_dataA, octave_idx_type m1, + float *tmp_dataB, octave_idx_type p1, + FloatMatrix& alpha, FloatMatrix& beta, float *u, + octave_idx_type nrow_u, float *v, + octave_idx_type nrow_v, float *q, + octave_idx_type nrow_q, FloatMatrix& work, + octave_idx_type* iwork, octave_idx_type& info) + { + F77_XFCN (sggsvd, SGGSVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), + F77_CONST_CHAR_ARG2 (&jobv, 1), + F77_CONST_CHAR_ARG2 (&jobq, 1), + m, n, p, k, l, tmp_dataA, m1, + tmp_dataB, p1, alpha.fortran_vec (), + beta.fortran_vec (), u, nrow_u, + v, nrow_v, q, nrow_q, work.fortran_vec (), + iwork, info + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1))); + } + + template <> + void + gsvd<ComplexMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, + octave_idx_type m, octave_idx_type n, + octave_idx_type p, octave_idx_type& k, + octave_idx_type& l, Complex *tmp_dataA, + octave_idx_type m1, Complex *tmp_dataB, + octave_idx_type p1, Matrix& alpha, + Matrix& beta, Complex *u, + octave_idx_type nrow_u, + Complex *v, octave_idx_type nrow_v, Complex *q, + octave_idx_type nrow_q, ComplexMatrix& work, + octave_idx_type* iwork, octave_idx_type& info) + { + Matrix rwork(2*n, 1); + F77_XFCN (zggsvd, ZGGSVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), + F77_CONST_CHAR_ARG2 (&jobv, 1), + F77_CONST_CHAR_ARG2 (&jobq, 1), + m, n, p, k, l, F77_DBLE_CMPLX_ARG (tmp_dataA), + m1, F77_DBLE_CMPLX_ARG (tmp_dataB), p1, + alpha.fortran_vec (), beta.fortran_vec (), + F77_DBLE_CMPLX_ARG (u), nrow_u, + F77_DBLE_CMPLX_ARG (v), nrow_v, + F77_DBLE_CMPLX_ARG (q), nrow_q, + F77_DBLE_CMPLX_ARG (work.fortran_vec ()), + rwork.fortran_vec (), iwork, info + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1))); + } + + template <> + void + gsvd<FloatComplexMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, + octave_idx_type m, octave_idx_type n, + octave_idx_type p, octave_idx_type& k, + octave_idx_type& l, + FloatComplex *tmp_dataA, + octave_idx_type m1, + FloatComplex *tmp_dataB, + octave_idx_type p1, FloatMatrix& alpha, + FloatMatrix& beta, FloatComplex *u, + octave_idx_type nrow_u, FloatComplex *v, + octave_idx_type nrow_v, FloatComplex *q, + octave_idx_type nrow_q, + FloatComplexMatrix& work, + octave_idx_type* iwork, + octave_idx_type& info) + { + FloatMatrix rwork(2*n, 1); + F77_XFCN (cggsvd, CGGSVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), + F77_CONST_CHAR_ARG2 (&jobv, 1), + F77_CONST_CHAR_ARG2 (&jobq, 1), + m, n, p, k, l, F77_CMPLX_ARG (tmp_dataA), m1, + F77_CMPLX_ARG (tmp_dataB), p1, + alpha.fortran_vec (), beta.fortran_vec (), + F77_CMPLX_ARG (u), nrow_u, + F77_CMPLX_ARG (v), nrow_v, + F77_CMPLX_ARG (q), nrow_q, + F77_CMPLX_ARG (work.fortran_vec ()), + rwork.fortran_vec (), iwork, info + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1) + F77_CHAR_ARG_LEN (1))); + } + + template <typename T> + T + gsvd<T>::left_singular_matrix_A (void) const + { + if (type == gsvd::Type::sigma_only) + { + (*current_liboctave_error_handler) + ("gsvd: U not computed because type == gsvd::sigma_only"); + return T (); + } + else + return left_smA; + } + + template <typename T> + T + gsvd<T>::left_singular_matrix_B (void) const + { + if (type == gsvd::Type::sigma_only) + { + (*current_liboctave_error_handler) + ("gsvd: V not computed because type == gsvd::sigma_only"); + return T (); + } + else + return left_smB; + } + + template <typename T> + T + gsvd<T>::right_singular_matrix (void) const + { + if (type == gsvd::Type::sigma_only) + { + (*current_liboctave_error_handler) + ("gsvd: X not computed because type == gsvd::sigma_only"); + return T (); + } + else + return right_sm; + } + + template <typename T> + T + gsvd<T>::R_matrix (void) const + { + if (type != gsvd::Type::std) + { + (*current_liboctave_error_handler) + ("gsvd: R not computed because type != gsvd::std"); + return T (); + } + else + return R; + } + + template <typename T> + gsvd<T>::gsvd (const T& a, const T& b, gsvd::Type gsvd_type) + { + octave_idx_type info; + + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); + octave_idx_type p = b.rows (); + + T atmp = a; + P *tmp_dataA = atmp.fortran_vec (); + + T btmp = b; + P *tmp_dataB = btmp.fortran_vec (); + + char jobu = 'U'; + char jobv = 'V'; + char jobq = 'Q'; + + octave_idx_type nrow_u = m; + octave_idx_type nrow_v = p; + octave_idx_type nrow_q = n; + + octave_idx_type k, l; + + switch (gsvd_type) + { + case gsvd<T>::Type::sigma_only: + + // Note: for this case, both jobu and jobv should be 'N', but + // there seems to be a bug in dgesvd from Lapack V2.0. To + // demonstrate the bug, set both jobu and jobv to 'N' and find + // the singular values of [eye(3), eye(3)]. The result is + // [-sqrt(2), -sqrt(2), -sqrt(2)]. + // + // For Lapack 3.0, this problem seems to be fixed. + + jobu = 'N'; + jobv = 'N'; + jobq = 'N'; + nrow_u = nrow_v = nrow_q = 1; + break; + + default: + break; + } + + type = gsvd_type; + + if (! (jobu == 'N' || jobu == 'O')) + left_smA.resize (nrow_u, m); + + P *u = left_smA.fortran_vec (); + + if (! (jobv == 'N' || jobv == 'O')) + left_smB.resize (nrow_v, p); + + P *v = left_smB.fortran_vec (); + + if (! (jobq == 'N' || jobq == 'O')) + right_sm.resize (nrow_q, n); + + P *q = right_sm.fortran_vec (); + + octave_idx_type lwork = 3*n; + lwork = lwork > m ? lwork : m; + lwork = (lwork > p ? lwork : p) + n; + + T work (lwork, 1); + real_matrix alpha (n, 1); + real_matrix beta (n, 1); + + std::vector<octave_idx_type> iwork (n); + + gsvd<T>::ggsvd (jobu, jobv, jobq, m, n, p, k, l, + tmp_dataA, m, tmp_dataB, p, alpha, beta, u, + nrow_u, v, nrow_v, q, nrow_q, work, iwork.data (), info); + + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in *ggsvd"); + + if (info < 0) + (*current_liboctave_error_handler) ("*ggsvd.f: argument %d illegal", + -info); + else + { + if (info > 0) + (*current_liboctave_error_handler) + ("*ggsvd.f: Jacobi-type procedure failed to converge."); + else + { + octave_idx_type i, j; + + if (gsvd<T>::Type::std == gsvd_type) + { + R.resize(k+l, k+l); + int astart = n-k-l; + if (m - k - l >= 0) + { + astart = n-k-l; + // R is stored in A(1:K+L,N-K-L+1:N) + for (i = 0; i < k+l; i++) + for (j = 0; j < k+l; j++) + R.xelem (i, j) = atmp.xelem (i, astart + j); + } + else + { + // (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), + // ( 0 R22 R23 ) + + for (i = 0; i < m; i++) + for (j = 0; j < k+l; j++) + R.xelem (i, j) = atmp.xelem (i, astart + j); + // and R33 is stored in B(M-K+1:L,N+M-K-L+1:N) + for (i = k+l-1; i >=m; i--) + { + for (j = 0; j < m; j++) + R.xelem(i, j) = 0.0; + for (j = m; j < k+l; j++) + R.xelem (i, j) = btmp.xelem (i - k, astart + j); + } + } + } + + if (m-k-l >= 0) + { + // Fills in C and S + sigmaA.resize (l, l); + sigmaB.resize (l, l); + for (i = 0; i < l; i++) + { + sigmaA.dgxelem(i) = alpha.elem(k+i); + sigmaB.dgxelem(i) = beta.elem(k+i); + } + } + else + { + // Fills in C and S + sigmaA.resize (m-k, m-k); + sigmaB.resize (m-k, m-k); + for (i = 0; i < m-k; i++) + { + sigmaA.dgxelem(i) = alpha.elem(k+i); + sigmaB.dgxelem(i) = beta.elem(k+i); + } + } + } + } + } + + // Instantiations we need. + template class gsvd<Matrix>; + template class gsvd<FloatMatrix>; + template class gsvd<ComplexMatrix>; + template class gsvd<FloatComplexMatrix>; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/numeric/gsvd.h Mon Oct 17 16:26:10 2016 -0400 @@ -0,0 +1,102 @@ +// Copyright (C) 2016 Barbara Lócsi +// Copyright (C) 2006 Pascal Dupuis <Pascal.Dupuis@uclouvain.be> +// Copyright (C) 1996, 1997 John W. Eaton +// +// This program 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. +// +// This program 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 +// this program; if not, see <http://www.gnu.org/licenses/>. + +#if !defined (octave_gsvd_h) +#define octave_gsvd_h 1 + +#include "octave-config.h" + +namespace octave +{ + namespace math + { + template <typename T> + class + gsvd + { + public: + + enum class Type + { + std, + economy, + sigma_only + }; + + gsvd (void) : sigmaA (), sigmaB (), left_smA (), left_smB (), right_sm () + { } + + gsvd (const T& a, const T& b, + gsvd::Type gsvd_type = gsvd<T>::Type::economy); + + gsvd (const gsvd& a) + : type (a.type), + sigmaA (a.sigmaA), sigmaB (a.sigmaB), + left_smA (a.left_smA), left_smB (a.left_smB), right_sm (a.right_sm), + R(a.R) { } + + gsvd& operator = (const gsvd& a) + { + if (this != &a) + { + type = a.type; + sigmaA = a.sigmaA; + sigmaB = a.sigmaB; + left_smA = a.left_smA; + left_smB = a.left_smB; + right_sm = a.right_sm; + R = a.R; + } + + return *this; + } + + ~gsvd (void) { } + + typename T::real_diag_matrix_type + singular_values_A (void) const { return sigmaA; } + + typename T::real_diag_matrix_type + singular_values_B (void) const { return sigmaB; } + + T left_singular_matrix_A (void) const; + T left_singular_matrix_B (void) const; + + T right_singular_matrix (void) const; + T R_matrix (void) const; + + private: + typedef typename T::value_type P; + typedef typename T::real_matrix_type real_matrix; + + gsvd::Type type; + typename T::real_diag_matrix_type sigmaA, sigmaB; + T left_smA, left_smB; + T right_sm, R; + + void ggsvd (char& jobu, char& jobv, char& jobq, octave_idx_type m, + octave_idx_type n, octave_idx_type p, octave_idx_type& k, + octave_idx_type& l, P *tmp_dataA, octave_idx_type m1, + P *tmp_dataB, octave_idx_type p1, real_matrix& alpha, + real_matrix& beta, P *u, octave_idx_type nrow_u, P *v, + octave_idx_type nrow_v, P *q, octave_idx_type nrow_q, T& work, + octave_idx_type* iwork, octave_idx_type& info); + }; + } +} + +#endif
--- a/liboctave/numeric/lo-lapack-proto.h Mon Oct 17 16:24:55 2016 -0400 +++ b/liboctave/numeric/lo-lapack-proto.h Mon Oct 17 16:26:10 2016 -0400 @@ -807,6 +807,126 @@ F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); + // GGSVD + + F77_RET_T + F77_FUNC (dggsvd, DGGSVD) + (F77_CONST_CHAR_ARG_DECL, // JOBU + F77_CONST_CHAR_ARG_DECL, // JOBV + F77_CONST_CHAR_ARG_DECL, // JOBQ + const F77_INT&, // M + const F77_INT&, // N + const F77_INT&, // P + F77_INT &, // K + F77_INT &, // L + F77_DBLE*, // A(LDA,N) + const F77_INT&, // LDA + F77_DBLE*, // B(LDB,N) + const F77_INT&, // LDB + F77_DBLE*, // ALPHA(N) + F77_DBLE*, // BETA(N) + F77_DBLE*, // U(LDU,M) + const F77_INT&, // LDU + F77_DBLE*, // V(LDV,P) + const F77_INT&, // LDV + F77_DBLE*, // Q(LDQ,N) + const F77_INT&, // LDQ + F77_DBLE*, // WORK + F77_INT*, // IWORK(N) + F77_INT& // INFO + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL); + + F77_RET_T + F77_FUNC (sggsvd, SGGSVD) + (F77_CONST_CHAR_ARG_DECL, // JOBU + F77_CONST_CHAR_ARG_DECL, // JOBV + F77_CONST_CHAR_ARG_DECL, // JOBQ + const F77_INT&, // M + const F77_INT&, // N + const F77_INT&, // P + F77_INT &, // K + F77_INT &, // L + F77_REAL*, // A + const F77_INT&, // LDA + F77_REAL*, // B + const F77_INT&, // LDB + F77_REAL*, // ALPHA + F77_REAL*, // BETA + F77_REAL*, // U + const F77_INT&, // LDU + F77_REAL*, // V + const F77_INT&, // LDV + F77_REAL*, // Q + const F77_INT&, // LDQ + F77_REAL*, // WORK + F77_INT*, // IWORK + F77_INT& // INFO + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL); + + F77_RET_T + F77_FUNC (zggsvd, ZGGSVD) + (F77_CONST_CHAR_ARG_DECL, // JOBU + F77_CONST_CHAR_ARG_DECL, // JOBV + F77_CONST_CHAR_ARG_DECL, // JOBQ + const F77_INT&, // M + const F77_INT&, // N + const F77_INT&, // P + F77_INT &, // K + F77_INT &, // L + F77_DBLE_CMPLX*, // A(LDA,N) + const F77_INT&, // LDA + F77_DBLE_CMPLX*, // B(LDB,N) + const F77_INT&, // LDB + F77_DBLE*, // ALPHA(N) + F77_DBLE*, // BETA(N) + F77_DBLE_CMPLX*, // U(LDU,M) + const F77_INT&, // LDU + F77_DBLE_CMPLX*, // V(LDV,P) + const F77_INT&, // LDV + F77_DBLE_CMPLX*, // Q(LDQ,N) + const F77_INT&, // LDQ + F77_DBLE_CMPLX*, // WORK + F77_DBLE*, // RWORK + F77_INT*, // IWORK(N) + F77_INT& // INFO + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL); + + F77_RET_T + F77_FUNC (cggsvd, CGGSVD) + (F77_CONST_CHAR_ARG_DECL, // JOBU + F77_CONST_CHAR_ARG_DECL, // JOBV + F77_CONST_CHAR_ARG_DECL, // JOBQ + const F77_INT&, // M + const F77_INT&, // N + const F77_INT&, // P + F77_INT &, // K + F77_INT &, // L + F77_CMPLX*, // A + const F77_INT&, // LDA + F77_CMPLX*, // B + const F77_INT&, // LDB + F77_REAL*, // ALPHA + F77_REAL*, // BETA + F77_CMPLX*, // U + const F77_INT&, // LDU + F77_CMPLX*, // V + const F77_INT&, // LDV + F77_CMPLX*, // Q + const F77_INT&, // LDQ + F77_CMPLX*, // WORK + F77_REAL*, // RWORK + F77_INT*, // IWORK + F77_INT& // INFO + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL + F77_CHAR_ARG_LEN_DECL); + // GTSV F77_RET_T
--- a/liboctave/numeric/module.mk Mon Oct 17 16:24:55 2016 -0400 +++ b/liboctave/numeric/module.mk Mon Oct 17 16:26:10 2016 -0400 @@ -18,6 +18,7 @@ liboctave/numeric/DASSL.h \ liboctave/numeric/DET.h \ liboctave/numeric/EIG.h \ + liboctave/numeric/gsvd.h \ liboctave/numeric/LSODE.h \ liboctave/numeric/ODE.h \ liboctave/numeric/ODEFunc.h \ @@ -69,6 +70,7 @@ liboctave/numeric/DASRT.cc \ liboctave/numeric/DASSL.cc \ liboctave/numeric/EIG.cc \ + liboctave/numeric/gsvd.cc \ liboctave/numeric/LSODE.cc \ liboctave/numeric/ODES.cc \ liboctave/numeric/Quad.cc \
--- a/liboctave/operators/mx-defs.h Mon Oct 17 16:24:55 2016 -0400 +++ b/liboctave/operators/mx-defs.h Mon Oct 17 16:26:10 2016 -0400 @@ -66,6 +66,8 @@ class EIG; +template <typename T> class gsvd; + template <typename T> class hess; template <typename T> class schur;
--- a/liboctave/operators/mx-ext.h Mon Oct 17 16:24:55 2016 -0400 +++ b/liboctave/operators/mx-ext.h Mon Oct 17 16:26:10 2016 -0400 @@ -57,6 +57,11 @@ #include "EIG.h" +// Result of a Generalized Singular Value Decomposition. + +#include "gsvd.h" + + // Result of an LU decomposition. #include "lu.h"
--- a/scripts/deprecated/bicubic.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ -## Copyright (C) 2005-2016 Hoxide Ma -## -## 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{zi} =} bicubic (@var{x}, @var{y}, @var{z}, @var{xi}, @var{yi}, @var{extrapval}) -## -## @code{bicubic} is deprecated and will be removed in Octave version 4.4. -## Use @code{interp2 (@dots{}, "spline")} for the equivalent functionality. -## -## Return a matrix @var{zi} corresponding to the bicubic -## interpolations at @var{xi} and @var{yi} of the data supplied -## as @var{x}, @var{y} and @var{z}. Points outside the grid are set -## to @var{extrapval}. -## -## See @url{http://wiki.woodpecker.org.cn/moin/Octave/Bicubic} -## for further information. -## @seealso{interp2} -## @end deftypefn - -## Bicubic interpolation method. -## Author: Hoxide Ma <hoxide_dirac@yahoo.com.cn> - -## Deprecated in version 4.0 - -function zi = bicubic (x, y, z, xi, yi, extrapval, spline_alpha) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "bicubic is obsolete and will be removed from a future version of Octave, please use interp2 instead"); - endif - - if (nargin < 1 || nargin > 7) - print_usage (); - endif - - if (nargin == 7 && isscalar (spline_alpha)) - a = spline_alpha; - else - a = 0.5; - endif - - if (nargin < 6) - extrapval = NaN; - endif - - if (isa (x, "single") || isa (y, "single") || isa (z, "single") - || isa (xi, "single") || isa (yi, "single")) - myeps = eps ("single"); - else - myeps = eps (); - endif - - if (nargin <= 2) - ## bicubic (z) or bicubic (z, 2) - if (nargin == 1) - n = 1; - else - n = y; - endif - z = x; - x = []; - [rz, cz] = size (z); - s = linspace (1, cz, (cz-1) * pow2 (n) + 1); - t = linspace (1, rz, (rz-1) * pow2 (n) + 1); - elseif (nargin == 3) - if (! isvector (x) || ! isvector (y)) - error ("bicubic: XI and YI must be vector"); - endif - s = y; - t = z; - z = x; - [rz, cz] = size (z); - elseif (nargin == 5 || nargin == 6) - [rz, cz] = size (z); - if (isvector (x) && isvector (y)) - if (rz != length (y) || cz != length (x)) - error ("bicubic: length of X and Y must match the size of Z"); - endif - elseif (size_equal (x, y) && size_equal (x, z)) - x = x(1,:); - y = y(:,1); - else - error ("bicubic: X, Y and Z must be equal size matrices of same size"); - endif - - if (all (diff (x) < 0)) - flipx = true; - x = fliplr (x); - elseif (all (diff (x) > 0)) - flipx = false; - else - error ("bicubic:nonmonotonic", "bicubic: X values must be monotonic"); - endif - if (all (diff (y) < 0)) - flipy = true; - y = flipud (y); - elseif (all (diff (y) > 0)) - flipy = false; - else - error ("bicubic:nonmonotonic", "bicubic: Y values must be monotonic"); - endif - - ## Mark values outside the lookup table. - xfirst_ind = find (xi < x(1)); - xlast_ind = find (xi > x(cz)); - yfirst_ind = find (yi < y(1)); - ylast_ind = find (yi > y(rz)); - ## Set value outside the table preliminary to min max index. - xi(xfirst_ind) = x(1); - xi(xlast_ind) = x(cz); - yi(yfirst_ind) = y(1); - yi(ylast_ind) = y(rz); - - x = reshape (x, 1, cz); - x(cz) *= 1 + sign (x(cz)) * myeps; - if (x(cz) == 0) - x(cz) = myeps; - endif; - xi = reshape (xi, 1, length (xi)); - [m, i] = sort ([x, xi]); - o = cumsum (i <= cz); - xidx = o(find (i > cz)); - - y = reshape (y, rz, 1); - y(rz) *= 1 + sign (y(rz)) * myeps; - if (y(rz) == 0) - y(rz) = myeps; - endif; - yi = reshape (yi, length (yi), 1); - [m, i] = sort ([y; yi]); - o = cumsum (i <= rz); - yidx = o([find(i > rz)]); - - ## Set s and t used follow codes. - s = xidx + ((xi .- x(xidx)) ./ (x(xidx+1) .- x(xidx))); - t = yidx + ((yi - y(yidx)) ./ (y(yidx+1) - y(yidx))); - - if (flipx) - s = fliplr (s); - endif - if (flipy) - t = flipud (t); - endif - else - print_usage (); - endif - - if (rz < 3 || cz < 3) - error ("bicubic: Z at least a 3 by 3 matrices"); - endif - - inds = floor (s); - d = find (s == cz); - s = s - floor (s); - inds(d) = cz-1; - s(d) = 1.0; - - d = []; - indt = floor (t); - d = find (t == rz); - t = t - floor (t); - indt(d) = rz-1; - t(d) = 1.0; - d = []; - - p = zeros (size (z) + 2); - p(2:rz+1,2:cz+1) = z; - p(1,:) = (6*(1-a))*p(2,:) - 3*p(3,:) + (6*a-2)*p(4,:); - p(rz+2,:) = (6*(1-a))*p(rz+1,:) - 3*p(rz,:) + (6*a-2)*p(rz-1,:); - p(:,1) = (6*(1-a))*p(:,2) - 3*p(:,3) + (6*a-2)*p(:,4); - p(:,cz+2) = (6*(1-a))*p(:,cz+1) - 3*p(:,cz) + (6*a-2)*p(:,cz-1); - - ## Calculate the C1(t) C2(t) C3(t) C4(t) and C1(s) C2(s) C3(s) C4(s). - t2 = t.*t; - t3 = t2.*t; - - ct0 = -a .* t3 + (2 * a) .* t2 - a .* t ; # -a G0 - ct1 = (2-a) .* t3 + (-3+a) .* t2 + 1 ; # F0 - a G1 - ct2 = (a-2) .* t3 + (-2 *a + 3) .* t2 + a .* t ; # F1 + a G0 - ct3 = a .* t3 - a .* t2; # a G1 - t = []; t2 = []; t3 = []; - - s2 = s.*s; - s3 = s2.*s; - - cs0 = -a .* s3 + (2 * a) .* s2 - a .*s ; # -a G0 - cs1 = (2-a) .* s3 + (-3 + a) .* s2 + 1 ; # F0 - a G1 - cs2 = (a-2) .* s3 + (-2 *a + 3) .* s2 + a .*s ; # F1 + a G0 - cs3 = a .* s3 - a .* s2; # a G1 - s = []; s2 = []; s3 = []; - - cs0 = cs0([1,1,1,1],:); - cs1 = cs1([1,1,1,1],:); - cs2 = cs2([1,1,1,1],:); - cs3 = cs3([1,1,1,1],:); - - lent = length (ct0); - lens = columns (cs0); - zi = zeros (lent, lens); - - for i = 1:lent - it = indt(i); - int = [it, it+1, it+2, it+3]; - zi(i,:) = ([ct0(i),ct1(i),ct2(i),ct3(i)] - * (p(int,inds) .* cs0 + p(int,inds+1) .* cs1 - + p(int,inds+2) .* cs2 + p(int,inds+3) .* cs3)); - endfor - - ## Set points outside the table to extrapval. - if (! (isempty (xfirst_ind) && isempty (xlast_ind))) - zi(:, [xfirst_ind, xlast_ind]) = extrapval; - endif - if (! (isempty (yfirst_ind) && isempty (ylast_ind))) - zi([yfirst_ind; ylast_ind], :) = extrapval; - endif - -endfunction - - -%!demo -%! clf; -%! colormap ("default"); -%! A = [13,-1,12;5,4,3;1,6,2]; -%! x = [0,1,4]+10; -%! y = [-10,-9,-8]; -%! xi = linspace (min (x), max (x), 17); -%! yi = linspace (min (y), max (y), 26)'; -%! mesh (xi, yi, bicubic (x,y,A,xi,yi)); -%! [x,y] = meshgrid (x,y); -%! hold on; plot3 (x(:),y(:),A(:),"b*"); hold off; - -%!test -%! x = linspace (1, -1, 10); -%! [xx, yy] = meshgrid (x); -%! z = cos (6 * xx) + sin (6 * yy); -%! x = linspace (1, -1, 30); -%! [xx2, yy2] = meshgrid (x); -%! z1 = interp2 (xx, yy, z, xx2, yy2, "spline"); -%! z2 = interp2 (fliplr (xx), flipud (yy), fliplr (flipud(z)), -%! fliplr (xx2), flipud (yy2), "spline"); -%! z2 = fliplr (flipud (z2)); -%! assert (z1, z2, 100 * eps ()); -
--- a/scripts/deprecated/delaunay3.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -## Copyright (C) 1999-2016 Kai Habel -## -## 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{tetr} =} delaunay3 (@var{x}, @var{y}, @var{z}) -## @deftypefnx {} {@var{tetr} =} delaunay3 (@var{x}, @var{y}, @var{z}, @var{options}) -## -## @code{delaunay3} is deprecated and will be removed in Octave version 4.4. -## Please use @code{delaunay} in all new code. -## -## Compute the Delaunay triangulation for a 3-D set of points. -## The return value @var{tetr} is a set of tetrahedrons which satisfies the -## Delaunay circum-circle criterion, i.e., only a single data point from -## [@var{x}, @var{y}, @var{z}] is within the circum-circle of the defining -## tetrahedron. -## -## The set of tetrahedrons @var{tetr} is a matrix of size [n, 4]. Each -## row defines a tetrahedron and the four columns are the four vertices -## of the tetrahedron. The value of @code{@var{tetr}(i,j)} is an index into -## @var{x}, @var{y}, @var{z} for the location of the j-th vertex of the i-th -## tetrahedron. -## -## An optional fourth argument, which must be a string or cell array of -## strings, contains options passed to the underlying qhull command. See the -## documentation for the Qhull library for details -## @url{http://www.qhull.org/html/qh-quick.htm#options}. -## The default options are @code{@{"Qt", "Qbb", "Qc", "Qz"@}}. -## -## If @var{options} is not present or @code{[]} then the default arguments are -## used. Otherwise, @var{options} replaces the default argument list. -## To append user options to the defaults it is necessary to repeat the -## default arguments in @var{options}. Use a null string to pass no arguments. -## -## @seealso{delaunay, delaunayn, convhull, voronoi, tetramesh} -## @end deftypefn - -## Author: Kai Habel <kai.habel@gmx.de> - -## Deprecated in 4.0 - -function tetr = delaunay3 (x, y, z, options) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "delaunay3 is obsolete and will be removed from a future version of Octave, please use delaunay instead"); - endif - - if (nargin < 3 || nargin > 4) - print_usage (); - endif - - if (! (isvector (x) && isvector (y) && isvector (z) - && length (x) == length (y) && length (x) == length (z))) - error ("delaunay: X, Y, and Z must be the same size"); - elseif (nargin == 4 && ! (ischar (options) || iscellstr (options))) - error ("delaunay3: OPTIONS must be a string or cell array of strings"); - endif - - if (nargin == 3) - tetr = delaunayn ([x(:), y(:), z(:)]); - else - tetr = delaunayn ([x(:), y(:), z(:)], options); - endif - -endfunction - - -%!testif HAVE_QHULL -%! x = [-1, -1, 1, 0, -1]; y = [-1, 1, 1, 0, -1]; z = [0, 0, 0, 1, 1]; -%! assert (sortrows (sort (delaunay3 (x, y, z), 2)), [1,2,3,4;1,2,4,5]); - -## FIXME: Need input validation tests -
--- a/scripts/deprecated/dump_prefs.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -## Copyright (C) 1994-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} dump_prefs () -## @deftypefnx {} {} dump_prefs (@var{fid}) -## -## @code{dump_prefs} is deprecated and will be removed in Octave version 4.4. -## Please use individual preference get/set routines in all new code. -## -## Dump the current settings of all user preferences to stdout in a format that -## can be parsed by Octave later. -## -## If the optional argument @var{fid} is given then the results are written to -## the file specified by file descriptor @var{fid}. -## @end deftypefn - -## Author: jwe - -## Deprecated in 4.0 - -function dump_prefs (fid) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "dump_prefs is obsolete and will be removed from a future version of Octave, recode using individual preference get/set routines"); - endif - - if (nargin > 1) - print_usage (); - endif - - if (nargin == 0) - fid = stdout; - endif - - ## FIXME: It would be nice to be able to get the list of built-in variables - ## directly from Octave so that we wouldn't have to remember to update it - ## each time the list of preference variables changes - - pref_list = {"EDITOR" - "EXEC_PATH" - "IMAGE_PATH" - "PAGER" - "PAGER_FLAGS" - "PS1" - "PS2" - "PS4" - "allow_noninteger_range_as_index" - "beep_on_error" - "built_in_docstrings_file" - "completion_append_char" - "confirm_recursive_rmdir" - "crash_dumps_octave_core" - "debug_java" - "debug_on_error" - "debug_on_interrupt" - "debug_on_warning" - "disable_diagonal_matrix" - "disable_permutation_matrix" - "disable_range" - "do_braindead_shortcircuit_evaluation" - "doc_cache_file" - "echo_executing_commands" - "fixed_point_format" - "gnuplot_binary" - "history_file" - "history_save" - "history_size" - "history_timestamp_format_string" - "ignore_function_time_stamp" - "info_file" - "info_program" - "java_matrix_autoconversion" - "java_unsigned_autoconversion" - "makeinfo_program" - "max_recursion_depth" - "missing_component_hook" - "missing_function_hook" - "octave_core_file_limit" - "octave_core_file_name" - "octave_core_file_options" - "optimize_subsasgn_calls" - "output_max_field_width" - "output_precision" - "page_output_immediately" - "page_screen_output" - "print_empty_dimensions" - "print_struct_array_contents" - "save_default_options" - "save_header_format_string" - "save_precision" - "sighup_dumps_octave_core" - "sigterm_dumps_octave_core" - "silent_functions" - "sparse_auto_mutate" - "split_long_rows" - "string_fill_char" - "struct_levels_to_print" - "suppress_verbose_help_message" - "texi_macros_file"}; - - for i = 1:rows (pref_list) - pref = pref_list{i}; - try - val = feval (pref); - if (isnumeric (val)) - val = sprintf ("%g", val); - endif - fprintf (fid, " %s = %s\n", pref, val); - catch - fprintf (fid, "# %s = <no value or error in displaying it>\n", pref); - end_try_catch - endfor - -endfunction - - -%!error dump_prefs (1,2) -
--- a/scripts/deprecated/find_dir_in_path.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -## Copyright (C) 2013-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} find_dir_in_path (@var{dir}) -## @deftypefnx {} {} find_dir_in_path (@var{dir}, "all") -## This function has been deprecated. Use @code{dir_in_loadpath} instead. -## @seealso{dir_in_loadpath} -## @end deftypefn - -## Deprecated in version 4.0 - -function retval = find_dir_in_path (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "find_dir_in_path is obsolete and will be removed from a future version of Octave, please use dir_in_loadpath instead"); - endif - - retval = dir_in_loadpath (varargin{:}); - -endfunction -
--- a/scripts/deprecated/finite.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} finite (@var{x}) -## -## @code{finite} is deprecated and will be removed in Octave version 4.4. -## Please use @code{isfinite} in all new code. -## -## Return a logical array which is true where the elements of @var{x} are -## finite values and false where they are not. -## For example: -## -## @example -## @group -## finite ([13, Inf, NA, NaN]) -## @result{} [ 1, 0, 0, 0 ] -## @end group -## @end example -## @seealso{isfinite, isinf, isnan, isna} -## @end deftypefn - -## Deprecated in version 4.0 - -function retval = finite (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "finite is obsolete and will be removed from a future version of Octave, please use isfinite instead"); - endif - - retval = isfinite (varargin{:}); - -endfunction -
--- a/scripts/deprecated/fmod.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} fmod (@var{x}, @var{y}) -## -## @code{fmod} is deprecated and will be removed in Octave version 4.4. -## Please use @code{rem} in all new code. -## -## Return the remainder of the division @code{@var{x} / @var{y}}, computed -## using the expression -## -## @example -## x - y .* fix (x ./ y) -## @end example -## -## An error message is printed if the dimensions of the arguments do not -## agree, or if either of the arguments is complex. -## @seealso{rem, mod} -## @end deftypefn - -## Deprecated in version 4.0 - -function retval = fmod (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "fmod is obsolete and will be removed from a future version of Octave, please use rem instead"); - endif - - retval = rem (varargin{:}); - -endfunction -
--- a/scripts/deprecated/fnmatch.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} fnmatch (@var{pattern}, @var{string}) -## -## @code{fnmatch} is deprecated and will be removed in Octave version 4.4. -## Please use @code{glob} or @code{regexp} in all new code. -## -## Return true or false for each element of @var{string} that matches any of -## the elements of the string array @var{pattern}, using the rules of -## filename pattern matching. For example: -## -## @example -## @group -## fnmatch (\"a*b\", @{\"ab\"; \"axyzb\"; \"xyzab\"@}) -## @result{} [ 1; 1; 0 ] -## @end group -## @end example -## @seealso{glob, regexp} -## @end deftypefn - -## Deprecated in version 4.0 - -function retval = fnmatch (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "fnmatch is obsolete and will be removed from a future version of Octave, please use glob or regexp instead"); - endif - - retval = __fnmatch__ (varargin{:}); - -endfunction -
--- a/scripts/deprecated/gmap40.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -## Copyright (C) 2007-2016 David Bateman -## -## 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{map} =} gmap40 () -## @deftypefnx {} {@var{map} =} gmap40 (@var{n}) -## -## @code{gmap40} is deprecated and will be removed in Octave version 4.4. -## -## Create color colormap. The colormap consists of red, green, blue, yellow, -## magenta and cyan. -## -## This colormap is specifically designed for users of gnuplot 4.0 where these -## 6 colors are the allowable ones for patch objects. -## -## The argument @var{n} must be a scalar. -## If unspecified, a length of 6 is assumed. Larger values of @var{n} result -## in a repetition of the above colors. -## @seealso{colormap} -## @end deftypefn - -## Deprecated in 4.0 - -function map = gmap40 (n = rows (colormap ())) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "gmap40 is obsolete and will be removed from a future version of Octave"); - endif - - if (nargin > 1) - print_usage (); - elseif (! isscalar (n)) - error ("gmap40: N must be a scalar"); - endif - - if (n > 0) - C = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1]; - map = C(rem (0:(n-1), 6) + 1, :); - else - map = zeros (0, 3); - endif - -endfunction - - -%!demo -%! ## Show the 'gmap40' colormap as an image -%! image (1:6, linspace (0, 1, 6), repmat ((1:6)', 1, 6)); -%! axis ([1, 6, 0, 1], "ticy", "xy"); -%! colormap (gmap40 (6)); -
--- a/scripts/deprecated/loadaudio.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -## Copyright (C) 1995-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} loadaudio (@var{name}, @var{ext}, @var{bps}) -## -## @code{loadaudio} is deprecated and will be removed in Octave version 4.4. -## Please use @code{audioread} in all new code. -## -## Load audio data from the file @file{@var{name}.@var{ext}} into the -## vector @var{x}. -## -## The extension @var{ext} determines how the data in the audio file is -## interpreted; the extensions @file{lin} (default) and @file{raw} -## correspond to linear, the extensions @file{au}, @file{mu}, or @file{snd} -## to mu-law encoding. -## -## The argument @var{bps} can be either 8 (default) or 16, and specifies -## the number of bits per sample used in the audio file. -## @seealso{lin2mu, mu2lin, saveaudio, playaudio, setaudio, record} -## @end deftypefn - - -## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> -## Created: 10 April 1994 -## Adapted-By: jwe - -function X = loadaudio (name, ext, bps) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "loadaudio is obsolete and will be removed from a future version of Octave, please use audioread instead"); - endif - - if (nargin == 0 || nargin > 3) - print_usage (); - endif - - if (nargin == 1) - ext = "lin"; - endif - - if (nargin < 3) - bps = 8; - elseif (bps != 8 && bps != 16) - error ("loadaudio: BPS must be either 8 or 16"); - endif - - name = [name, ".", ext]; - num = fopen (name, "rb"); - - if (strcmp (ext, "lin") || strcmp (ext, "raw") || strcmp (ext, "pcm")) - if (bps == 8) - [Y, c] = fread (num, inf, "uchar"); - X = Y - 127; - else - [X, c] = fread (num, inf, "short"); - endif - elseif (strcmp (ext, "mu") || strcmp (ext, "au") - || strcmp (ext, "snd") || strcmp (ext, "ul")) - [Y, c] = fread (num, inf, "uchar"); - ## remove file header - m = find (Y(1:64) == 0, 1, "last"); - if (! isempty (m)) - Y(1:m) = []; - endif - X = mu2lin (Y, bps); - else - fclose (num); - error ("loadaudio: unsupported extension"); - endif - - fclose (num); - -endfunction -
--- a/scripts/deprecated/luinc.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, '0') -## @deftypefnx {} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{droptol}) -## @deftypefnx {} {[@var{L}, @var{U}, @var{P}, @var{Q}] =} luinc (@var{A}, @var{opts}) -## -## @code{luinc} is deprecated and will be removed in Octave version 4.4. -## Please use @code{ilu} or @code{ichol} in all new code. -## -## Produce the incomplete LU@tie{}factorization of the sparse matrix @var{A}. -## Two types of incomplete factorization are possible, and the type -## is determined by the second argument to @code{luinc}. -## -## Called with a second argument of @qcode{'0'}, the zero-level incomplete -## LU@tie{}factorization is produced. This creates a factorization of @var{A} -## where the position of the nonzero arguments correspond to the same -## positions as in the matrix @var{A}. -## -## Alternatively, the fill-in of the incomplete LU@tie{}factorization can -## be controlled through the variable @var{droptol} or the structure -## @var{opts}. The @sc{umfpack} multifrontal factorization code by Tim A. -## Davis is used for the incomplete LU@tie{}factorization, (availability -## @url{http://www.cise.ufl.edu/research/sparse/umfpack/}) -## -## @var{droptol} determines the values below which the values in the -## LU@tie{} factorization are dropped and replaced by zero. It must be a -## positive scalar, and any values in the factorization whose absolute value -## are less than this value are dropped, expect if leaving them increase the -## sparsity of the matrix. Setting @var{droptol} to zero results in a complete -## LU@tie{}factorization which is the default. -## -## @var{opts} is a structure containing one or more of the fields -## -## @table @code -## @item droptol -## The drop tolerance as above. If @var{opts} only contains @code{droptol} -## then this is equivalent to using the variable @var{droptol}. -## -## @item milu -## A logical variable flagging whether to use the modified incomplete -## LU@tie{} factorization. In the case that @code{milu} is true, the dropped -## values are subtracted from the diagonal of the matrix @var{U} of the -## factorization. The default is @code{false}. -## -## @item udiag -## A logical variable that flags whether zero elements on the diagonal of -## @var{U} should be replaced with @var{droptol} to attempt to avoid singular -## factors. The default is @code{false}. -## -## @item thresh -## Defines the pivot threshold in the interval [0,1]. Values outside that -## range are ignored. -## @end table -## -## All other fields in @var{opts} are ignored. The outputs from @code{luinc} -## are the same as for @code{lu}. -## -## Given the string argument @qcode{"vector"}, @code{luinc} returns the -## values of @var{p} @var{q} as vector values. -## @seealso{ilu, ichol, lu, sparse} -## @end deftypefn - -## Deprecated in version 4.0 - -function [L, U, P, Q] = luinc (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "luinc is obsolete and will be removed from a future version of Octave, please use ilu or ichol instead"); - endif - - [L, U, P, Q] = __luinc__ (varargin{:}); - -endfunction - - -%!testif HAVE_UMFPACK -%! a = sparse ([1,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]); -%! [l,u] = luinc (a, 1e-10); -%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10); -%! opts.droptol = 1e-10; -%! [l,u] = luinc (a, opts); -%! assert (l*u, sparse ([1,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10); - -%!testif HAVE_UMFPACK -%! a = sparse ([1i,2,0,0;0,1,2,0;1e-14,0,3,0;0,0,0,1]); -%! [l,u] = luinc (a, 1e-10); -%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10); -%! opts.droptol = 1e-10; -%! [l,u] = luinc (a, opts); -%! assert (l*u, sparse ([1i,2,0,0;0,1,2,0;0,0,3,0;0,0,0,1]), 1e-10); -
--- a/scripts/deprecated/module.mk Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/deprecated/module.mk Mon Oct 17 16:26:10 2016 -0400 @@ -1,34 +1,16 @@ FCN_FILE_DIRS += scripts/deprecated scripts_deprecated_FCN_FILES = \ - scripts/deprecated/bicubic.m \ scripts/deprecated/bitmax.m \ scripts/deprecated/comma.m \ - scripts/deprecated/delaunay3.m \ - scripts/deprecated/dump_prefs.m \ - scripts/deprecated/find_dir_in_path.m \ - scripts/deprecated/finite.m \ - scripts/deprecated/fmod.m \ - scripts/deprecated/fnmatch.m \ - scripts/deprecated/gmap40.m \ scripts/deprecated/isstr.m \ - scripts/deprecated/loadaudio.m \ - scripts/deprecated/luinc.m \ scripts/deprecated/mahalanobis.m \ scripts/deprecated/md5sum.m \ - scripts/deprecated/mouse_wheel_zoom.m \ - scripts/deprecated/nfields.m \ scripts/deprecated/octave_config_info.m \ - scripts/deprecated/octave_tmp_file_name.m \ scripts/deprecated/onenormest.m \ scripts/deprecated/paren.m \ - scripts/deprecated/playaudio.m \ - scripts/deprecated/saveaudio.m \ scripts/deprecated/semicolon.m \ - scripts/deprecated/setaudio.m \ scripts/deprecated/sleep.m \ - scripts/deprecated/syl.m \ - scripts/deprecated/usage.m \ scripts/deprecated/usleep.m \ scripts/deprecated/wavread.m \ scripts/deprecated/wavwrite.m
--- a/scripts/deprecated/mouse_wheel_zoom.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -## Copyright (C) 2007-2016 Shai Ayal -## -## 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{old_val} =} mouse_wheel_zoom (@var{new_val}) -## Query or set the mouse wheel zoom factor. -## -## The zoom factor is a number in the range (0,1) which is the -## percentage of the current axis limits that will be used when zooming. -## For example, if the current x-axis limits are [0, 50] and -## @code{mouse_wheel_zoom} is 0.4 (40%), then a zoom operation will -## change the limits by 20. -#### @end deftypefn - -## Deprecated in 4.0 - -function retval = mouse_wheel_zoom (val) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "mouse_wheel_zoom is obsolete and will be removed from a future version of Octave, please use the mousehweelzoom axes property instead"); - endif - - if (nargin != 1) - print_usage (); - endif - - fig = get (0, "currentfigure"); - if (isempty (fig)) - retval = get (0, "defaultaxesmousewheelzoom"); - set (0, "defaultaxesmousewheelzoom", val); - else - retval = get (gca, "mousewheelzoom"); - set (gca, "mousewheelzoom", val); - endif - -endfunction -
--- a/scripts/deprecated/nfields.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} nfields (@var{s}) -## Return the number of fields of the structure @var{s}. -## -## @strong{Warning:} @code{nfields} is scheduled for removal in version 4.4. -## Use @code{numfields} instead. -## @seealso{numfields, fieldnames} -## @end deftypefn - -## Deprecated in 4.0 - -function retval = nfields (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "nfields is obsolete and will be removed from a future version of Octave; please use numfields instead"); - endif - - if (nargin < 1) - print_usage (); - endif - - retval = numfields (varargin{:}); - -endfunction -
--- a/scripts/deprecated/octave_tmp_file_name.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{fname} =} octave_tmp_file_name () -## @deftypefnx {} {@var{fname} =} octave_tmp_file_name (@var{dir}) -## @deftypefnx {} {@var{fname} =} octave_tmp_file_name (@var{dir}, @var{prefix}) -## -## @code{octave_tmp_file_name} is deprecated and will be removed in Octave -## version 4.4. Use @code{tempname} for equivalent functionality. -## -## Return a unique temporary filename as a string. -## -## If @var{prefix} is omitted, a value of @qcode{"oct-"} is used. -## If @var{dir} is also omitted, the default directory for temporary files -## (@code{P_tmpdir} is used. If @var{dir} is provided, it must exist, -## otherwise the default directory for temporary files is used. -## @seealso{tempname, tmpnam, mkstemp, tempdir, P_tmpdir, tmpfile} -## @end deftypefn - -## Deprecated in version 4.0 - -function filename = octave_tmp_file_name (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "octave_tmp_file_name is obsolete and will be removed from a future version of Octave, please use tempname instead"); - endif - - filename = tmpnam (varargin{:}); - -endfunction - - -%!assert (1) -
--- a/scripts/deprecated/playaudio.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -## Copyright (C) 1995-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} playaudio (@var{name}, @var{ext}) -## @deftypefnx {} {} playaudio (@var{x}) -## -## @code{playaudio} is deprecated and will be removed in Octave version 4.4. -## Please use @code{audioplayer} in all new code. -## -## Play the audio file @file{@var{name}.@var{ext}} or the audio data -## stored in the vector @var{x}. -## @seealso{lin2mu, mu2lin, loadaudio, saveaudio, setaudio, record} -## @end deftypefn - -## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> -## Created: 11 April 1994 -## Adapted-By: jwe - -function playaudio (name, ext) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "playaudio is obsolete and will be removed from a future version of Octave, please use audioplayer instead"); - endif - - if (nargin < 1 || nargin > 2) - print_usage (); - endif - - if (nargin == 1 && isnumeric (name)) - ## play a vector - if (! isvector (name)) - error ("playaudio: X must be a vector"); - endif - X = name(:) + 127; - unwind_protect - file = tempname (); - fid = fopen (file, "wb"); - fwrite (fid, X, "uchar"); - fclose (fid); - [status, out] = system (sprintf ('cat "%s" > /dev/dsp', file)); - if (status != 0) - system (sprintf ("paplay --raw \"%s\"", file)); - endif - unwind_protect_cleanup - unlink (file); - end_unwind_protect - elseif (nargin >= 1 && ischar (name)) - ## play a file - if (nargin == 1) - name = [name ".lin"]; - elseif (nargin == 2) - name = [name "." ext]; - endif - if (any (strcmp (ext, {"lin", "raw"}))) - [status, out] = system (sprintf ('cat "%s" > /dev/dsp', name)); - if (status != 0) - system (sprintf ('paplay --raw "%s"', name)); - endif - elseif (any (strcmp (ext, {"mu", "au" "snd", "ul"}))) - [status, out] = system (sprintf ('cat "%s" > /dev/audio', name)); - if (status != 0) - system (sprintf ('paplay "%s"', name)); - endif - else - error ("playaudio: unsupported extension '%s'", ext); - endif - else - print_usage (); - endif - -endfunction - - -## Test input validation -%!error playaudio () -%!error playaudio (1,2,3) -%!error <X must be a vector> playaudio (magic (3)) -%!error <unsupported extension> playaudio ("file", "abc") -%!error playaudio ({"abc"}) -
--- a/scripts/deprecated/saveaudio.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -## Copyright (C) 1995-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} saveaudio (@var{name}, @var{x}, @var{ext}, @var{bps}) -## -## @code{saveaudio} is deprecated and will be removed in Octave version 4.4. -## Please use @code{audiowrite} in all new code. -## -## Save a vector @var{x} of audio data to the file -## @file{@var{name}.@var{ext}}. The optional parameters @var{ext} and -## @var{bps} determine the encoding and the number of bits per sample used -## in the audio file (see @code{loadaudio}); defaults are @file{lin} and -## 8, respectively. -## @seealso{lin2mu, mu2lin, loadaudio, playaudio, setaudio, record} -## @end deftypefn - -## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> -## Created: 5 September 1994 -## Adapted-By: jwe - -function saveaudio (name, x, ext, bps) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "saveaudio is obsolete and will be removed from a future version of Octave, please use audiowrite instead"); - endif - - if (nargin < 2 || nargin > 4) - print_usage (); - endif - - if (nargin == 2) - ext = "lin"; - endif - - if (nargin < 4) - bps = 8; - elseif (bps != 8 && bps != 16) - error ("saveaudio: BPS must be either 8 or 16"); - endif - - [nr, nc] = size (x); - if (nc != 1) - if (nr == 1) - x = x'; - nr = nc; - else - error ("saveaudio: X must be a vector"); - endif - endif - - num = fopen ([name, ".", ext], "wb"); - - if (strcmp (ext, "lin") || strcmp (ext, "raw")) - if (bps == 8) - ld = max (abs (x)); - if (ld > 127) # convert 16 to 8 bit - if (ld < 16384) - sc = 64 / ld; - else - sc = 1 / 256; - endif - x = fix (x * sc); - endif - x = x + 127; - c = fwrite (num, x, "uchar"); - else - c = fwrite (num, x, "short"); - endif - elseif (strcmp (ext, "mu") || strcmp (ext, "au") - || strcmp (ext, "snd") || strcmp (ext, "ul")) - y = lin2mu (x); - c = fwrite (num, y, "uchar"); - else - fclose (num); - error ("saveaudio: unsupported extension"); - endif - - fclose (num); - -endfunction -
--- a/scripts/deprecated/setaudio.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -## Copyright (C) 1995-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} setaudio () -## @deftypefnx {} {} setaudio (@var{w_type}) -## @deftypefnx {} {} setaudio (@var{w_type}, @var{value}) -## -## @code{setaudio} is deprecated and will be removed in Octave version 4.4. -## Please scale the audio signal in all new code or use the operating system's -## native tools to adjust audio input and output levels. -## -## Execute the shell command @samp{mixer}, possibly with optional -## arguments @var{w_type} and @var{value}. -## @end deftypefn - -## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> -## Created: 5 October 1994 -## Adapted-By: jwe - -function setaudio (w_type, value) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "setaudio is obsolete and will be removed from a future version of Octave, please scale the audio signal instead"); - endif - - if (nargin == 0) - system ("mixer"); - elseif (nargin == 1) - system (sprintf ("mixer %s", w_type)); - elseif (nargin == 2) - system (sprintf ("mixer %s %d", w_type, value)); - else - print_usage (); - endif - -endfunction -
--- a/scripts/deprecated/syl.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {@var{x} =} syl (@var{A}, @var{B}, @var{C}) -## -## @code{syl} is deprecated and will be removed in Octave version 4.4. -## Use @code{sylvester} for the equivalent functionality. -## -## Solve the Sylvester equation -## @tex -## $$ -## A X + X B + C = 0 -## $$ -## @end tex -## @ifnottex -## -## @example -## A X + X B + C = 0 -## @end example -## -## @end ifnottex -## using standard @sc{lapack} subroutines. For example: -## -## @example -## @group -## syl ([1, 2; 3, 4], [5, 6; 7, 8], [9, 10; 11, 12]) -## @result{} [ -0.50000, -0.66667; -0.66667, -0.50000 ] -## @end group -## @end example -## @end deftypefn - -## Deprecated in version 4.0 - -function x = syl (A, B, C) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "syl is obsolete and will be removed from a future version of Octave, please use sylvester instead"); - endif - - if (nargin != 3 || nargout > 1) - print_usage (); - endif - - x = -sylvester (A, B, C); - -endfunction -
--- a/scripts/deprecated/usage.m Mon Oct 17 16:24:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -## Copyright (C) 2014-2016 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 -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {} {} usage (@var{msg}) -## -## @code{usage} is deprecated and will be removed in Octave version 4.4. -## Please use @code{print_usage} in all new code. -## -## Print the message @var{msg}, prefixed by the string @samp{usage: }, and -## set Octave's internal error state such that control will return to the -## top level without evaluating any more commands. This is useful for -## aborting from functions. -## -## After @code{usage} is evaluated, Octave will print a traceback of all -## the function calls leading to the usage message. -## -## You should use this function for reporting problems errors that result -## from an improper call to a function, such as calling a function with an -## incorrect number of arguments, or with arguments of the wrong type. For -## example, most functions distributed with Octave begin with code like -## this -## -## @example -## @group -## if (nargin != 2) -## usage (\"foo (a, b)\"); -## endif -## @end group -## @end example -## -## @noindent -## to check for the proper number of arguments. -## @seealso{print_usage} -## @end deftypefn - -## Deprecated in version 4.0 - -function retval = usage (varargin) - - persistent warned = false; - if (! warned) - warned = true; - warning ("Octave:deprecated-function", - "usage is obsolete and will be removed from a future version of Octave, please use print_usage instead"); - endif - - retval = __usage__ (varargin{:}); - -endfunction -
--- a/scripts/help/__unimplemented__.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/help/__unimplemented__.m Mon Oct 17 16:26:10 2016 -0400 @@ -49,11 +49,6 @@ txt = ["exifread is deprecated. " ... "The functionality is available in the imfinfo function."]; - case "gsvd" - txt = ["gsvd is not currently part of core Octave. ", ... - "See the linear-algebra package at ", ... - "@url{http://octave.sourceforge.net/linear-algebra/}."]; - case "funm" txt = ["funm is not currently part of core Octave. ", ... "See the linear-algebra package at ", ... @@ -657,7 +652,6 @@ "graph", "graymon", "griddedInterpolant", - "gsvd", "guide", "h5create", "h5disp",
--- a/scripts/plot/appearance/annotation.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/appearance/annotation.m Mon Oct 17 16:26:10 2016 -0400 @@ -268,7 +268,7 @@ ## hidden property to store figure size in absolute (points) ## coordinates - addproperty ("figsize_points", hax, "axesxmtick", []); + addproperty ("figsize_points", hax, "axesxminortickvalues", []); update_figsize_points (hf, {}, hax);
--- a/scripts/plot/appearance/legend.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/appearance/legend.m Mon Oct 17 16:26:10 2016 -0400 @@ -1364,11 +1364,20 @@ %!demo %! clf; +%! subplot (2,1,1); %! rand_2x3_data1 = [0.341447, 0.171220, 0.284370; 0.039773, 0.731725, 0.779382]; %! bar (rand_2x3_data1); %! ylim ([0 1.0]); %! title ("legend() works for bar graphs (hggroups)"); -%! legend ({"1st Bar", "2nd Bar", "3rd Bar"}); +%! legend ({"1st Bar", "2nd Bar", "3rd Bar"}, "location", "northwest"); +%! subplot (2,1,2); +%! x = linspace (0, 10, 20); +%! stem (x, 0.5+x.*rand (size (x))/max (x), "markeredgecolor", [0 0.7 0]); +%! hold on; +%! stem (x+10/(2*20), x.*(1.0+rand (size (x)))/max (x)); +%! xlim ([0 10+10/(2*20)]); +%! title ("legend() works for stem plots (hggroups)"); +%! legend ({"Multicolor", "Unicolor"}, "location", "northwest"); %!demo %! clf;
--- a/scripts/plot/draw/plotyy.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/draw/plotyy.m Mon Oct 17 16:26:10 2016 -0400 @@ -121,8 +121,8 @@ colors = get (ax(1), "colororder"); set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]); - if (strcmp (get (ax(1), "autopos_tag"), "subplot")) - set (ax(2), "autopos_tag", "subplot"); + if (strcmp (get (ax(1), "__autopos_tag__"), "subplot")) + set (ax(2), "__autopos_tag__", "subplot"); else set (ax, "activepositionproperty", "position"); endif
--- a/scripts/plot/util/hdl2struct.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/util/hdl2struct.m Mon Oct 17 16:26:10 2016 -0400 @@ -160,7 +160,7 @@ endwhile ## hidden properties - hidden = {"autopos_tag", "looseinset"}; + hidden = {"__autopos_tag__", "looseinset"}; for ii = 1:numel (hidden) if (isprop (h, hidden{ii})) prpstr.(hidden{ii}) = get (h, hidden{ii});
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Mon Oct 17 16:26:10 2016 -0400 @@ -500,7 +500,10 @@ while (! isempty (kids)) - obj = get (kids(end)); + h_obj = kids(end); + kids = kids(1:(end-1)); + + obj = get (h_obj); if (isfield (obj, "xdata")) obj.xdata = double (obj.xdata); @@ -515,13 +518,12 @@ if (isfield (obj, "units")) units = obj.units; unwind_protect - set (kids(end), "units", "data"); - obj = get (kids(end)); + set (h_obj, "units", "data"); + obj = get (h_obj); unwind_protect_cleanup - set (kids(end), "units", units); + set (h_obj, "units", units); end_unwind_protect endif - kids = kids(1:(end-1)); if (strcmp (obj.visible, "off")) continue; @@ -540,10 +542,6 @@ obj.zdata(obj.zdata<=0) = NaN; endif - if (strcmp (get (obj.parent, "type"), "hggroup")) - obj.displayname = get (obj.parent, "displayname"); - endif - switch (obj.type) case "image" img_data = mapcdata (obj.cdata, obj.cdatamapping, clim, cmap_sz); @@ -614,6 +612,52 @@ withclause{data_idx} = sprintf ("with %s;", imagetype); case "line" + if (strcmp (get (obj.parent, "type"), "hggroup")) + hg = get (obj.parent, "children"); + if (hg(1) == h_obj && ! isempty (get (obj.parent, "displayname"))) + data_idx += 1; + is_image_data(data_idx) = false; + parametric(data_idx) = false; + have_cdata(data_idx) = false; + have_3d_patch(data_idx) = false; + tmpdispname = obj.displayname; + obj.displayname = get (obj.parent, "displayname"); + tmp = undo_string_escapes ( + __maybe_munge_text__ (enhanced, obj, "displayname") + ); + titlespec{data_idx} = ['title "' tmp '"']; + obj.displayname = tmpdispname; + if (! isempty (findobj (obj.parent, "-property", "format", "-depth", 0))) + # Place phantom errorbar data for legend + data{data_idx} = nan (4,1); + usingclause{data_idx} = sprintf ("record=1 using ($1):($2):($3):($4)"); + switch (get (obj.parent, "format")) + case {"box" "boxy" "boxxy"} + errbars = "boxxy"; + case "xyerr" + errbars = "xyerrorbars"; + case "yerr" + errbars = "yerrorbars"; + case "xerr" + errbars = "xerrorbars"; + otherwise + errbars = "xerrorbars"; + endswitch + withclause{data_idx} = sprintf ("with %s linestyle %d", + errbars, sidx(1)); + else + ## Place phantom stemseries data for legend + data{data_idx} = nan (2,1); + usingclause{data_idx} = sprintf ("record=1 using ($1):($2)"); + hgobj = get (obj.parent); + [hgstyle, hgsidx] = do_linestyle_command (hgobj, hgobj.color, data_idx, + plot_stream); + withclause{data_idx} = sprintf ("with %s linestyle %d", + hgstyle{1}, hgsidx(1)); + endif + endif + endif + if (strcmp (obj.linestyle, "none") && (! isfield (obj, "marker") || (isfield (obj, "marker") @@ -634,7 +678,6 @@ titlespec{data_idx} = ['title "' tmp '"']; endif usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata)); - errbars = ""; if (nd == 3) xdat = obj.xdata(:); ydat = obj.ydata(:); @@ -657,7 +700,7 @@ endif [style, sidx] = do_linestyle_command (obj, obj.color, data_idx, - plot_stream, errbars); + plot_stream); if isempty (style{1}) style{1} = "points"; @@ -692,6 +735,10 @@ endif case "patch" + if (strcmp (get (obj.parent, "type"), "hggroup")) + obj.displayname = get (obj.parent, "displayname"); + endif + [nr, nc] = size (obj.xdata); if (! isempty (obj.cdata)) @@ -1149,13 +1196,22 @@ case "surface" view_map = true; - if (isempty (obj.displayname)) - tspec = "title \"\""; - else + tspec = 'title ""'; + if (! isempty (obj.displayname)) + ## Place phantom line data for approximate legend symbol + data_idx += 1; + is_image_data(data_idx) = false; + parametric(data_idx) = false; + have_cdata(data_idx) = false; + have_3d_patch(data_idx) = false; tmp = undo_string_escapes ( __maybe_munge_text__ (enhanced, obj, "displayname") ); - tspec = ['title "' tmp '"']; + titlespec{data_idx} = ['title "' tmp '"']; + data{data_idx} = nan (3,1); + usingclause{data_idx} = sprintf ("record=1 using ($1):($2):($3)"); + withclause{data_idx} = sprintf ("with line linewidth 10 linecolor rgb \"#%02x%02x%02x\"", + round (255*cmap(end/2,:))); endif xdat = obj.xdata; @@ -1850,7 +1906,7 @@ endfunction function [style, ltidx] = do_linestyle_command (obj, linecolor, idx, - plot_stream, errbars = "") + plot_stream) idx = idx + 8; style = {}; ltidx = []; @@ -1882,9 +1938,6 @@ if (! isempty (lt)) fprintf (plot_stream, " %s", lt); endif - if (! isempty (errbars)) - found_style = true; - endif if (isfield (obj, "linewidth")) fprintf (plot_stream, " linewidth %f", obj.linewidth); @@ -1898,111 +1951,100 @@ endif sidx = 1; - if (isempty (errbars)) - if (isempty (lt)) - style{sidx} = ""; - else - style{sidx} = "lines"; - endif - ltidx(sidx) = idx; + if (isempty (lt)) + style{sidx} = ""; + else + style{sidx} = "lines"; + endif + ltidx(sidx) = idx; - facesame = true; - if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") - && ! strcmp (obj.markerfacecolor, "none")) - if (strcmp (obj.markerfacecolor, "auto") - || (isnumeric (obj.markerfacecolor) - && isequal (color, obj.markerfacecolor))) - if (! isempty (pt2)) - fprintf (plot_stream, " pointtype %s", pt2); - style{sidx} = [style{sidx} "points"]; - endif - if (isfield (obj, "markersize")) - fprintf (plot_stream, " pointsize %f", obj.markersize / 3); - endif + facesame = true; + if (! isequal (pt, pt2) && isfield (obj, "markerfacecolor") + && ! strcmp (obj.markerfacecolor, "none")) + if (strcmp (obj.markerfacecolor, "auto") + || (isnumeric (obj.markerfacecolor) + && isequal (color, obj.markerfacecolor))) + if (! isempty (pt2)) + fprintf (plot_stream, " pointtype %s", pt2); + style{sidx} = [style{sidx} "points"]; + endif + if (isfield (obj, "markersize")) + fprintf (plot_stream, " pointsize %f", obj.markersize / 3); + endif + else + facesame = false; + if (! found_style) + fputs (plot_stream, " default"); + endif + fputs (plot_stream, ";\n"); + if (! isempty (style{sidx})) + sidx += 1; + idx += 1; else - facesame = false; - if (! found_style) - fputs (plot_stream, " default"); - endif fputs (plot_stream, ";\n"); - if (! isempty (style{sidx})) - sidx += 1; - idx += 1; - else - fputs (plot_stream, ";\n"); - endif - fprintf (plot_stream, "set style line %d default;\n", idx); - fprintf (plot_stream, "set style line %d", idx); - if (isnumeric (obj.markerfacecolor)) - fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", - round (255*obj.markerfacecolor)); - else - fprintf (plot_stream, " palette"); - endif - if (! isempty (pt2)) - style{sidx} = "points"; - ltidx(sidx) = idx; - fprintf (plot_stream, " pointtype %s", pt2); - endif + endif + fprintf (plot_stream, "set style line %d default;\n", idx); + fprintf (plot_stream, "set style line %d", idx); + if (isnumeric (obj.markerfacecolor)) + fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", + round (255*obj.markerfacecolor)); + else + fprintf (plot_stream, " palette"); + endif + if (! isempty (pt2)) + style{sidx} = "points"; + ltidx(sidx) = idx; + fprintf (plot_stream, " pointtype %s", pt2); + endif + if (isfield (obj, "markersize")) + fprintf (plot_stream, " pointsize %f", obj.markersize / 3); + endif + endif + endif + if (! isempty(pt) && isfield (obj, "markeredgecolor") + && ! strcmp (obj.markeredgecolor, "none")) + if (facesame && (strcmp (obj.markeredgecolor, "auto") + || (isnumeric (obj.markeredgecolor) + && isequal (color, obj.markeredgecolor)))) + if (sidx == 1 && ((length (style{sidx}) == 5 + && strncmp (style{sidx}, "lines", 5)) || isempty (style{sidx}))) + style{sidx} = [style{sidx} "points"]; + fprintf (plot_stream, " pointtype %s", pt); if (isfield (obj, "markersize")) fprintf (plot_stream, " pointsize %f", obj.markersize / 3); endif endif - endif - if (! isempty(pt) && isfield (obj, "markeredgecolor") - && ! strcmp (obj.markeredgecolor, "none")) - if (facesame && ! isempty (pt) - && (strcmp (obj.markeredgecolor, "auto") - || (isnumeric (obj.markeredgecolor) - && isequal (color, obj.markeredgecolor)))) - if (sidx == 1 && ((length (style{sidx}) == 5 - && strncmp (style{sidx}, "lines", 5)) || isempty (style{sidx}))) - if (! isempty (pt)) - style{sidx} = [style{sidx} "points"]; - fprintf (plot_stream, " pointtype %s", pt); - endif - if (isfield (obj, "markersize")) - fprintf (plot_stream, " pointsize %f", obj.markersize / 3); - endif - endif + else + if (! found_style) + fputs (plot_stream, " default"); + endif + fputs (plot_stream, ";\n"); + if (! isempty (style{sidx})) + sidx += 1; + idx += 1; else - if (! found_style) - fputs (plot_stream, " default"); - endif fputs (plot_stream, ";\n"); - if (! isempty (style{sidx})) - sidx += 1; - idx += 1; + endif + fprintf (plot_stream, "set style line %d default;\n", idx); + fprintf (plot_stream, "set style line %d", idx); + if (isnumeric (obj.markeredgecolor) || strcmp (obj.markeredgecolor, "auto")) + if (isnumeric (obj.markeredgecolor)) + edgecolor = obj.markeredgecolor; else - fputs (plot_stream, ";\n"); - endif - fprintf (plot_stream, "set style line %d default;\n", idx); - fprintf (plot_stream, "set style line %d", idx); - if (isnumeric (obj.markeredgecolor) || strcmp (obj.markeredgecolor, "auto")) - if (isnumeric (obj.markeredgecolor)) - edgecolor = obj.markeredgecolor; - else - edgecolor = obj.color; - end - fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", - round (255*edgecolor)); - else - fprintf (plot_stream, " palette"); - endif - if (! isempty (pt)) - style{sidx} = "points"; - ltidx(sidx) = idx; - fprintf (plot_stream, " pointtype %s", pt); - endif - if (isfield (obj, "markersize")) - fprintf (plot_stream, " pointsize %f", obj.markersize / 3); - endif + edgecolor = obj.color; + end + fprintf (plot_stream, " linecolor rgb \"#%02x%02x%02x\"", + round (255*edgecolor)); + else + fprintf (plot_stream, " palette"); + endif + style{sidx} = "points"; + ltidx(sidx) = idx; + fprintf (plot_stream, " pointtype %s", pt); + if (isfield (obj, "markersize")) + fprintf (plot_stream, " pointsize %f", obj.markersize / 3); endif endif - else - style{1} = errbars; - ltidx(1) = idx; - fputs (plot_stream, " pointtype 0"); endif if (! found_style && isempty (style{1})) @@ -2106,7 +2148,7 @@ ## FIXME: Should be 6 pt start, using "*" instead pt = pt2 = "3"; case "none" - pt = pt2 = ""; + pt = pt2 = "-1"; otherwise pt = pt2 = ""; endswitch
--- a/scripts/plot/util/struct2hdl.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/plot/util/struct2hdl.m Mon Oct 17 16:26:10 2016 -0400 @@ -181,7 +181,7 @@ if (! any (strcmpi (s.properties.tag, {"colorbar", "legend"}))) ## regular axes propval = {"position", s.properties.position}; - hid = {"autopos_tag", "looseinset"}; + hid = {"__autopos_tag__", "looseinset"}; for ii = 1:numel (hid) prop = hid{ii}; if (isfield (s.properties, prop)) @@ -646,7 +646,7 @@ function addmissingprops (h, props) - hid = {"autopos_tag", "looseinset"}; + hid = {"__autopos_tag__", "looseinset"}; oldfields = fieldnames (props); curfields = fieldnames (get (h)); missing = ! ismember (oldfields, curfields);
--- a/scripts/polynomial/residue.m Mon Oct 17 16:24:55 2016 -0400 +++ b/scripts/polynomial/residue.m Mon Oct 17 16:26:10 2016 -0400 @@ -333,21 +333,10 @@ endfor ## Add the direct term. - if (numel (k)) pnum += conv (pden, k); endif - ## Check for leading zeros and trim the polynomial coefficients. - if (isa (r, "single") || isa (p, "single") || isa (k, "single")) - small = max ([max(abs(pden)), max(abs(pnum)), 1]) * eps ("single"); - else - small = max ([max(abs(pden)), max(abs(pnum)), 1]) * eps; - endif - - pnum(abs (pnum) < small) = 0; - pden(abs (pden) < small) = 0; - pnum = polyreduce (pnum); pden = polyreduce (pden); @@ -383,7 +372,7 @@ %! assert (isempty (k)); %! assert (e, [1; 2; 1; 2]); %! [br, ar] = residue (r, p, k); -%! assert (br, b, 1e-12); +%! assert (br, [0,b], 1e-12); %! assert (ar, a, 1e-12); %!test @@ -431,6 +420,14 @@ %! b = [1, z1]; %! a = [1, -(p1 + p2), p1*p2, 0, 0]; %! [br, ar] = residue (r, p, k, e); -%! assert (br, b, 1e-8); +%! assert (br, [0,0,b], 1e-7); %! assert (ar, a, 1e-8); +%!test <49291> +%! rf = [1e3, 2e3, 1e3, 2e3]; +%! cf = [316.2e-9, 50e-9, 31.6e-9, 5e-9]; +%! [num, den] = residue (1./cf,-1./(rf.*cf),0); +%! assert (numel (num), 4); +%! assert (numel (den), 5); +%! assert (den(1), 1); +
--- a/test/error.tst Mon Oct 17 16:24:55 2016 -0400 +++ b/test/error.tst Mon Oct 17 16:26:10 2016 -0400 @@ -89,25 +89,3 @@ %! w = warning; %! assert (w, w0); -## Test usage() function - -%!function g () -%! usage ("foo"); -%!endfunction -%!function f () -%! g (); -%!endfunction -%!error <foo> f () - -%!function g () -%! usage ("foo"); -%!endfunction -%!function f () -%! g -%!endfunction -%!error <foo> f () - -%!error usage () - -%!error <foo> usage ("foo\n") -