Bump minimal MATLAB version to R2014a

Ref. #1713
parent e95b93f7
......@@ -2,7 +2,7 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive
TERM: linux
MATLAB_VERSION: R2020a
OLD_MATLAB_VERSION: R2009b
OLD_MATLAB_VERSION: R2014a
# The next stanza creates the version number used for the source tarball and the
# binary packages. Here are the following possible cases:
......
......@@ -14,7 +14,7 @@ are necessary in that case.
In order to run Dynare, you need one of the following:
* MATLAB version 7.9 (R2009b) or above;
* MATLAB version 8.3 (R2014a) or above;
* GNU Octave version 4.4 or above, with the statistics package from
`Octave-Forge`_. Note however that the Dynare installers for Windows and
macOS require a more specific version of Octave, as indicated on the download
......
......@@ -207,12 +207,6 @@ Copyright: 1993-1996 Kurt Hornik
2016-2017 Dynare Team
License: GPL-3+
Files: matlab/missing/strjoin/strjoin.m
Copyright: 2013-2019 Ben Abbott
2007 Muthiah Annamalai
2019 Dynare Team
License: GPL-3+
Files: matlab/lmmcp/catstruct.m
Copyright: 2005 Jos van der Geest <jos@jasen.nl>
2013 Christophe Gouel
......
......@@ -22,7 +22,7 @@ AC_REQUIRE([AX_MATLAB_ARCH])
AC_REQUIRE([AX_MATLAB_VERSION])
AC_REQUIRE([AC_PROG_SED])
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 7.9 (R2009b) at least.])])
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [8.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 8.3 (R2014a) at least.])])
AC_MSG_CHECKING([for options to compile MEX for MATLAB])
......@@ -80,10 +80,6 @@ case ${MATLAB_ARCH} in
;;
esac
# Kludge for incompatibility of older MATLABs (≤ R2011a) with recent gcc
# Include <uchar.h>, because matrix.h needs char16_t
AX_COMPARE_VERSION([$MATLAB_VERSION], [le], [7.12], [MATLAB_CFLAGS="$MATLAB_CFLAGS -include uchar.h"])
# Converts the MATLAB version number into comparable integers with only major and minor version numbers
# For example, 7.4.2 will become 0704
ax_matlab_ver=$(echo "$MATLAB_VERSION" | $SED -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/Z\1ZZ\2Z/' \
......
......@@ -88,7 +88,7 @@ make -j"$NTHREADS"
NAME=dynare-"$VERSION"
PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
mkdir -p \
"$PKGFILES"/mex/matlab/maci64-7.9-9.3 \
"$PKGFILES"/mex/matlab/maci64-8.3-9.3 \
"$PKGFILES"/mex/matlab/maci64-9.4-9.8 \
"$PKGFILES"/mex/octave \
"$PKGFILES"/doc/dynare++ \
......@@ -107,7 +107,7 @@ cp -p "$ROOTDIR"/license.txt "$PKGFILES"
cp -pr "$ROOTDIR"/matlab "$PKGFILES"
cp -pr "$ROOTDIR"/examples "$PKGFILES"
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-7.9-9.3
cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-8.3-9.3
cp -p "$ROOTDIR"/scripts/dynare.el "$PKGFILES"/scripts
cp -pr "$ROOTDIR"/contrib/ms-sbvar/TZcode/MatlabFiles "$PKGFILES"/contrib/ms-sbvar/TZcode
......
function mexpath = add_path_to_mex_files(dynareroot, modifypath)
% Copyright (C) 2015-2019 Dynare Team
% Copyright (C) 2015-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -54,7 +54,7 @@ if isoctave
else
% Add win32 specific paths for Dynare Windows package
if strcmp(computer, 'PCWIN')
tmp = [dynareroot '../mex/matlab/win32-7.9-8.6/'];
tmp = [dynareroot '../mex/matlab/win32-8.3-8.6/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......@@ -65,7 +65,7 @@ else
% Add win64 specific paths for Dynare Windows package
if strcmp(computer, 'PCWIN64')
if matlab_ver_less_than('9.4')
tmp = [dynareroot '../mex/matlab/win64-7.9-9.3/'];
tmp = [dynareroot '../mex/matlab/win64-8.3-9.3/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......@@ -85,7 +85,7 @@ else
% Add macOS paths for Dynare Mac package
if strcmp(computer, 'MACI64')
if matlab_ver_less_than('9.4')
tmp = [dynareroot '../mex/matlab/maci64-7.9-9.3/'];
tmp = [dynareroot '../mex/matlab/maci64-8.3-9.3/'];
if exist(tmp, 'dir')
mexpath = tmp;
if modifypath
......
......@@ -17,7 +17,7 @@ function oo_ = compute_moments_varendo(type, options_, M_, oo_, var_list_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2008-2018 Dynare Team
% Copyright (C) 2008-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -145,7 +145,7 @@ if M_.exo_nbr > 1
end
skipline();
if ~all(M_.H==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_name_requested_vars, varlist_pos] = intersect_stable(var_list_, options_.varobs);
else
[observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable');
......
......@@ -17,7 +17,7 @@ function [ConditionalVarianceDecomposition, ConditionalVarianceDecomposition_ME]
% h is the number of Steps
% p is the number of state innovations and
% Copyright (C) 2010-2017 Dynare Team
% Copyright (C) 2010-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -89,7 +89,7 @@ end
% Measurement error
if ~all(StateSpaceModel.measurement_error==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos,index_subset,index_observables]=intersect_stable(SubsetOfVariables,StateSpaceModel.observable_pos);
else
[observable_pos,index_subset,index_observables]=intersect(SubsetOfVariables,StateSpaceModel.observable_pos,'stable');
......
......@@ -22,7 +22,7 @@ function oo_ = ...
% OUTPUTS
% oo_ [structure] Dynare structure where the results are saved.
% Copyright (C) 2017-2018 Dynare Team
% Copyright (C) 2017-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -63,7 +63,7 @@ if isempty(exogenous_variable_index)
end
end
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(var_list,options_.varobs);
else
[observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable');
......
......@@ -11,7 +11,7 @@ function oo_=disp_moments(y,var_list,M_,options_,oo_)
% OUTPUTS
% oo_ [structure] Dynare's results structure,
% Copyright (C) 2001-2019 Dynare Team
% Copyright (C) 2001-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -50,7 +50,7 @@ y = y(ivar,options_.drop+1:end)';
ME_present=0;
if ~all(M_.H==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos_requested_vars, index_subset, index_observables] = intersect_stable(ivar, options_.varobs_id);
else
[observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable');
......
......@@ -2,7 +2,7 @@ function oo_ = disp_th_moments(dr, var_list, M_, options_, oo_)
% Display theoretical moments of variables
% Copyright (C) 2001-2018 Dynare Team
% Copyright (C) 2001-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -55,7 +55,7 @@ oo_.var = oo_.gamma_y{1};
ME_present=0;
if ~all(M_.H==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
else
[observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
......@@ -105,7 +105,7 @@ if size(stationary_vars, 1) > 0
lh = cellofchararraymaxlength(M_.endo_names(ivar(stationary_vars)))+2;
dyntable(options_, title, headers, M_.endo_names(ivar(stationary_vars)), 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2);
if ME_present
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[stationary_observables, pos_index_subset] = intersect_stable(index_subset, stationary_vars);
else
[stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable');
......
......@@ -16,7 +16,7 @@ function [ldens,Dldens,D2ldens] = lpdfgweibull(x,a,b,c) % --*-- Unitary tests -
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2015-2017 Dynare Team
% Copyright (C) 2015-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -205,7 +205,7 @@ end
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
%$
%$ try
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadl(density, .0000000001, 100000, 1e-10);
%$ else
%$ s = integral(density, 0, 100000);
......@@ -228,7 +228,7 @@ end
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
%$
%$ try
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadl(density, .0000000001, 100000, 1e-10);
%$ else
%$ s = integral(density, 0, 100000);
......@@ -251,7 +251,7 @@ end
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
%$
%$ try
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadl(density, .0000000001, 100000, 1e-10);
%$ else
%$ s = integral(density, 0, 100000);
......@@ -262,7 +262,7 @@ end
%$ end
%$
%$ if t(1)
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ t(2) = abs(s-1)<5e-5;
%$ else
%$ t(2) = abs(s-1)<1e-6;
......@@ -280,8 +280,6 @@ end
%$ try
%$ if isoctave
%$ s = quadgk(xdens, .0000000001, 100000, 1e-10);
%$ elseif matlab_ver_less_than('7.14')
%$ s = quadgk(xdens, .0000000001, 100000, 'AbsTol', 1e-10);
%$ else
%$ s = integral(xdens, 0, 100000);
%$ end
......@@ -303,7 +301,7 @@ end
%$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale));
%$
%$ try
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadl(xdens, .0000000001, 100000, 1e-10);
%$ else
%$ s = integral(xdens, 0, 100000);
......@@ -326,7 +324,7 @@ end
%$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale));
%$
%$ try
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadl(xdens, .0000000001, 100000, 1e-10);
%$ else
%$ s = integral(xdens, 0, 100000);
......@@ -352,7 +350,7 @@ end
%$ try
%$ s = NaN(n, 1);
%$ for i=1:n
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$ else
%$ s(i) = integral(density, 0, .1*i);
......@@ -383,7 +381,7 @@ end
%$ try
%$ s = NaN(n, 1);
%$ for i=1:n
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$ else
%$ s(i) = integral(density, 0, .1*i);
......@@ -414,7 +412,7 @@ end
%$ try
%$ s = NaN(n, 1);
%$ for i=1:n
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
%$ else
%$ s(i) = integral(density, 0, .1*i);
......@@ -429,7 +427,7 @@ end
%$ for i=1:n
%$ x = .1*i;
%$ q = 1-exp(-(x/scale)^shape);
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ t(i+1) = abs(s(i)-q)<5e-5;
%$ else
%$ t(i+1) = abs(s(i)-q)<1e-6;
......
......@@ -83,7 +83,7 @@ MaXNumberOfConditionalDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSaved
ME_present=0;
if ~all(M_.H==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
else
[observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
......
......@@ -86,7 +86,7 @@ MaXNumberOfDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPer
ME_present=0;
if ~all(M_.H==0)
if isoctave || matlab_ver_less_than('8.1')
if isoctave
[observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id);
else
[observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable');
......
......@@ -82,10 +82,10 @@ if isoctave
skipline()
end
else
if matlab_ver_less_than('7.9') % Should match the test in mex/build/matlab/configure.ac
if matlab_ver_less_than('8.3') % Should match the test in mex/build/matlab/configure.ac
% and in m4/ax_mexopts.m4
skipline()
warning('This version of Dynare has only been tested on MATLAB 7.9 (R2009b) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.');
warning('This version of Dynare has only been tested on MATLAB 8.3 (R2014a) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.');
skipline()
end
end
......
......@@ -87,8 +87,8 @@ if isoctave && octave_ver_less_than('5')
p{end+1} = '/missing/ordeig';
end
%% intersect(…, 'stable') doesn't exist in Octave and in MATLAB < R2013a
if isoctave || matlab_ver_less_than('8.1')
%% intersect(…, 'stable') doesn't exist in Octave
if isoctave
p{end+1} = '/missing/intersect_stable';
end
......@@ -116,33 +116,12 @@ if (isoctave && octave_ver_less_than('5')) || (~isoctave && matlab_ver_less_than
p{end+1} = '/missing/isfile';
end
% strsplit and strjoin are missing in MATLAB < R2013a
if ~isoctave && matlab_ver_less_than('8.1')
p{end+1} = '/missing/strsplit';
p{end+1} = '/missing/strjoin';
end
% contains and splitlines don't exist in Octave and in MATLAB < R2016b
if isoctave || matlab_ver_less_than('9.1')
p{end+1} = '/missing/contains';
p{end+1} = '/missing/splitlines';
end
% isrow, iscolumn and ismatrix are missing in Matlab<R2010b
if ~isoctave && matlab_ver_less_than('7.11')
p{end+1} = '/missing/is-row-column-matrix';
end
%% isdiag is missing in MATLAB < R2014a
if ~isoctave && matlab_ver_less_than('8.3')
p{end+1} = '/missing/isdiag';
end
%% narginchk is missing in MATLAB < R2011b
if ~isoctave && matlab_ver_less_than('7.13')
p{end+1} = '/missing/narginchk';
end
P = cellfun(@(c)[dynareroot(1:end-1) c], p, 'uni',false);
% Get mex files folder(s)
......
......@@ -6,7 +6,7 @@ function [state_u,state_n] = get_dynare_random_generator_state()
% For backward compatibility, we return two vectors, but, in recent
% versions of Matlab and in Octave, we return two identical vectors.
% Copyright (C) 2010-2017 Dynare Team
% Copyright (C) 2010-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -23,14 +23,8 @@ function [state_u,state_n] = get_dynare_random_generator_state()
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
matlab_random_streams = ~isoctave;
if matlab_random_streams% Use new matlab interface.
if matlab_ver_less_than('7.12')
s = RandStream.getDefaultStream();
else
if ~isoctave
s = RandStream.getGlobalStream();
end
if isequal(s.Type,'legacy')
state_u = rand('state');
state_n = randn('state');
......@@ -38,7 +32,7 @@ if matlab_random_streams% Use new matlab interface.
state_u = s.State;
state_n = state_u;
end
else% Use old matlab interface.
else
state_u = rand('state');
state_n = randn('state');
end
......@@ -327,7 +327,7 @@ if info(1) == 0 %no errors in solution
cmm = simulated_moment_uncertainty(ind_dMOMENTS, periods, replic,options_,M_,oo_); %covariance matrix of moments
sd = sqrt(diag(cmm));
cc = cmm./(sd*sd');
if isoctave || matlab_ver_less_than('8.3')
if isoctave
[VV,DD] = eig(cc);
%fix for older Matlab versions that do not support computing left eigenvalues, see http://mathworks.com/help/releases/R2012b/matlab/ref/eig.html
[WW,~] = eig(cc.');
......
function r = iscolumn(V)
% Copyright (C) 2018 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
sz = size(V);
r = (length(sz) == 2) && (sz(2) == 1);
function r = ismatrix(V)
% Copyright (C) 2018 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
r = (ndims(V) == 2);
function r = isrow(V)
% Copyright (C) 2018 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
sz = size(V);
r = (length(sz) == 2) && (sz(1) == 1);
function b = isdiag(A) % --*-- Unitary tests --*--
% Copyright (C) 2014-2017 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
if isnumeric(A)
if isquare(A)
% Find non zero elements in matrix A...
[ir, ic] = find(A);
% If the non zero elements are on the diagonal, the corresponding elements
% in ir and ic (row and column numbers) should be equal.
b = isequal(ir, ic);
else
error('isdiag: Input must be a square matrix!')
end
else
error('isdiag: Input must be numeric!')
end
%@test:1
%$ A = zeros(3,3);
%$ t = isdiag(A);
%$ T = all(t);
%@eof:1
%@test:2
%$ A = zeros(3,3); A(1,3) = 1;
%$ t = ~isdiag(A);
%$ T = all(t);
%@eof:2
%@test:3
%$ A = randn(3,3);
%$ t = ~isdiag(A);
%$ T = all(t);
%@eof:3
%@test:4
%$ A = diag(randn(3,1));
%$ t = isdiag(A);
%$ T = all(t);
%@eof:4
%@test:5
%$ A = diag(randn(3,1)); A(1,1) = 0;
%$ t = isdiag(A);
%$ T = all(t);
%@eof:5
function narginchk(minArgs,maxArgs)
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
n = evalin('caller', 'nargin;');
if n < minArgs
error('narginchk: not enough input arguments');
end
if n > maxArgs
error('narginchk: too many input arguments');
end
......@@ -10,7 +10,7 @@ function t = wblinv(proba, scale, shape) % --*-- Unitary tests --*--
% OUTPUTS
% - t [double] scalar such that P(X<=t)=proba
% Copyright (C) 2015-2017 Dynare Team
% Copyright (C) 2015-2020 Dynare Team
%
% This file is part of Dynare.
%
......@@ -147,7 +147,7 @@ t = exp(log(scale)+log(-log(1-proba))/shape);
%$ if debug
%$ [shape, scale, x(k-1)]
%$ end
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ s = quadv(density, 0, x(k-1),1e-10);
%$ else
%$ s = integral(density, 0, x(k-1));
......@@ -155,7 +155,7 @@ t = exp(log(scale)+log(-log(1-proba))/shape);
%$ if debug
%$ [s, abs(p-s)]
%$ end
%$ if isoctave || matlab_ver_less_than('7.14')
%$ if isoctave
%$ t(k) = abs(p-s)<1e-9;
%$ else
%$ t(k) = abs(p-s)<1e-12;
......
function rval = strjoin (cstr, delimiter)
% Adapted from Octave's implementation of strjoin
%
% Limitation: escaped characters (e.g. '\n') in delimiters will not be
% interpreted as the characters they represent.
% Copyright (C) 2013-2019 Ben Abbott
% Copyright (C) 2007 Muthiah Annamalai
% Copyright (C) 2019 Dynare Team
%
% This file is part of Dynare.
%
% Dynare 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.
%
% Dynare 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