Testsuite: check that stochastic solution in block decomposition mode is correct

Only test with mfs=0, since the result is wrong for other mfs values.

Ref. #1726
time-shift
Sébastien Villemot 2021-05-04 16:31:44 +02:00
parent ef58f1329a
commit 58b2bc78c3
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 35 additions and 0 deletions

View File

@ -162,6 +162,8 @@ MODFILES = \
block_bytecode/lola_solve_one_boundary_mfs1.mod \
block_bytecode/lola_solve_one_boundary_mfs2.mod \
block_bytecode/lola_solve_one_boundary_mfs3.mod \
block_bytecode/lola_stochastic.mod \
block_bytecode/lola_stochastic_block.mod \
k_order_perturbation/fs2000k2a.mod \
k_order_perturbation/fs2000k2_use_dll.mod \
k_order_perturbation/fs2000k_1_use_dll.mod \
@ -703,6 +705,8 @@ block_bytecode/lola_solve_one_boundary_mfs2.m.trs: block_bytecode/lola_solve_one
block_bytecode/lola_solve_one_boundary_mfs2.o.trs: block_bytecode/lola_solve_one_boundary.o.trs
block_bytecode/lola_solve_one_boundary_mfs3.m.trs: block_bytecode/lola_solve_one_boundary.m.trs
block_bytecode/lola_solve_one_boundary_mfs3.o.trs: block_bytecode/lola_solve_one_boundary.o.trs
block_bytecode/lola_stochastic_block.m.trs: block_bytecode/lola_stochastic.m.trs
block_bytecode/lola_stochastic_block.o.trs: block_bytecode/lola_stochastic.o.trs
histval_initval_file/ramst_initval_file.m.trs: histval_initval_file/ramst_initval_file_data.m.tls histval_initval_file/ramst_data_generate.m.trs
histval_initval_file/ramst_initval_file.o.trs: histval_initval_file/ramst_initval_file_data.o.tls histval_initval_file/ramst_data_generate.o.trs

View File

@ -0,0 +1,5 @@
// Stochastic version of LOLA model, as benchmark for lola_stochastic_block.mod
@#define deterministic = false
@#define block = false
@#include "lola_common.inc"

View File

@ -0,0 +1,26 @@
/* Stochastic version of block decomposed LOLA model.
Check that policy functions are the same as in non-block version. */
@#define deterministic = false
@#define block = true
@#define mfs = 0
@#include "lola_common.inc"
[~, state_reorder] = sort(oo_.dr.state_var);
ref = load('lola_stochastic_results.mat');
[~, ref_state_reorder] = sort(ref.oo_.dr.state_var);
/* NB: With block, the rows of ghx and ghu are in declaration order (and not in
DR-order as in non-block mode) */
if max(max(abs(oo_.dr.ghx(:, state_reorder) - ref.oo_.dr.ghx(ref.oo_.dr.inv_order_var, ref_state_reorder)))) > 2e-9
error('Error in ghx')
end
if max(max(abs(oo_.dr.ghu - ref.oo_.dr.ghu(ref.oo_.dr.inv_order_var, :)))) > 6e-9
error('Error in ghu')
end