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
Wenddy SHu
dynare
Commits
d8dbc68e
Commit
d8dbc68e
authored
Dec 17, 2010
by
Ferhat Mihoubi
Browse files
- The function getPowerDeriv must end with an "end" instruction
parent
77c3d668
Changes
3
Hide whitespace changes
Inline
Side-by-side
preprocessor/DataTree.cc
View file @
d8dbc68e
...
...
@@ -651,13 +651,15 @@ DataTree::writePowerDeriv(ostream &output, bool use_dll) const
<<
"% The k-th derivative of x^p"
<<
endl
<<
"%"
<<
endl
<<
"function dxp=getPowerDeriv(x,p,k)"
<<
endl
<<
"if (abs(x) < "
<<
NEAR_ZERO
<<
") && (p > 0) && (k >= p) && (abs(p - round(p)) < "
<<
NEAR_ZERO
<<
")"
<<
endl
<<
" dxp = 0;"
<<
endl
<<
"else"
<<
endl
<<
" dxp = x^(p-k);"
<<
endl
<<
" for i=0:k-1"
<<
endl
<<
" dxp = dxp*p;"
<<
endl
<<
" p = p-1;"
<<
endl
<<
" if (abs(x) < "
<<
NEAR_ZERO
<<
") && (p > 0) && (k >= p) && (abs(p - round(p)) < "
<<
NEAR_ZERO
<<
")"
<<
endl
<<
" dxp = 0;"
<<
endl
<<
" else"
<<
endl
<<
" dxp = x^(p-k);"
<<
endl
<<
" for i=0:k-1"
<<
endl
<<
" dxp = dxp*p;"
<<
endl
<<
" p = p-1;"
<<
endl
<<
" end"
<<
endl
<<
" end"
<<
endl
<<
"end"
<<
endl
;
}
preprocessor/DynamicModel.cc
View file @
d8dbc68e
...
...
@@ -795,6 +795,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
default:
break
;
}
output
<<
"end"
<<
endl
;
writePowerDeriv
(
output
,
false
);
output
.
close
();
}
...
...
@@ -2033,7 +2034,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
open_par
=
false
;
mDynamicModelFile
<<
" oo_.endo_simul = y';
\n
"
;
mDynamicModelFile
<<
"return;
\n
"
;
mDynamicModelFile
<<
"end"
<<
endl
;
writePowerDeriv
(
mDynamicModelFile
,
false
);
mDynamicModelFile
.
close
();
...
...
preprocessor/StaticModel.cc
View file @
d8dbc68e
...
...
@@ -407,6 +407,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
default:
break
;
}
output
<<
"end"
<<
endl
;
writePowerDeriv
(
output
,
false
);
output
.
close
();
}
...
...
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