From f4849421545ae5b9360bf62c876395f9e8b3a0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 22 Jan 2019 18:10:16 +0100 Subject: [PATCH] Update dseries submodule --- dynare++/extern/matlab/dynare_simul.cc | 4 ++-- dynare++/kord/decision_rule.cc | 4 ++-- dynare++/kord/decision_rule.hh | 12 ++++-------- dynare++/tl/cc/twod_matrix.cc | 7 +++++++ matlab/modules/dseries | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dynare++/extern/matlab/dynare_simul.cc b/dynare++/extern/matlab/dynare_simul.cc index e81b70982..0bc2c70ff 100644 --- a/dynare++/extern/matlab/dynare_simul.cc +++ b/dynare++/extern/matlab/dynare_simul.cc @@ -110,8 +110,8 @@ extern "C" { dr(pol, PartitionY(nstat, npred, nboth, nforw), nexog, ConstVector{ysteady}); // form the shock realization - TwoDMatrix shocks_mat(nexog, nper, ConstVector{shocks}); - TwoDMatrix vcov_mat(nexog, nexog, ConstVector{vcov}); + ConstTwoDMatrix shocks_mat(nexog, nper, ConstVector{shocks}); + ConstTwoDMatrix vcov_mat(nexog, nexog, ConstVector{vcov}); GenShockRealization sr(vcov_mat, shocks_mat, seed); // simulate and copy the results TwoDMatrix *res_mat diff --git a/dynare++/kord/decision_rule.cc b/dynare++/kord/decision_rule.cc index e1998d0d7..a26667331 100644 --- a/dynare++/kord/decision_rule.cc +++ b/dynare++/kord/decision_rule.cc @@ -560,7 +560,7 @@ RTSimulationWorker::operator()() not work for semidefinite matrices. */ void -RandomShockRealization::choleskyFactor(const TwoDMatrix &v) +RandomShockRealization::choleskyFactor(const ConstTwoDMatrix &v) { factor = v; lapack_int rows = factor.nrows(); @@ -578,7 +578,7 @@ RandomShockRealization::choleskyFactor(const TwoDMatrix &v) decomposition. It works for semidifinite matrices. */ void -RandomShockRealization::schurFactor(const TwoDMatrix &v) +RandomShockRealization::schurFactor(const ConstTwoDMatrix &v) { SymSchurDecomp ssd(v); ssd.getFactor(factor); diff --git a/dynare++/kord/decision_rule.hh b/dynare++/kord/decision_rule.hh index 5b9fa80da..72f0081b0 100644 --- a/dynare++/kord/decision_rule.hh +++ b/dynare++/kord/decision_rule.hh @@ -990,7 +990,7 @@ protected: MersenneTwister mtwister; TwoDMatrix factor; public: - RandomShockRealization(const TwoDMatrix &v, unsigned int iseed) + RandomShockRealization(const ConstTwoDMatrix &v, unsigned int iseed) : mtwister(iseed), factor(v.nrows(), v.nrows()) { schurFactor(v); @@ -1008,8 +1008,8 @@ public: return factor.nrows(); } protected: - void choleskyFactor(const TwoDMatrix &v); - void schurFactor(const TwoDMatrix &v); + void choleskyFactor(const ConstTwoDMatrix &v); + void schurFactor(const ConstTwoDMatrix &v); }; /* This is just a matrix of finite numbers. It can be constructed from @@ -1019,10 +1019,6 @@ class ExplicitShockRealization : virtual public ShockRealization { TwoDMatrix shocks; public: - ExplicitShockRealization(const TwoDMatrix &sh) - : shocks(sh) - { - } ExplicitShockRealization(const ConstTwoDMatrix &sh) : shocks(sh) { @@ -1063,7 +1059,7 @@ public: class GenShockRealization : public RandomShockRealization, public ExplicitShockRealization { public: - GenShockRealization(const TwoDMatrix &v, const TwoDMatrix &sh, int seed) + GenShockRealization(const ConstTwoDMatrix &v, const ConstTwoDMatrix &sh, int seed) : RandomShockRealization(v, seed), ExplicitShockRealization(sh) { KORD_RAISE_IF(sh.nrows() != v.nrows() || v.nrows() != v.ncols(), diff --git a/dynare++/tl/cc/twod_matrix.cc b/dynare++/tl/cc/twod_matrix.cc index a88896ff5..c71393f44 100644 --- a/dynare++/tl/cc/twod_matrix.cc +++ b/dynare++/tl/cc/twod_matrix.cc @@ -54,6 +54,13 @@ ConstTwoDMatrix::writeMat(mat_t *fd, const char *vname) const delete[] data; } +TwoDMatrix & +TwoDMatrix::operator=(const ConstTwoDMatrix &m) +{ + GeneralMatrix::operator=(m); + return *this; +} + void TwoDMatrix::copyRow(int from, int to) { diff --git a/matlab/modules/dseries b/matlab/modules/dseries index c51cfe6d2..f19b09310 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit c51cfe6d2c6ecefcef63c1fe880062d9dcd959af +Subproject commit f19b093104ad25d76e1d089afabf4b4de1563478