Mercurial > octave
changeset 29982:605275522c37
Deprecate disable_range, disable_diagonal_matrix, disable_permutation_matrix.
Replace configuration options with inverted sense (true means functionality is
disabled) with ordinary sense options: optimize_range, optimize_diagonal_matrix,
optimize_permutation_matrix.
* NEWS: Announce deprecation and replacement functions.
* basics.txi, diagperm.txi, numbers.txi: Replace instances of functions
in Octave manual with their replacements.
* interpreter.cc (maximum_braindamage): Change options for --traditional
to disable Octave optimizations.
* ov-typeinfo.cc (Ftypeinfo): Replace old functions in BIST tests.
* ov.cc: Rename variables Vdisable_diagonal_matrix,
Vdisable_permutation_matrix, Vdisable_range. Update code for inverted
sense of new optimize_XXX variables.
* ov.cc (Foptimize_range, Foptimize_diagonal_matrix,
Foptimize_permutation_matrix): New replacement functions.
* diag-perm.tst, mk-conv-tst.sh: Replace instances of disable_range
with optimize_range in BIST tests.
* scripts/deprecated/module.mk: Add disable_diagonal_matrix.m, disable_permutation_matrix.m, disable_range.m to build system.
* scripts/deprecated/disable_diagonal_matrix.m,
scripts/deprecated/disable_permutation_matrix.m,
scripts/deprecated/disable_range.m: New m-functions to issue a warning before
calling replacement optimize_XXX function.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 17 Aug 2021 14:34:42 -0700 |
parents | 0c3d248a3b44 |
children | ecbcc4647dbe |
files | NEWS doc/interpreter/basics.txi doc/interpreter/diagperm.txi doc/interpreter/numbers.txi libinterp/corefcn/interpreter.cc libinterp/octave-value/ov-typeinfo.cc libinterp/octave-value/ov.cc scripts/deprecated/disable_diagonal_matrix.m scripts/deprecated/disable_permutation_matrix.m scripts/deprecated/disable_range.m scripts/deprecated/module.mk test/diag-perm.tst test/mk-conv-tst.sh |
diffstat | 13 files changed, 301 insertions(+), 113 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Aug 17 10:50:49 2021 -0700 +++ b/NEWS Tue Aug 17 14:34:42 2021 -0700 @@ -254,9 +254,11 @@ - Functions - Function | Replacement - -----------------------|------------------ - | + Function | Replacement + -------------------------- |---------------------------- + disable_diagonal_matrix | optimize_diagonal_matrix + disable_permutation_matrix | optimize_permutation_matrix + disable_range | optimize_range - Properties
--- a/doc/interpreter/basics.txi Tue Aug 17 10:50:49 2021 -0700 +++ b/doc/interpreter/basics.txi Tue Aug 17 14:34:42 2021 -0700 @@ -242,9 +242,9 @@ beep_on_error = true confirm_recursive_rmdir = false crash_dumps_octave_core = false -disable_diagonal_matrix = true -disable_permutation_matrix = true -disable_range = true +optimize_diagonal_matrix = false +optimize_permutation_matrix = false +optimize_range = false fixed_point_format = true history_timestamp_format_string = "%%-- %D %I:%M %p --%%" print_empty_dimensions = false
--- a/doc/interpreter/diagperm.txi Tue Aug 17 10:50:49 2021 -0700 +++ b/doc/interpreter/diagperm.txi Tue Aug 17 14:34:42 2021 -0700 @@ -60,12 +60,12 @@ matrices, as well as permutation matrices. They are stored as special objects, using efficient storage and algorithms, facilitating writing both readable and efficient matrix algebra expressions in the Octave language. The special -treatment may be disabled by using the functions @dfn{disable_diagonal_matrix} -and @dfn{disable_permutation_matrix}. +treatment may be disabled by using the functions @dfn{optimize_diagonal_matrix} +and @dfn{optimize_permutation_matrix}. -@DOCSTRING(disable_diagonal_matrix) +@DOCSTRING(optimize_diagonal_matrix) -@DOCSTRING(disable_permutation_matrix) +@DOCSTRING(optimize_permutation_matrix) The space savings are significant as demonstrated by the following code.
--- a/doc/interpreter/numbers.txi Tue Aug 17 10:50:49 2021 -0700 +++ b/doc/interpreter/numbers.txi Tue Aug 17 14:34:42 2021 -0700 @@ -426,9 +426,9 @@ memory. This space saving optimization may be disabled using the function -@dfn{disable_range}. +@dfn{optimize_range}. -@DOCSTRING(disable_range) +@DOCSTRING(optimize_range) Note that the upper (or lower, if the increment is negative) bound on the range is not always included in the set of values, and that ranges
--- a/libinterp/corefcn/interpreter.cc Tue Aug 17 10:50:49 2021 -0700 +++ b/libinterp/corefcn/interpreter.cc Tue Aug 17 14:34:42 2021 -0700 @@ -2027,9 +2027,9 @@ m_error_system.beep_on_error (true); Fconfirm_recursive_rmdir (octave_value (false)); - Fdisable_diagonal_matrix (octave_value (true)); - Fdisable_permutation_matrix (octave_value (true)); - Fdisable_range (octave_value (true)); + Foptimize_diagonal_matrix (octave_value (false)); + Foptimize_permutation_matrix (octave_value (false)); + Foptimize_range (octave_value (false)); Ffixed_point_format (octave_value (true)); Fprint_empty_dimensions (octave_value (false)); Fprint_struct_array_contents (octave_value (true));
--- a/libinterp/octave-value/ov-typeinfo.cc Tue Aug 17 10:50:49 2021 -0700 +++ b/libinterp/octave-value/ov-typeinfo.cc Tue Aug 17 14:34:42 2021 -0700 @@ -946,10 +946,10 @@ %!assert (typeinfo (diag ([i, 2])), "complex diagonal matrix") %!test -%! if (disable_range ()) +%! if (optimize_range ()) +%! assert (typeinfo (1:2), "range") +%! else %! assert (typeinfo (1:2), "matrix") -%! else -%! assert (typeinfo (1:2), "range") %! endif %!assert (typeinfo (false), "bool")
--- a/libinterp/octave-value/ov.cc Tue Aug 17 10:50:49 2021 -0700 +++ b/libinterp/octave-value/ov.cc Tue Aug 17 14:34:42 2021 -0700 @@ -96,17 +96,17 @@ // We are likely to have a lot of octave_value objects to allocate, so // make the grow_size large. -// If TRUE, don't create special diagonal matrix objects. - -static bool Vdisable_diagonal_matrix = false; - -// If TRUE, don't create special permutation matrix objects. - -static bool Vdisable_permutation_matrix = false; - -// If TRUE, don't create special range objects. - -static bool Vdisable_range = false; +// If TRUE, create special space-optimized diagonal matrix objects. + +static bool Voptimize_diagonal_matrix = true; + +// If TRUE, create special space-optimized permutation matrix objects. + +static bool Voptimize_permutation_matrix = true; + +// If TRUE, create special space-optimized range objects. + +static bool Voptimize_range = true; // FIXME @@ -572,49 +572,49 @@ } octave_value::octave_value (const DiagArray2<double>& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d))) - : dynamic_cast<octave_base_value *> (new octave_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d)))) { maybe_mutate (); } octave_value::octave_value (const DiagArray2<float>& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d)))) { maybe_mutate (); } octave_value::octave_value (const DiagArray2<Complex>& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d)))) { maybe_mutate (); } octave_value::octave_value (const DiagArray2<FloatComplex>& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d)))) { maybe_mutate (); } octave_value::octave_value (const DiagMatrix& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d))) - : dynamic_cast<octave_base_value *> (new octave_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (d)))) { maybe_mutate (); } octave_value::octave_value (const FloatDiagMatrix& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_float_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_float_matrix (FloatMatrix (d)))) { maybe_mutate (); } @@ -692,17 +692,17 @@ } octave_value::octave_value (const ComplexDiagMatrix& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_complex_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_complex_matrix (ComplexMatrix (d)))) { maybe_mutate (); } octave_value::octave_value (const FloatComplexDiagMatrix& d) - : rep (Vdisable_diagonal_matrix - ? dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d))) - : dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d))) + : rep (Voptimize_diagonal_matrix + ? dynamic_cast<octave_base_value *> (new octave_float_complex_diag_matrix (d)) + : dynamic_cast<octave_base_value *> (new octave_float_complex_matrix (FloatComplexMatrix (d)))) { maybe_mutate (); } @@ -732,9 +732,9 @@ } octave_value::octave_value (const PermMatrix& p) - : rep (Vdisable_permutation_matrix - ? dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (p))) - : dynamic_cast<octave_base_value *> (new octave_perm_matrix (p))) + : rep (Voptimize_permutation_matrix + ? dynamic_cast<octave_base_value *> (new octave_perm_matrix (p)) + : dynamic_cast<octave_base_value *> (new octave_matrix (Matrix (p)))) { maybe_mutate (); } @@ -1083,7 +1083,7 @@ if (! force_range && ! r.ok ()) error ("invalid range"); - if (force_range || ! Vdisable_range) + if (force_range || Voptimize_range) return make_range_rep_deprecated (r.base (), r.increment (), r.limit ()); else return dynamic_cast<octave_base_value *> (new octave_matrix (r.matrix_value ())); @@ -1092,7 +1092,7 @@ octave_value::octave_value (const octave::range<char>& r, char type, bool /*force_range*/) #if 0 - : rep (force_range || ! Vdisable_range + : rep (force_range || optimize_range ? dynamic_cast<octave_base_value *> (new octave_char_range (r, type)) : dynamic_cast<octave_base_value *> (type == '"' ? new octave_char_matrix_dq_str (r.array_value ()) @@ -1107,7 +1107,7 @@ } octave_value::octave_value (const octave::range<float>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<float> (r)) : dynamic_cast<octave_base_value *> (new octave_float_matrix (r.array_value ()))) { @@ -1115,7 +1115,7 @@ } octave_value::octave_value (const octave::range<double>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<double> (r)) : dynamic_cast<octave_base_value *> (new octave_matrix (r.array_value ()))) { @@ -1124,7 +1124,7 @@ octave_value::octave_value (const octave::range<octave_int8>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_int8> (r)) : dynamic_cast<octave_base_value *> (new octave_int8_matrix (r.array_value ()))) { @@ -1133,7 +1133,7 @@ octave_value::octave_value (const octave::range<octave_int16>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_int16> (r)) : dynamic_cast<octave_base_value *> (new octave_int16_matrix (r.array_value ()))) { @@ -1142,7 +1142,7 @@ octave_value::octave_value (const octave::range<octave_int32>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_int32> (r)) : dynamic_cast<octave_base_value *> (new octave_int32_matrix (r.array_value ()))) { @@ -1151,7 +1151,7 @@ octave_value::octave_value (const octave::range<octave_int64>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_int64> (r)) : dynamic_cast<octave_base_value *> (new octave_int64_matrix (r.array_value ()))) { @@ -1160,7 +1160,7 @@ octave_value::octave_value (const octave::range<octave_uint8>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_uint8> (r)) : dynamic_cast<octave_base_value *> (new octave_uint8_matrix (r.array_value ()))) { @@ -1169,7 +1169,7 @@ octave_value::octave_value (const octave::range<octave_uint16>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_uint16> (r)) : dynamic_cast<octave_base_value *> (new octave_uint16_matrix (r.array_value ()))) { @@ -1178,7 +1178,7 @@ octave_value::octave_value (const octave::range<octave_uint32>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_uint32> (r)) : dynamic_cast<octave_base_value *> (new octave_uint32_matrix (r.array_value ()))) { @@ -1187,7 +1187,7 @@ octave_value::octave_value (const octave::range<octave_uint64>& r, bool force_range) - : rep (force_range || ! Vdisable_range + : rep (force_range || Voptimize_range ? dynamic_cast<octave_base_value *> (new ov_range<octave_uint64> (r)) : dynamic_cast<octave_base_value *> (new octave_uint64_matrix (r.array_value ()))) { @@ -3639,59 +3639,59 @@ %!error is_dq_string ("foo", 2) */ -DEFUN (disable_permutation_matrix, args, nargout, +DEFUN (optimize_permutation_matrix, args, nargout, doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} disable_permutation_matrix () -@deftypefnx {} {@var{old_val} =} disable_permutation_matrix (@var{new_val}) -@deftypefnx {} {} disable_permutation_matrix (@var{new_val}, "local") -Query or set whether storing permutation matrices in a special space-efficient -format is disabled. - -The default value is false. If this option is set to true, Octave will store +@deftypefn {} {@var{val} =} optimize_permutation_matrix () +@deftypefnx {} {@var{old_val} =} optimize_permutation_matrix (@var{new_val}) +@deftypefnx {} {} optimize_permutation_matrix (@var{new_val}, "local") +Query or set whether a special space-efficient format is used for storing +permutation matrices. + +The default value is true. If this option is set to false, Octave will store permutation matrices as full matrices. When called from inside a function with the @qcode{"local"} option, the setting is changed locally for the function and any subroutines it calls. The original setting is restored when exiting the function. -@seealso{disable_range, disable_diagonal_matrix} +@seealso{optimize_range, optimize_diagonal_matrix} @end deftypefn */) { - return SET_INTERNAL_VARIABLE (disable_permutation_matrix); + return SET_INTERNAL_VARIABLE (optimize_permutation_matrix); } /* %!function p = __test_dpm__ (dpm) -%! disable_permutation_matrix (dpm, "local"); +%! optimize_permutation_matrix (dpm, "local"); %! [~, ~, p] = lu ([1,2;3,4]); %!endfunction -%!assert (typeinfo (__test_dpm__ (false)), "permutation matrix") -%!assert (typeinfo (__test_dpm__ (true)), "matrix") +%!assert (typeinfo (__test_dpm__ (true)), "permutation matrix") +%!assert (typeinfo (__test_dpm__ (false)), "matrix") */ -DEFUN (disable_diagonal_matrix, args, nargout, +DEFUN (optimize_diagonal_matrix, args, nargout, doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} disable_diagonal_matrix () -@deftypefnx {} {@var{old_val} =} disable_diagonal_matrix (@var{new_val}) -@deftypefnx {} {} disable_diagonal_matrix (@var{new_val}, "local") -Query or set whether storing diagonal matrices in a special space-efficient -format is disabled. - -The default value is false. If this option is set to true, Octave will store +@deftypefn {} {@var{val} =} optimize_diagonal_matrix () +@deftypefnx {} {@var{old_val} =} optimize_diagonal_matrix (@var{new_val}) +@deftypefnx {} {} optimize_diagonal_matrix (@var{new_val}, "local") +Query or set whether a special space-efficient format is used for storing +diagonal matrices. + +The default value is true. If this option is set to false, Octave will store diagonal matrices as full matrices. When called from inside a function with the @qcode{"local"} option, the setting is changed locally for the function and any subroutines it calls. The original setting is restored when exiting the function. -@seealso{disable_range, disable_permutation_matrix} +@seealso{optimize_range, optimize_permutation_matrix} @end deftypefn */) { - return SET_INTERNAL_VARIABLE (disable_diagonal_matrix); + return SET_INTERNAL_VARIABLE (optimize_diagonal_matrix); } /* %!function [x, xi, fx, fxi] = __test_ddm__ (ddm) -%! disable_diagonal_matrix (ddm, "local"); +%! optimize_diagonal_matrix (ddm, "local"); %! x = eye (2); %! xi = x*i; %! fx = single (x); @@ -3699,51 +3699,51 @@ %!endfunction %!shared x, xi, fx, fxi -%! [x, xi, fx, fxi] = __test_ddm__ (false); +%! [x, xi, fx, fxi] = __test_ddm__ (true); %!assert (typeinfo (x), "diagonal matrix") %!assert (typeinfo (xi), "complex diagonal matrix") %!assert (typeinfo (fx), "float diagonal matrix") %!assert (typeinfo (fxi), "float complex diagonal matrix") %!shared x, xi, fx, fxi -%! [x, xi, fx, fxi] = __test_ddm__ (true); +%! [x, xi, fx, fxi] = __test_ddm__ (false); %!assert (typeinfo (x), "matrix") %!assert (typeinfo (xi), "complex matrix") %!assert (typeinfo (fx), "float matrix") %!assert (typeinfo (fxi), "float complex matrix") */ -DEFUN (disable_range, args, nargout, +DEFUN (optimize_range, args, nargout, doc: /* -*- texinfo -*- -@deftypefn {} {@var{val} =} disable_range () -@deftypefnx {} {@var{old_val} =} disable_range (@var{new_val}) -@deftypefnx {} {} disable_range (@var{new_val}, "local") -Query or set whether storing ranges in a special space-efficient format is -disabled. - -The default value is false. If this option is set to true, Octave will store +@deftypefn {} {@var{val} =} optimize_range () +@deftypefnx {} {@var{old_val} =} optimize_range (@var{new_val}) +@deftypefnx {} {} optimize_range (@var{new_val}, "local") +Query or set whether a special space-efficient format is used for storing +ranges. + +The default value is true. If this option is set to false, Octave will store ranges as full matrices. When called from inside a function with the @qcode{"local"} option, the setting is changed locally for the function and any subroutines it calls. The original setting is restored when exiting the function. -@seealso{disable_diagonal_matrix, disable_permutation_matrix} +@seealso{optimize_diagonal_matrix, optimize_permutation_matrix} @end deftypefn */) { - return SET_INTERNAL_VARIABLE (disable_range); + return SET_INTERNAL_VARIABLE (optimize_range); } /* %!function r = __test_dr__ (dr) -%! disable_range (dr, "local"); +%! optimize_range (dr, "local"); %! ## Constant folding will produce range for 1:13. %! base = 1; %! limit = 13; %! r = base:limit; %!endfunction -%!assert (typeinfo (__test_dr__ (false)), "range") -%!assert (typeinfo (__test_dr__ (true)), "matrix") +%!assert (typeinfo (__test_dr__ (true)), "range") +%!assert (typeinfo (__test_dr__ (false)), "matrix") */ OCTAVE_NAMESPACE_END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/disable_diagonal_matrix.m Tue Aug 17 14:34:42 2021 -0700 @@ -0,0 +1,61 @@ +######################################################################## +## +## Copyright (C) 2021 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or <https://octave.org/copyright/>. +## +## 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 +## <https://www.gnu.org/licenses/>. +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{val} =} disable_diagonal_matrix () +## @deftypefnx {} {@var{old_val} =} disable_diagonal_matrix (@var{new_val}) +## @deftypefnx {} {} disable_diagonal_matrix (@var{new_val}, "local") +## Query or set whether storing diagonal matrices in a special space-efficient +## format is disabled. +## +## The default value is false. If this option is set to true, Octave will store +## ranges as full matrices. +## +## When called from inside a function with the @qcode{"local"} option, the setting +## is changed locally for the function and any subroutines it calls. The original +## setting is restored when exiting the function. +## @seealso{disable_diagonal_matrix, disable_permutation_matrix} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 9. + +function retval = disable_diagonal_matrix (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "disable_diagonal_matrix is obsolete and will be removed from a future version of Octave, please use optimize_diagonal_matrix instead\n"); + endif + + if (nargin == 0) + retval = ! optimize_diagonal_matrix (); + elseif (nargout == 0) + optimize_diagonal_matrix (! varargin{1}, varargin{2:end}); + else + retval = ! optimize_diagonal_matrix (! varargin{1}, varargin{2:end}); + endif + +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/disable_permutation_matrix.m Tue Aug 17 14:34:42 2021 -0700 @@ -0,0 +1,61 @@ +######################################################################## +## +## Copyright (C) 2021 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or <https://octave.org/copyright/>. +## +## 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 +## <https://www.gnu.org/licenses/>. +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{val} =} disable_permutation_matrix () +## @deftypefnx {} {@var{old_val} =} disable_permutation_matrix (@var{new_val}) +## @deftypefnx {} {} disable_permutation_matrix (@var{new_val}, "local") +## Query or set whether storing permutation matrices in a special +## space-efficient format is disabled. +## +## The default value is false. If this option is set to true, Octave will store +## ranges as full matrices. +## +## When called from inside a function with the @qcode{"local"} option, the setting +## is changed locally for the function and any subroutines it calls. The original +## setting is restored when exiting the function. +## @seealso{disable_diagonal_matrix, disable_permutation_matrix} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 9. + +function retval = disable_permutation_matrix (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "disable_permutation_matrix is obsolete and will be removed from a future version of Octave, please use optimize_permutation_matrix instead\n"); + endif + + if (nargin == 0) + retval = ! optimize_permutation_matrix (); + elseif (nargout == 0) + optimize_permutation_matrix (! varargin{1}, varargin{2:end}); + else + retval = ! optimize_permutation_matrix (! varargin{1}, varargin{2:end}); + endif + +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/deprecated/disable_range.m Tue Aug 17 14:34:42 2021 -0700 @@ -0,0 +1,61 @@ +######################################################################## +## +## Copyright (C) 2021 The Octave Project Developers +## +## See the file COPYRIGHT.md in the top-level directory of this +## distribution or <https://octave.org/copyright/>. +## +## 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 +## <https://www.gnu.org/licenses/>. +## +######################################################################## + +## -*- texinfo -*- +## @deftypefn {} {@var{val} =} disable_range () +## @deftypefnx {} {@var{old_val} =} disable_range (@var{new_val}) +## @deftypefnx {} {} disable_range (@var{new_val}, "local") +## Query or set whether storing ranges in a special space-efficient format is +## disabled. +## +## The default value is false. If this option is set to true, Octave will store +## ranges as full matrices. +## +## When called from inside a function with the @qcode{"local"} option, the setting +## is changed locally for the function and any subroutines it calls. The original +## setting is restored when exiting the function. +## @seealso{disable_diagonal_matrix, disable_permutation_matrix} +## @end deftypefn + +## FIXME: DEPRECATED: Remove in version 9. + +function retval = disable_range (varargin) + + persistent warned = false; + if (! warned) + warned = true; + warning ("Octave:deprecated-function", + "disable_range is obsolete and will be removed from a future version of Octave, please use optimize_range instead\n"); + endif + + if (nargin == 0) + retval = ! optimize_range (); + elseif (nargout == 0) + optimize_range (! varargin{1}, varargin{2:end}); + else + retval = ! optimize_range (! varargin{1}, varargin{2:end}); + endif + +endfunction
--- a/scripts/deprecated/module.mk Tue Aug 17 10:50:49 2021 -0700 +++ b/scripts/deprecated/module.mk Tue Aug 17 14:34:42 2021 -0700 @@ -2,6 +2,9 @@ %canon_reldir%_FCN_FILES = \ %reldir%/.oct-config \ + %reldir%/disable_diagonal_matrix.m \ + %reldir%/disable_permutation_matrix.m \ + %reldir%/disable_range.m \ %reldir%/runtests.m %canon_reldir%dir = $(fcnfiledir)/deprecated
--- a/test/diag-perm.tst Tue Aug 17 10:50:49 2021 -0700 +++ b/test/diag-perm.tst Tue Aug 17 14:34:42 2021 -0700 @@ -187,10 +187,10 @@ %! d = rand (mn, 1); %! D = diag (d, m, n); %! Dslice = D (1:(m-3), 1:(n-2)); -%! if (disable_range ()) +%! if (optimize_range ()) +%! assert (typeinfo (Dslice), "diagonal matrix"); +%! else %! assert (typeinfo (Dslice), "matrix"); -%! else -%! assert (typeinfo (Dslice), "diagonal matrix"); %! endif ## preserve dense matrix structure when scaling
--- a/test/mk-conv-tst.sh Tue Aug 17 10:50:49 2021 -0700 +++ b/test/mk-conv-tst.sh Tue Aug 17 14:34:42 2021 -0700 @@ -72,10 +72,10 @@ %! ui64m = uint64 (rand (5) * 10); %! %!test -%! if (disable_range ()) +%! if (optimize_range ()) +%! assert (typeinfo (r), "range") +%! else %! assert (typeinfo (r), "matrix") -%! else -%! assert (typeinfo (r), "range") %! endif %!assert (typeinfo (dq), "string") %!assert (typeinfo (sq), "sq_string")