Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
preprocessor
Commits
c47b6e6e
Commit
c47b6e6e
authored
Oct 05, 2018
by
Sébastien Villemot
Browse files
Fix bug with notmpterms option
Commit
c6cb9aa1
was not the right fix.
parent
9043efab
Pipeline
#198
passed with stage
in 1 minute and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/ModelTree.cc
View file @
c47b6e6e
...
@@ -1256,36 +1256,34 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
...
@@ -1256,36 +1256,34 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
reference_count
[
v
]
=
{
ExprNode
::
min_cost
(
is_matlab
)
+
1
,
NodeTreeReference
::
residuals
};
reference_count
[
v
]
=
{
ExprNode
::
min_cost
(
is_matlab
)
+
1
,
NodeTreeReference
::
residuals
};
}
}
/* When option notmpterms is set, we only need to process model local
variables (and turn them into temporary terms); no need to go further */
if
(
no_tmp_terms
)
return
;
map
<
NodeTreeReference
,
temporary_terms_t
>
temp_terms_map
;
map
<
NodeTreeReference
,
temporary_terms_t
>
temp_terms_map
;
temp_terms_map
[
NodeTreeReference
::
residuals
]
=
temporary_terms_res
;
temp_terms_map
[
NodeTreeReference
::
residuals
]
=
temporary_terms_res
;
temp_terms_map
[
NodeTreeReference
::
firstDeriv
]
=
temporary_terms_g1
;
temp_terms_map
[
NodeTreeReference
::
firstDeriv
]
=
temporary_terms_g1
;
temp_terms_map
[
NodeTreeReference
::
secondDeriv
]
=
temporary_terms_g2
;
temp_terms_map
[
NodeTreeReference
::
secondDeriv
]
=
temporary_terms_g2
;
temp_terms_map
[
NodeTreeReference
::
thirdDeriv
]
=
temporary_terms_g3
;
temp_terms_map
[
NodeTreeReference
::
thirdDeriv
]
=
temporary_terms_g3
;
for
(
auto
&
equation
:
equations
)
if
(
!
no_tmp_terms
)
equation
->
computeTemporaryTerms
(
reference_count
,
{
temp_terms_map
,
for
(
auto
&
equation
:
equations
)
is_matlab
,
NodeTreeReference
::
residuals
);
equation
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
first_derivative
:
first_derivatives
)
is_matlab
,
NodeTreeReference
::
residuals
);
first_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
first_derivative
:
first_derivatives
)
is_matlab
,
NodeTreeReference
::
firstDeriv
);
first_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
second_derivative
:
second_derivatives
)
is_matlab
,
NodeTreeReference
::
firstDeriv
);
second_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
second_derivative
:
second_derivatives
)
is_matlab
,
NodeTreeReference
::
secondDeriv
);
second_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
third_derivative
:
third_derivatives
)
is_matlab
,
NodeTreeReference
::
secondDeriv
);
third_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
for
(
auto
&
third_derivative
:
third_derivatives
)
is_matlab
,
NodeTreeReference
::
thirdDeriv
);
third_derivative
.
second
->
computeTemporaryTerms
(
reference_count
,
temp_terms_map
,
is_matlab
,
NodeTreeReference
::
thirdDeriv
);
}
for
(
map
<
NodeTreeReference
,
temporary_terms_t
>::
const_iterator
it
=
temp_terms_map
.
begin
();
for
(
map
<
NodeTreeReference
,
temporary_terms_t
>::
const_iterator
it
=
temp_terms_map
.
begin
();
it
!=
temp_terms_map
.
end
();
it
++
)
it
!=
temp_terms_map
.
end
();
it
++
)
...
@@ -1301,8 +1299,8 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
...
@@ -1301,8 +1299,8 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
it
!=
temporary_terms_mlv
.
end
();
it
++
)
it
!=
temporary_terms_mlv
.
end
();
it
++
)
temporary_terms_idxs
[
it
->
first
]
=
idx
++
;
temporary_terms_idxs
[
it
->
first
]
=
idx
++
;
for
(
auto
t
emporary_terms_re
:
temporary_terms_res
)
for
(
auto
i
t
:
temporary_terms_res
)
temporary_terms_idxs
[
t
emporary_terms_re
]
=
idx
++
;
temporary_terms_idxs
[
i
t
]
=
idx
++
;
for
(
auto
it
:
temporary_terms_g1
)
for
(
auto
it
:
temporary_terms_g1
)
temporary_terms_idxs
[
it
]
=
idx
++
;
temporary_terms_idxs
[
it
]
=
idx
++
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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