Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
MichelJuillard
dynare
Commits
1f7f6c85
Commit
1f7f6c85
authored
May 30, 2016
by
Houtan Bastani
Browse files
preprocessor: remove auxiliary equations from static model. change in response to #1201
parent
dfbad040
Changes
2
Hide whitespace changes
Inline
Side-by-side
preprocessor/DynamicModel.cc
View file @
1f7f6c85
...
...
@@ -3681,7 +3681,7 @@ DynamicModel::toStatic(StaticModel &static_model) const
// Convert equations
int
static_only_index
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
equations
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
equations
.
size
()
-
aux_equations
.
size
()
;
i
++
)
{
// Detect if equation is marked [dynamic]
bool
is_dynamic_only
=
false
;
...
...
@@ -3698,11 +3698,11 @@ DynamicModel::toStatic(StaticModel &static_model) const
// If yes, replace it by an equation marked [static]
if
(
is_dynamic_only
)
{
static_model
.
addEquation
(
static_only_equations
[
static_only_index
]
->
toStatic
(
static_model
),
static_only_equations_lineno
[
static_only_index
]);
static_model
.
addEquation
(
static_only_equations
[
static_only_index
]
->
substituteStaticAuxiliaryVariable
()
->
toStatic
(
static_model
),
static_only_equations_lineno
[
static_only_index
]);
static_only_index
++
;
}
else
static_model
.
addEquation
(
equations
[
i
]
->
toStatic
(
static_model
),
equations_lineno
[
i
]);
static_model
.
addEquation
(
equations
[
i
]
->
substituteStaticAuxiliaryVariable
()
->
toStatic
(
static_model
),
equations_lineno
[
i
]);
}
catch
(
DataTree
::
DivisionByZeroException
)
{
...
...
@@ -3710,11 +3710,6 @@ DynamicModel::toStatic(StaticModel &static_model) const
exit
(
EXIT_FAILURE
);
}
}
// Convert auxiliary equations
for
(
deque
<
BinaryOpNode
*>::
const_iterator
it
=
aux_equations
.
begin
();
it
!=
aux_equations
.
end
();
it
++
)
static_model
.
addAuxEquation
((
*
it
)
->
toStatic
(
static_model
));
}
bool
...
...
preprocessor/StaticModel.cc
View file @
1f7f6c85
...
...
@@ -1050,22 +1050,6 @@ void
StaticModel
::
computingPass
(
const
eval_context_t
&
eval_context
,
bool
no_tmp_terms
,
bool
hessian
,
bool
thirdDerivatives
,
int
paramsDerivsOrder
,
bool
block
,
bool
bytecode
)
{
initializeVariablesAndEquations
();
vector
<
BinaryOpNode
*>
neweqs
;
for
(
unsigned
int
eq
=
0
;
eq
<
equations
.
size
()
-
aux_equations
.
size
();
eq
++
)
{
expr_t
eq_tmp
=
equations
[
eq
]
->
substituteStaticAuxiliaryVariable
();
neweqs
.
push_back
(
dynamic_cast
<
BinaryOpNode
*>
(
eq_tmp
->
toStatic
(
*
this
)));
}
for
(
unsigned
int
eq
=
0
;
eq
<
aux_equations
.
size
();
eq
++
)
{
expr_t
eq_tmp
=
aux_equations
[
eq
]
->
substituteStaticAuxiliaryDefinition
();
neweqs
.
push_back
(
dynamic_cast
<
BinaryOpNode
*>
(
eq_tmp
->
toStatic
(
*
this
)));
}
equations
.
clear
();
copy
(
neweqs
.
begin
(),
neweqs
.
end
(),
back_inserter
(
equations
));
// Compute derivatives w.r. to all endogenous, and possibly exogenous and exogenous deterministic
set
<
int
>
vars
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment