Compare commits

...

16 Commits

Author SHA1 Message Date
Sébastien Villemot 7bf0395a27 Merge branch 'cet-octave-one-more-time' into 'master'
Fixes for CET tests on Octave

See merge request Dynare/dynare!2254
2023-12-22 09:17:15 +00:00
Willi Mutschler ee2545f84d
Fixes for CET tests on Octave
- the mode file was previously saved as '-v7.3', now it is '-v6'
- mode_compute=1 and additional_optimizer=1 do not work under Octave
2023-12-22 09:48:56 +01:00
Sébastien Villemot dd1669082e Merge branch 'Octave' into 'master'
graph_comparison_irfs.m: compatibility fix for Octave

See merge request Dynare/dynare!2252
2023-12-22 08:42:23 +00:00
Johannes Pfeifer 9c28f5feaf graph_comparison_irfs.m: compatibility fix for Octave 2023-12-21 21:17:53 +01:00
Sébastien Villemot 31ce155852
Bump major version number 2023-12-21 16:06:46 +01:00
Sébastien Villemot c36b695cd9 Merge branch 'get_mean' into 'master'
get_mean.m: remove globals and fix internal logic

See merge request Dynare/dynare!2250
2023-12-21 14:37:22 +00:00
Sébastien Villemot 6cad684980
Merge branch 'dynare-plot_initval_decomp'
Ref. !2249
2023-12-21 14:04:06 +01:00
Marco Ratto a4e6531420
check existence of oo_.initval_decomposition and, if absent, compute it
Closes: #1913
2023-12-21 14:03:51 +01:00
Sébastien Villemot d09a206c7c
Merge branch 'dynare-bugfixes'
Ref. !2248
2023-12-21 14:02:51 +01:00
Marco Ratto fbf62255c6
fix undefined new filter option 2023-12-21 14:02:20 +01:00
Sébastien Villemot 368c93214e
Build system: make xvfb-run optional for running the Octave testsuite
xvfb-run is a Debian-specific program.

Closes: #1892
2023-12-21 13:46:34 +01:00
Johannes Pfeifer 8deeaa7252 Add version of get_mean without globals 2023-12-21 13:41:17 +01:00
Johannes Pfeifer e3e6f4c9b4 🐛 get_mean.m: fix internal logic 2023-12-21 13:40:23 +01:00
Sébastien Villemot 5216cec249
Build system: update comment about GSL_CBLAS_LIB with newly-opened issue against Meson 2023-12-21 11:57:18 +01:00
Sébastien Villemot cae5a00e80
Windows package: bump dependencies 2023-12-21 11:20:44 +01:00
Sébastien Villemot 42e2f77e4a
Emacs mode: add IRF matching keywords 2023-12-21 11:20:27 +01:00
15 changed files with 137 additions and 59 deletions

View File

@ -11,12 +11,12 @@ variables:
# - if VERSION was already set (when manually running a pipeline), use it
# - if we are in the official Dynare repository:
# + if on a tag: use the tag
# + if on master: use 6-unstable-$TIMESTAMP-$COMMIT
# + if on master: use 7-unstable-$TIMESTAMP-$COMMIT
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
before_script:
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ -n $CI_COMMIT_TAG ]]; then export VERSION=$CI_COMMIT_TAG; fi'
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ $CI_COMMIT_REF_NAME == master ]]; then export VERSION=6-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]] && [[ $CI_COMMIT_REF_NAME == master ]]; then export VERSION=7-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
- 'if [[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Dynare ]]; then export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'
- 'if [[ -z $VERSION ]]; then export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA; fi'

View File

@ -108,8 +108,9 @@ for jexo = unique_shock_entries' % loop over cell with shock names
% Adding a legend at the bottom
axes('Position',[0, 0, 1, 1],'Visible','off');
lgd = legend([plt_data,plt_model],{'Data', 'Model'}, 'Location', 'southeast','NumColumns',2,'FontSize',14);
lgd.Position = [0.37 0.01 lgd.Position(3) lgd.Position(4)];
if ~isoctave
lgd.Position = [0.37 0.01 lgd.Position(3) lgd.Position(4)];
end
dyn_saveas(fig_irf,[graph_directory_name filesep fname '_matched_irf_' jexo{:} int2str(fig)],nodisplay,graph_format);
if TeX && any(strcmp('eps',cellstr(graph_format)))
fprintf(fid_TeX,'\\begin{figure}[H]\n');

View File

@ -44,6 +44,7 @@ end
if ismember(flag,{'filter','all'})
options_occbin_.filter.state_covariance = false;
options_occbin_.filter.guess_regime = false;
options_occbin_.filter.periodic_solution = true;
options_occbin_.filter.use_relaxation = false;
end

View File

@ -1,14 +1,15 @@
function y0 = get_mean(varargin)
% function x = get_mean(vname1, vname2, <order>)
% returns the steady-state of a variable identified by its name
% function y0 = get_mean(varargin)
% returns the mean of a variable identified by its name
%
% INPUTS:
% vname1, vname2, ... : list of variable names
% order: if integer 1 or 2, optionally last input can trigger the order
% at which steady state is computed
% vargargin inputs containing
% - vname1, vname2, ... : list of variable names
% - order: if integer 1 or 2, optionally last input can trigger the order
% at which steady state is computed
%
% OUTPUTS
% x: steady state values
% y0: mean values
%
% SPECIAL REQUIREMENTS
% none
@ -30,27 +31,6 @@ function y0 = get_mean(varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global M_ oo_ options_
global M_ options_ oo_
if ~isempty(regexp(varargin{end},'\d','ONCE')) && isempty(regexp(varargin{end},'\D','ONCE'))
order=eval(varargin{end});
else
order=1;
end
if order==1
ys_ = oo_.steady_state;
ys_ = evaluate_steady_state(ys_,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_,options_,true);
elseif order==2
ys_ = oo_.dr.ys;
ys_(oo_.dr.order_var)=ys_(oo_.dr.order_var)+oo_.dr.ghs2./2;
else
return
end
lgy_ = M_.endo_names;
mfys=nan(length(varargin),1);
for j=1:length(varargin)
mfys(j) = find(strcmp(varargin{j},lgy_));
end
y0 = ys_(mfys);
y0=get_mean_no_globals(M_, oo_, options_, varargin{:});

View File

@ -0,0 +1,76 @@
function y0 = get_mean_no_globals(M_, oo_, options_, varargin)
% function y0 = get_mean_no_globals(M_, oo_, options_, varargin)
% returns the mean of a variable identified by its name
%
% INPUTS:
% M_ [structure] describing the model
% oo_ [structure] storing the results
% options_ [structure] describing the options
% vargargin inputs containing
% - vname1, vname2, ... : list of variable names
% - order: if integer 1 or 2, optionally last input can trigger the order
% at which steady state is computed
%
% OUTPUTS
% y0: mean values
%
% SPECIAL REQUIREMENTS
% none
% Copyright © 2019-2023 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 <https://www.gnu.org/licenses/>.
if ~isempty(regexp(varargin{end},'\d','ONCE')) && isempty(regexp(varargin{end},'\D','ONCE'))
order=eval(varargin{end});
nvars=length(varargin)-1;
else
order=1;
nvars=length(varargin);
end
if order==1
if isfield(oo_,'dr') && isfield(oo_.dr,'ys')
ys_=oo_.dr.ys;
else
ys_ = oo_.steady_state;
ys_ = evaluate_steady_state(ys_,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_,options_,true);
end
elseif order==2
if isfield(oo_,'dr') && isfield(oo_.dr,'ys')
ys_=oo_.dr.ys;
if ~isfield(oo_.dr,'ghs2')
error('get_mean: ghs2 needs to be present in oo_ to compute mean at order=2')
else
ys_(oo_.dr.order_var)=ys_(oo_.dr.order_var)+oo_.dr.ghs2./2;
end
else
error('get_mean: decision rules need to be present in oo_ to compute mean')
end
else
error('get_mean: order>2 not implemented')
end
mfys=NaN(nvars,1);
for j=1:nvars
endo_index=find(strcmp(varargin{j},M_.endo_names));
if isempty(endo_index)
error('get_mean: unknown variables %s requested',varargin{j})
else
mfys(j) = find(strcmp(varargin{j},M_.endo_names));
end
end
y0 = ys_(mfys);

View File

@ -249,6 +249,15 @@ end
if ~isempty(init2shocks) && ~expand
if not(isfield(oo_,'initval_decomposition'))
disp('computing initval shock decomposition ...')
bayestopt_ = evalin('base','bayestopt_');
estim_params_ = evalin('base','estim_params_');
M_= evalin('base','M_');
options_ = set_default_initial_condition_decomposition_options(options_);
oo_ = initial_condition_decomposition(M_,oo_,options_,0,bayestopt_,estim_params_);
out = oo_;
end
n=size(init2shocks,1);
M_.exo_names_init=M_.exo_names;
for i=1:n
@ -347,7 +356,7 @@ if options_.plot_shock_decomp.use_shock_groups
else
% here we know we only have one variable to handle
if isstruct(q2a.aux) && ischar(q2a.aux.y)
steady_state_aux = get_mean(q2a.aux.y);
steady_state_aux = get_mean_no_globals(M_, oo_, options_, q2a.aux.y);
q2a.aux.y=repmat(steady_state_aux,16,1);
q2a.aux.yss=steady_state_aux;
end

View File

@ -1,14 +1,6 @@
# TODO:
# - find a way to set GSL_BLAS_LIB to an empty value when querying pkg-config
# for gsl; otherwise there is a risk of overriding OpenBLAS/MKL (though
# probably not in our current setup); the pkgconfig_define option of
# dep.get_variable() is unfortunately not helpful
# Close to https://github.com/mesonbuild/meson/issues/3606
# - See what to do with xvfb-run (see #1892). Maybe try to detect it from meson.build, and pass it optionally to the test driver script
project('dynare',
'cpp', 'fortran', 'c',
version : '6-unstable',
version : '7-unstable',
# NB: update C++ standard in .clang-format whenever the following is modified
default_options : [ 'cpp_std=gnu++20', 'fortran_std=f2018',
'c_std=gnu17', 'warning_level=2' ],
@ -75,6 +67,12 @@ else
endif
openmp_dep = dependency('openmp')
# TODO: find a way to set GSL_BLAS_LIB to an empty value; otherwise there is a
# risk of overriding OpenBLAS/MKL (though probably not in our current setup);
# the pkgconfig_define option of dep.get_variable() is unfortunately not
# helpful, since that latter method cannot query the “libs”. Reported as:
# https://github.com/mesonbuild/meson/issues/12649
gsl_dep = dependency('gsl')
if get_option('build_for') == 'octave'
@ -1836,9 +1834,15 @@ mod_and_m_tests = [
base_test_driver_args = [ get_option('build_for') ]
if get_option('build_for') == 'matlab'
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch ]
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch, '' ]
else
base_test_driver_args += [ octave_exe.full_path(), octave_version, '' ]
xvfb_run_exe = find_program('xvfb-run', required : false) # Debian-specific utility
if xvfb_run_exe.found()
base_test_driver_args += xvfb_run_exe.full_path()
else
base_test_driver_args += ''
endif
endif
base_test_driver_args += [ meson.current_source_dir(), meson.current_build_dir() ]

@ -1 +1 @@
Subproject commit 520876560d5bb4c886a11de681557dd05cbc200e
Subproject commit e32025a76fb156a9af8101f9f43faf7eaa2f72ef

View File

@ -88,7 +88,7 @@
'("stderr" "values" "periods" "scales" "restriction" "exclusion"
"upper_cholesky" "lower_cholesky" "equation" "bind" "relax" "error_bind"
"error_relax" "add" "multiply" "target" "auxname_target_nonstationary"
"component" "growth" "auxname" "kind")
"component" "growth" "auxname" "kind" "weights")
"Dynare statements-like keywords.")
;; Those keywords that makes the lexer enter the DYNARE_BLOCK start condition
@ -105,7 +105,8 @@
"deterministic_trends" "optim_weights" "homotopy_setup"
"conditional_forecast_paths" "svar_identification" "moment_calibration"
"irf_calibration" "ramsey_constraints" "generate_irfs" "matched_moments"
"occbin_constraints" "model_replace" "pac_target_info" "verbatim")
"occbin_constraints" "model_replace" "pac_target_info" "matched_irfs"
"matched_irfs_weights" "verbatim")
"Dynare block keywords."))
;; Mathematical functions and operators used in model equations (see "hand_side" in Bison file)

View File

@ -6,7 +6,7 @@ set -e
shopt -s extglob
if (($# < 7 )); then
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch xvfb_run_exe source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
exit 1
fi
@ -14,9 +14,10 @@ build_for=$1
matlab_octave_exe=$2
matlab_octave_version=$3
matlab_arch=$4
source_root=$5
build_root=$6
shift 6
xvfb_run_exe=$5
source_root=$6
build_root=$7
shift 7
test_files=()
while (($# > 0)); do
@ -111,6 +112,11 @@ for test_file in "${test_files[@]}"; do
# We cannot use the --no-window-system option, and we have to use xvfb
# See the following Octave bug: https://savannah.gnu.org/bugs/?62101
# (this affects at least tests/shock_decomposition/ls2003_plot.mod)
xvfb-run -a "$matlab_octave_exe" --no-init-file --silent --no-history "$test_arg"
test_cmd=("$matlab_octave_exe" --no-init-file --silent --no-history "$test_arg")
if [[ -n $xvfb_run_exe ]]; then
"$xvfb_run_exe" -a "${test_cmd[@]}"
else
"${test_cmd[@]}"
fi
fi
done

Binary file not shown.

View File

@ -83,7 +83,7 @@ method_of_moments(mom_method = irf_matching
%, mode_check_neighbourhood_size
%, mode_check_number_of_points
, mode_check_symmetric_plots = 0
, mode_compute = 1
, mode_compute = 4
, mode_file = cet_original_mode
%, nobs
%, no_posterior_kernel_density

View File

@ -192,7 +192,7 @@ method_of_moments(mom_method = irf_matching
, mh_replic=10
, plot_priors = 0
, nograph
, mode_compute = 1
, mode_compute = 5
, posterior_sampling_method = 'slice'
, posterior_sampler_options = ('rotated',1
% ,'mode_files'

View File

@ -156,14 +156,14 @@ method_of_moments(mom_method = irf_matching
method_of_moments(mom_method = irf_matching
, additional_optimizer_steps = [1]
, additional_optimizer_steps = [4]
, cova_compute=1
, dirname=cet_tarb_results
, irf_matching_file = cet_irf_matching_file
, mh_conf_sig = 0.90
, mh_replic=0
%, mode_check
, mode_compute = 4
, mode_compute = 5
, mode_file = 'cet_tarb_results/method_of_moments/cet_tarb_mh_mode'
, plot_priors = 0
, nograph

View File

@ -18,7 +18,7 @@ MATLAB64_VERSION = 20231122
## Build dependencies
# pacman -Ss mingw-w64-x86_64-boost
MINGW64_BOOST_VERSION = 1.83.0-2
MINGW64_BOOST_VERSION = 1.84.0-1
# pacman -Ss mingw-w64-x86_64-gsl
MINGW64_GSL_VERSION = 2.7.1-2