From fefccd4a1b8e05ef6a1607e6cdd9cf373530b431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 22 Jan 2019 18:21:19 +0100 Subject: [PATCH] Reverts changes mistakenly added to commit f4849421545ae5b9360bf62c876395f9e8b3a0c5. --- 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 ------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/dynare++/extern/matlab/dynare_simul.cc b/dynare++/extern/matlab/dynare_simul.cc index 0bc2c70ff..e81b70982 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 - ConstTwoDMatrix shocks_mat(nexog, nper, ConstVector{shocks}); - ConstTwoDMatrix vcov_mat(nexog, nexog, ConstVector{vcov}); + TwoDMatrix shocks_mat(nexog, nper, ConstVector{shocks}); + TwoDMatrix 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 a26667331..e1998d0d7 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 ConstTwoDMatrix &v) +RandomShockRealization::choleskyFactor(const TwoDMatrix &v) { factor = v; lapack_int rows = factor.nrows(); @@ -578,7 +578,7 @@ RandomShockRealization::choleskyFactor(const ConstTwoDMatrix &v) decomposition. It works for semidifinite matrices. */ void -RandomShockRealization::schurFactor(const ConstTwoDMatrix &v) +RandomShockRealization::schurFactor(const TwoDMatrix &v) { SymSchurDecomp ssd(v); ssd.getFactor(factor); diff --git a/dynare++/kord/decision_rule.hh b/dynare++/kord/decision_rule.hh index 72f0081b0..5b9fa80da 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 ConstTwoDMatrix &v, unsigned int iseed) + RandomShockRealization(const TwoDMatrix &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 ConstTwoDMatrix &v); - void schurFactor(const ConstTwoDMatrix &v); + void choleskyFactor(const TwoDMatrix &v); + void schurFactor(const TwoDMatrix &v); }; /* This is just a matrix of finite numbers. It can be constructed from @@ -1019,6 +1019,10 @@ class ExplicitShockRealization : virtual public ShockRealization { TwoDMatrix shocks; public: + ExplicitShockRealization(const TwoDMatrix &sh) + : shocks(sh) + { + } ExplicitShockRealization(const ConstTwoDMatrix &sh) : shocks(sh) { @@ -1059,7 +1063,7 @@ public: class GenShockRealization : public RandomShockRealization, public ExplicitShockRealization { public: - GenShockRealization(const ConstTwoDMatrix &v, const ConstTwoDMatrix &sh, int seed) + GenShockRealization(const TwoDMatrix &v, const TwoDMatrix &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 c71393f44..a88896ff5 100644 --- a/dynare++/tl/cc/twod_matrix.cc +++ b/dynare++/tl/cc/twod_matrix.cc @@ -54,13 +54,6 @@ 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) {