Estimation DLL: optimization of DecisionRules
parent
9e9eeb533b
commit
0ef2f8c4bd
|
@ -80,6 +80,14 @@ DecisionRules::DecisionRules(size_t n_arg, size_t p_arg,
|
|||
pi_fwrd.push_back(i);
|
||||
else
|
||||
beta_fwrd.push_back(i);
|
||||
|
||||
// Construct the fixed part of D and E
|
||||
D.setAll(0.0);
|
||||
for (size_t i = 0; i < n_mixed; i++)
|
||||
D(n - n_static + i, beta_back[i]) = 1.0;
|
||||
E.setAll(0.0);
|
||||
for (size_t i = 0; i < n_mixed; i++)
|
||||
E(n - n_static + i, n_back_mixed + beta_fwrd[i]) = 1.0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -102,21 +110,13 @@ DecisionRules::compute(const Matrix &jacobian, Matrix &g_y, Matrix &g_u) throw (
|
|||
mat::col_copy(A, n_back_mixed + zeta_back_mixed[j], n_static, n - n_static,
|
||||
D, j, 0);
|
||||
MatrixView(D, 0, n_back_mixed, n - n_static, n_fwrd_mixed) = MatrixView(A, n_static, n_back_mixed + n, n - n_static, n_fwrd_mixed);
|
||||
MatrixView(D, n - n_static, 0, n_mixed, n_fwrd + n_back + 2*n_mixed).setAll(0.0);
|
||||
for (size_t i = 0; i < n_mixed; i++)
|
||||
D(n - n_static + i, beta_back[i]) = 1.0;
|
||||
|
||||
// Construct matrix E
|
||||
MatrixView(E, 0, 0, n - n_static, n_back_mixed) = MatrixView(A, n_static, 0, n - n_static, n_back_mixed);
|
||||
for (size_t j = 0; j < n_fwrd; j++)
|
||||
mat::col_copy(A, n_back_mixed + zeta_fwrd_mixed[pi_fwrd[j]], n_static, n - n_static,
|
||||
E, n_back_mixed + pi_fwrd[j], 0);
|
||||
for (size_t j = 0; j < n_mixed; j++)
|
||||
MatrixView(E, 0, n_back_mixed + beta_fwrd[j], n - n_static, 1).setAll(0.0);
|
||||
mat::negate(MatrixView(E, 0, 0, n - n_static, n_fwrd + n_back + 2*n_mixed));
|
||||
MatrixView(E, n - n_static, 0, n_mixed, n_fwrd + n_back + 2*n_mixed).setAll(0.0);
|
||||
for (size_t i = 0; i < n_mixed; i++)
|
||||
E(n - n_static + i, n_back_mixed + beta_fwrd[i]) = 1.0;
|
||||
mat::negate(MatrixView(E, 0, 0, n - n_static, n_fwrd + n_back + 2*n_mixed)); // Here we take the opposite of some of the zeros initialized in the constructor, but it is not a problem
|
||||
|
||||
// Perform the generalized Schur
|
||||
size_t sdim;
|
||||
|
|
Loading…
Reference in New Issue