Merge branch 'master' into ecb-master
commit
a59a2fae2d
|
@ -39,7 +39,7 @@ dist-hook:
|
|||
rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
|
||||
rm -rf $(distdir)/matlab/preprocessor* $(distdir)/matlab/dynare_version.m
|
||||
$(MKDIR_P) $(distdir)/mex/matlab $(distdir)/mex/octave
|
||||
rm -rf `find $(distdir)/contrib -name '.git*'`
|
||||
rm -rf `find $(distdir) -name '.git*'`
|
||||
|
||||
install-exec-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/contrib/ms-sbvar/TZcode
|
||||
|
@ -48,6 +48,7 @@ install-exec-local:
|
|||
cp -r contrib/jsonlab $(DESTDIR)$(pkglibdir)/contrib/jsonlab
|
||||
cp -r examples $(DESTDIR)$(pkglibdir)
|
||||
cp -r matlab $(DESTDIR)$(pkglibdir)
|
||||
find $(DESTDIR)$(pkglibdir) -name LICENSE.md -delete
|
||||
rm -rf $(DESTDIR)$(pkglibdir)/matlab/preprocessor*
|
||||
{ \
|
||||
if [ -z "`file preprocessor/dynare_m | grep x86.64`" ]; then \
|
||||
|
|
14
README.md
14
README.md
|
@ -81,7 +81,7 @@ A number of tools and libraries are needed in order to recompile everything. You
|
|||
- [Beamer](http://latex-beamer.sourceforge.net/) (for some PDF presentations)
|
||||
- For building the reference manual:
|
||||
- [GNU Texinfo](http://www.gnu.org/software/texinfo/)
|
||||
- [Texi2HTML](http://www.nongnu.org/texi2html) and [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output
|
||||
- [Latex2HTML](http://www.latex2html.org), if you want nice mathematical formulas in HTML output
|
||||
- [Doxygen](http://www.stack.nl/%7Edimitri/doxygen/) (if you want to build Dynare preprocessor source documentation)
|
||||
- For Octave, the development libraries corresponding to the UMFPACK packaged with Octave
|
||||
|
||||
|
@ -219,9 +219,9 @@ Alternatively, if you want to build everything, manually install the following p
|
|||
|
||||
- `build-essential` (for gcc, g++ and make)
|
||||
- `gfortran`
|
||||
- `liboctave-dev` or `octave3.2-headers` (will install ATLAS)
|
||||
- `liboctave-dev` (or `octave3.2-headers` on older systems)
|
||||
- `libboost-graph-dev`
|
||||
- `libgsl0-dev`
|
||||
- `libgsl-dev` (or `libgsl0-dev` on older systems)
|
||||
- `libmatio-dev`
|
||||
- `libslicot-dev` and `libslicot-pic`
|
||||
- `libsuitesparse-dev`
|
||||
|
@ -235,9 +235,11 @@ Alternatively, if you want to build everything, manually install the following p
|
|||
- `texlive-formats-extra` (for Eplain)
|
||||
- `texlive-latex-extra` (for fullpage.sty)
|
||||
- `texlive-fonts-extra` (for ccicons)
|
||||
- `latex-beamer`
|
||||
- `texlive-latex-recommended` (or `latex-beamer` on older systems)
|
||||
- `texlive-science` (or `texlive-math-extra` on older systems) (for amstex)
|
||||
- `texinfo`
|
||||
- `texi2html`, `latex2html`
|
||||
- `lmodern` (for macroprocessor PDF)
|
||||
- `latex2html`
|
||||
- `doxygen`
|
||||
|
||||
## Fedora
|
||||
|
@ -253,7 +255,7 @@ Alternatively, if you want to build everything, manually install the following p
|
|||
- `automake`
|
||||
- `texlive`
|
||||
- `texinfo`
|
||||
- `texi2html`, `latex2html`
|
||||
- `latex2html`
|
||||
- `doxygen`
|
||||
|
||||
## Windows
|
||||
|
|
|
@ -117,9 +117,6 @@ AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$PDFLATEX" != "x"])
|
|||
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
|
||||
AM_CONDITIONAL([HAVE_BIBTEX], [test "x$BIBTEX" != "x"])
|
||||
|
||||
AC_CHECK_PROG([TEXI2HTML], [texi2html], [texi2html])
|
||||
AM_CONDITIONAL([HAVE_TEXI2HTML], [test "x$TEXI2HTML" != "x"])
|
||||
|
||||
AC_CHECK_PROG([LATEX2HTML], [latex2html], [latex2html])
|
||||
AM_CONDITIONAL([HAVE_LATEX2HTML], [test "x$LATEX2HTML" != "x"])
|
||||
|
||||
|
@ -282,10 +279,10 @@ fi
|
|||
|
||||
if test "x$MAKEINFO" != "x"; then
|
||||
BUILD_DYNARE_INFO="yes"
|
||||
if test "x$TEXI2HTML" != "x" -a "x$LATEX2HTML" != "x"; then
|
||||
if test "x$LATEX2HTML" != "x"; then
|
||||
BUILD_DYNARE_HTML_MANUAL="yes"
|
||||
else
|
||||
BUILD_DYNARE_HTML_MANUAL="yes (but with ugly math formulas, missing texi2html or latex2html)"
|
||||
BUILD_DYNARE_HTML_MANUAL="yes (but with ugly math formulas, missing latex2html)"
|
||||
fi
|
||||
BUILD_DYNARE_PDF_MANUAL="yes"
|
||||
else
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8b3d14040133ea5b622cde9ea79b3b0b41891bce
|
||||
Subproject commit 824a85ee962810157f815dcea04f516219814649
|
|
@ -2,15 +2,14 @@ SUBDIRS = preprocessor macroprocessor userguide parallel internals gsa dseries-a
|
|||
|
||||
info_TEXINFOS = dynare.texi
|
||||
|
||||
if HAVE_TEXI2HTML
|
||||
if HAVE_LATEX2HTML
|
||||
html-local: dynare.html
|
||||
|
||||
# The temporary directory for latex2html (L2H_TMP) must not contain a dot, so
|
||||
# enforce standard tmp directory instead of defaulting to current directory
|
||||
dynare.html: dynare.texi
|
||||
rm -rf dynare.html
|
||||
mkdir -p dynare.html
|
||||
cd dynare.html && $(TEXI2HTML) --l2h --split section --prefix index ../dynare.texi
|
||||
endif
|
||||
texi2any --html --split=section -c L2H=1 -c L2H_TMP=$${TMPDIR:-/tmp} -c PREFIX=dynare.html dynare.texi
|
||||
endif
|
||||
|
||||
PDF_TARGETS =
|
||||
|
|
|
@ -852,16 +852,16 @@ Suppresses all warnings.
|
|||
@item json=parse|transform|compute
|
||||
Causes the preprocessor to output a version of the @file{.mod} file in JSON
|
||||
format. If @code{parse} is passed, the output will be written after the parsing
|
||||
of the @file{.mod} file to a file called @file{@var{FILENAME}.mod}. If
|
||||
of the @file{.mod} file to a file called @file{@var{FILENAME}.json}. If
|
||||
@code{transform} is passed, the JSON output of the transformed model (maximum
|
||||
lead of 1, minimum lag of -1, expectation operators substituted, etc.) will be
|
||||
written to a file called @file{@var{FILENAME}.mod} and the original,
|
||||
untransformed model will be written in @file{@var{FILENAME}_original.mod}. And
|
||||
written to a file called @file{@var{FILENAME}.json} and the original,
|
||||
untransformed model will be written in @file{@var{FILENAME}_original.json}. And
|
||||
if @code{compute} is passed, the output is written after the computing pass. In
|
||||
this case, the transformed model is written to @file{@var{FILENAME}.mod}, the
|
||||
original model is written to @file{@var{FILENAME}_original.mod}, and the
|
||||
dynamic and static files are written to @file{@var{FILENAME}_dynamic.mod} and
|
||||
@file{@var{FILENAME}_static.mod}.
|
||||
this case, the transformed model is written to @file{@var{FILENAME}.json}, the
|
||||
original model is written to @file{@var{FILENAME}_original.json}, and the
|
||||
dynamic and static files are written to @file{@var{FILENAME}_dynamic.json} and
|
||||
@file{@var{FILENAME}_static.json}.
|
||||
|
||||
@item jsonstdout
|
||||
Instead of writing output requested by @ref{json} to files, write to standard
|
||||
|
@ -870,13 +870,10 @@ out.
|
|||
@item onlyjson
|
||||
Quit processing once the output requested by @ref{json} has been written.
|
||||
|
||||
@item jsonprintderivdetail
|
||||
In addition to the output provided when @code{compute} is passed to @ref{json},
|
||||
create two files, @file{@var{FILENAME}_dynamic_details.mod} and
|
||||
@file{@var{FILENAME}_static_details.mod}. The difference between these files
|
||||
and their @file{_dynamic.mod} and @file{_static.mod} counterparts is that these
|
||||
files provide information about which variable(s) and equation the derivative
|
||||
corresponds to.
|
||||
@item jsonderivsimple
|
||||
Print a simplified version of the static and dynamic files in
|
||||
@file{@var{FILENAME}_static_simple.json} and
|
||||
@file{@var{FILENAME}_dynamic_simple.json}.
|
||||
|
||||
@item warn_uninit
|
||||
Display a warning for each variable or parameter which is not
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
\usetheme{Boadilla}
|
||||
|
||||
\title{The Dynare Macro-processor}
|
||||
\subtitle{Dynare Summer School 2015}
|
||||
\subtitle{Dynare Summer School 2017}
|
||||
\author{Sébastien Villemot}
|
||||
%\pgfdeclareimage[height=0.6cm]{logo}{logo-ofce}
|
||||
%\institute[OFCE]{\pgfuseimage{logo}}
|
||||
\institute{OFCE}
|
||||
\date{June 9, 2015}
|
||||
\date{June 13, 2017}
|
||||
|
||||
\AtBeginSection[]
|
||||
{
|
||||
|
@ -91,30 +90,6 @@
|
|||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile=singleslide]
|
||||
\frametitle{Inclusion directive}
|
||||
\begin{itemize}
|
||||
\item This directive simply includes the content of another file at the place where it is inserted.
|
||||
\begin{block}{Syntax}
|
||||
\verb+@#include "+\textit{filename}\verb+"+
|
||||
\end{block}
|
||||
\begin{block}{Example}
|
||||
\begin{verbatim}
|
||||
@#include "modelcomponent.mod"
|
||||
\end{verbatim}
|
||||
\end{block}
|
||||
\item Exactly equivalent to a copy/paste of the content of the included file
|
||||
\item Note that it is possible to nest includes (\textit{i.e.} to include a file from an included file)
|
||||
\item Since Dynare 4.5, the filename can be given by a macro-variable (see below).
|
||||
Useful in loops.
|
||||
\begin{block}{Example with variable}
|
||||
\begin{verbatim}
|
||||
@#define fname = "modelcomponent.mod"
|
||||
@#include fname
|
||||
\end{verbatim}
|
||||
\end{block}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}
|
||||
\frametitle{Variables}
|
||||
|
@ -219,6 +194,41 @@ end;
|
|||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile=singleslide]
|
||||
\frametitle{Inclusion directive (1/2)}
|
||||
\begin{itemize}
|
||||
\item This directive simply includes the content of another file at the place where it is inserted.
|
||||
\begin{block}{Syntax}
|
||||
\verb+@#include "+\textit{filename}\verb+"+
|
||||
\end{block}
|
||||
\begin{block}{Example}
|
||||
\begin{verbatim}
|
||||
@#include "modelcomponent.mod"
|
||||
\end{verbatim}
|
||||
\end{block}
|
||||
\item Exactly equivalent to a copy/paste of the content of the included file
|
||||
\item Note that it is possible to nest includes (\textit{i.e.} to include a
|
||||
file from an included file)
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile=singleslide]
|
||||
\frametitle{Inclusion directive (2/2)}
|
||||
\begin{itemize}
|
||||
\item The filename can be given by a macro-variable (useful in loops):
|
||||
\begin{block}{Example with variable}
|
||||
\begin{verbatim}
|
||||
@#define fname = "modelcomponent.mod"
|
||||
@#include fname
|
||||
\end{verbatim}
|
||||
\end{block}
|
||||
\item Files to include are searched for in current directory. Other directories can
|
||||
be added with
|
||||
\texttt{@includepath} directive, \texttt{-I} command line option or
|
||||
\texttt{[paths]} section in config file.
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile=singleslide]
|
||||
\frametitle{Loop directive}
|
||||
\begin{block}{Syntax}
|
||||
|
@ -604,7 +614,7 @@ rhos = [ 0.8, 0.9, 1];
|
|||
\ccbysa
|
||||
\column{0.71\textwidth}
|
||||
\tiny
|
||||
Copyright © 2008--2015 Dynare Team \\
|
||||
Copyright © 2008--2017 Dynare Team \\
|
||||
Licence: \href{http://creativecommons.org/licenses/by-sa/4.0/}{Creative
|
||||
Commons Attribution-ShareAlike 4.0}
|
||||
\end{columns}
|
||||
|
|
|
@ -159,9 +159,9 @@ KOrder::KOrder(int num_stat, int num_pred, int num_both, int num_forw,
|
|||
KORD_RAISE_IF(gy.nrows() != ypart.ny(),
|
||||
"Wrong number of rows in gy in KOrder constructor");
|
||||
KORD_RAISE_IF(gu.nrows() != ypart.ny(),
|
||||
"Wrong number of rows in gu in KOrder constuctor");
|
||||
"Wrong number of rows in gu in KOrder constructor");
|
||||
KORD_RAISE_IF(gu.ncols() != nu,
|
||||
"Wrong number of columns in gu in KOrder constuctor");
|
||||
"Wrong number of columns in gu in KOrder constructor");
|
||||
|
||||
// set nvs:
|
||||
nvs[0] = ypart.nys(); nvs[1] = nu; nvs[2] = nu; nvs[3] = 1;
|
||||
|
|
|
@ -64,7 +64,7 @@ public:@;
|
|||
@<|IntegDerivs| constructor code@>;
|
||||
};
|
||||
|
||||
@ This constuctor integrates a rule (namely its $g^{**}$ part) with
|
||||
@ This constructor integrates a rule (namely its $g^{**}$ part) with
|
||||
respect to $u=\tilde\sigma\eta$, and stores to the object the
|
||||
derivatives of this integral $h$ at $(y^*,u,\sigma)=(\tilde
|
||||
y^*,0,\tilde\sigma)$. The original container of $g^{**}$, the moments of
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit eb996550e0aafe5c43a0eb96a017680d77d1b5ee
|
||||
Subproject commit dfa40f0b7506cfdee02c69c33eeb26180a22e76f
|
|
@ -6708,7 +6708,7 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
|
|||
{
|
||||
if (restart > 2)
|
||||
{
|
||||
mexPrintf("Divergence or slowdown occured during simulation.\nIn the next iteration, pivoting method will be applied to all periods.\n");
|
||||
mexPrintf("Divergence or slowdown occurred during simulation.\nIn the next iteration, pivoting method will be applied to all periods.\n");
|
||||
symbolic = false;
|
||||
alt_symbolic = true;
|
||||
markowitz_c_s = markowitz_c;
|
||||
|
@ -6716,7 +6716,7 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
|
|||
}
|
||||
else
|
||||
{
|
||||
mexPrintf("Divergence or slowdown occured during simulation.\nIn the next iteration, pivoting method will be applied for a longer period.\n");
|
||||
mexPrintf("Divergence or slowdown occurred during simulation.\nIn the next iteration, pivoting method will be applied for a longer period.\n");
|
||||
start_compare = min(tbreak_g, periods);
|
||||
restart++;
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ main(int nrhs, const char *prhs[])
|
|||
for (vector<s_plan>::iterator it = splan.begin(); it != splan.end(); it++)
|
||||
{
|
||||
mexPrintf("----------------------------------------------------------------------------------------------------\n");
|
||||
mexPrintf("suprise #%d\n", i+1);
|
||||
mexPrintf("surprise #%d\n", i+1);
|
||||
if (it->exo.length())
|
||||
mexPrintf(" plan fliping var=%s (%d) exo=%s (%d) for the following periods and with the following values:\n", it->var.c_str(), it->var_num, it->exo.c_str(), it->exo_num);
|
||||
else
|
||||
|
|
|
@ -510,7 +510,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Type missmatch for equation " << equation_ID+1 << "\n";
|
||||
cerr << "Type mismatch for equation " << equation_ID+1 << "\n";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
output << ";\n";
|
||||
|
@ -5647,6 +5647,76 @@ DynamicModel::writeJsonOriginalModelOutput(ostream &output) const
|
|||
writeJsonModelEquations(output, false);
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::writeJsonDynamicModelInfo(ostream &output) const
|
||||
{
|
||||
output << "\"model_info\": {"
|
||||
<< "\"lead_lag_incidence\": [";
|
||||
// Loop on endogenous variables
|
||||
int nstatic = 0,
|
||||
nfwrd = 0,
|
||||
npred = 0,
|
||||
nboth = 0;
|
||||
for (int endoID = 0; endoID < symbol_table.endo_nbr(); endoID++)
|
||||
{
|
||||
if (endoID != 0)
|
||||
output << ",";
|
||||
output << "[";
|
||||
int sstatic = 1,
|
||||
sfwrd = 0,
|
||||
spred = 0,
|
||||
sboth = 0;
|
||||
// Loop on periods
|
||||
for (int lag = -max_endo_lag; lag <= max_endo_lead; lag++)
|
||||
{
|
||||
// Print variableID if exists with current period, otherwise print 0
|
||||
try
|
||||
{
|
||||
if (lag != -max_endo_lag)
|
||||
output << ",";
|
||||
int varID = getDerivID(symbol_table.getID(eEndogenous, endoID), lag);
|
||||
output << " " << getDynJacobianCol(varID) + 1;
|
||||
if (lag == -1)
|
||||
{
|
||||
sstatic = 0;
|
||||
spred = 1;
|
||||
}
|
||||
else if (lag == 1)
|
||||
{
|
||||
if (spred == 1)
|
||||
{
|
||||
sboth = 1;
|
||||
spred = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sstatic = 0;
|
||||
sfwrd = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (UnknownDerivIDException &e)
|
||||
{
|
||||
output << " 0";
|
||||
}
|
||||
}
|
||||
nstatic += sstatic;
|
||||
nfwrd += sfwrd;
|
||||
npred += spred;
|
||||
nboth += sboth;
|
||||
output << "]";
|
||||
}
|
||||
output << "], "
|
||||
<< "\"nstatic\": " << nstatic << ", "
|
||||
<< "\"nfwrd\": " << nfwrd << ", "
|
||||
<< "\"npred\": " << npred << ", "
|
||||
<< "\"nboth\": " << nboth << ", "
|
||||
<< "\"nsfwrd\": " << nfwrd+nboth << ", "
|
||||
<< "\"nspred\": " << npred+nboth << ", "
|
||||
<< "\"ndynamic\": " << npred+nboth+nfwrd << endl;
|
||||
output << "}";
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) const
|
||||
{
|
||||
|
@ -5691,13 +5761,17 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
expr_t d1 = it->second;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"lag\": " << getLagByDerivID(var);
|
||||
jacobian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
jacobian_output << "{\"row\": " << eq + 1;
|
||||
jacobian_output << ", \"col\": " << col + 1
|
||||
<< ", \"val\": \"";
|
||||
|
||||
jacobian_output << ", \"col\": " << col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"shift\": " << getLagByDerivID(var);
|
||||
|
||||
jacobian_output << ", \"val\": \"";
|
||||
d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
|
||||
jacobian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5728,19 +5802,22 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
int col_nb_sym = id2 * dynJacobianColsNbr + id1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"lag1\": " << getLagByDerivID(var1)
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"lag2\": " << getLagByDerivID(var2);
|
||||
hessian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian_output << "{\"row\": " << eq + 1;
|
||||
|
||||
hessian_output << ", \"col\": [" << col_nb + 1;
|
||||
if (id1 != id2)
|
||||
hessian_output << ", " << col_nb_sym + 1;
|
||||
hessian_output << "]"
|
||||
<< ", \"val\": \"";
|
||||
hessian_output << "]";
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"shift1\": " << getLagByDerivID(var1)
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"shift2\": " << getLagByDerivID(var2);
|
||||
|
||||
hessian_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(hessian_output, temp_term_union, tef_terms);
|
||||
hessian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5768,13 +5845,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
expr_t d3 = it->second;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivatives_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"lag1\": " << getLagByDerivID(var1)
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"lag2\": " << getLagByDerivID(var2)
|
||||
<< ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\""
|
||||
<< ", \"lag3\": " << getLagByDerivID(var3);
|
||||
third_derivatives_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivatives_output << "{\"row\": " << eq + 1;
|
||||
|
||||
|
@ -5796,17 +5867,26 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
|
|||
third_derivatives_output << ", ";
|
||||
third_derivatives_output << *it2 + 1;
|
||||
}
|
||||
third_derivatives_output << "]"
|
||||
<< ", \"val\": \"";
|
||||
third_derivatives_output << "]";
|
||||
|
||||
if (writeDetails)
|
||||
third_derivatives_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"shift1\": " << getLagByDerivID(var1)
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"shift2\": " << getLagByDerivID(var2)
|
||||
<< ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\""
|
||||
<< ", \"shift3\": " << getLagByDerivID(var3);
|
||||
|
||||
third_derivatives_output << ", \"val\": \"";
|
||||
d3->writeJsonOutput(third_derivatives_output, temp_term_union, tef_terms);
|
||||
third_derivatives_output << "\"}" << endl;
|
||||
}
|
||||
third_derivatives_output << "]}";
|
||||
|
||||
if (writeDetails)
|
||||
output << "\"dynamic_model_derivative_details\": {";
|
||||
output << "\"dynamic_model\": {";
|
||||
else
|
||||
output << "\"dynamic_model_derivatives\": {";
|
||||
output << "\"dynamic_model_simple\": {";
|
||||
output << model_local_vars_output.str()
|
||||
<< ", " << model_output.str()
|
||||
<< ", " << jacobian_output.str()
|
||||
|
@ -5856,12 +5936,16 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
jacobian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
jacobian_output << "{\"row\": " << eq + 1;
|
||||
jacobian_output << ", \"param_col\": " << param_col + 1
|
||||
<< ", \"val\": \"";
|
||||
|
||||
jacobian_output << ", \"param_col\": " << param_col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
|
||||
jacobian_output << ", \"val\": \"";
|
||||
d1->writeJsonOutput(jacobian_output, params_derivs_temporary_terms, tef_terms);
|
||||
jacobian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5886,15 +5970,19 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"lag\": " << getLagByDerivID(var)
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
hessian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian_output << "{\"row\": " << eq + 1;
|
||||
|
||||
hessian_output << ", \"var_col\": " << var_col + 1
|
||||
<< ", \"param_col\": " << param_col + 1
|
||||
<< ", \"val\": \"";
|
||||
<< ", \"param_col\": " << param_col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"lag\": " << getLagByDerivID(var)
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
|
||||
hessian_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(hessian_output, params_derivs_temporary_terms, tef_terms);
|
||||
hessian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5920,14 +6008,17 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian1_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
hessian1_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian1_output << "{\"row\": " << eq + 1;
|
||||
hessian1_output << ", \"param1_col\": " << param1_col + 1
|
||||
<< ", \"param2_col\": " << param2_col + 1
|
||||
<< ", \"val\": \"";
|
||||
<< ", \"param2_col\": " << param2_col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian1_output << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
|
||||
hessian1_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(hessian1_output, params_derivs_temporary_terms, tef_terms);
|
||||
hessian1_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5955,17 +6046,21 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(var) << "\""
|
||||
third_derivs_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivs_output << "{\"row\": " << eq + 1;
|
||||
|
||||
third_derivs_output << ", \"var_col\": " << var_col + 1
|
||||
<< ", \"param1_col\": " << param1_col + 1
|
||||
<< ", \"param2_col\": " << param2_col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs_output << ", \"var\": \"" << symbol_table.getName(var) << "\""
|
||||
<< ", \"lag\": " << getLagByDerivID(var)
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
else
|
||||
third_derivs_output << "{\"row\": " << eq + 1;
|
||||
third_derivs_output << ", \"var_col\": " << var_col + 1
|
||||
<< ", \"param1_col\": " << param1_col + 1
|
||||
<< ", \"param2_col\": " << param2_col + 1
|
||||
<< ", \"val\": \"";
|
||||
|
||||
third_derivs_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(third_derivs_output, params_derivs_temporary_terms, tef_terms);
|
||||
third_derivs_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -5994,27 +6089,31 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs1_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
third_derivs1_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivs1_output << "{\"row\": " << eq + 1;
|
||||
|
||||
third_derivs1_output << ", \"var1_col\": " << var1_col + 1
|
||||
<< ", \"var2_col\": " << var2_col + 1
|
||||
<< ", \"param_col\": " << param_col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs1_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"lag1\": " << getLagByDerivID(var1)
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"lag2\": " << getLagByDerivID(var2)
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
else
|
||||
third_derivs1_output << "{\"row\": " << eq + 1;
|
||||
third_derivs1_output << ", \"var1_col\": " << var1_col + 1
|
||||
<< ", \"var2_col\": " << var2_col + 1
|
||||
<< ", \"param_col\": " << param_col + 1
|
||||
<< ", \"val\": \"";
|
||||
|
||||
third_derivs1_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(third_derivs1_output, params_derivs_temporary_terms, tef_terms);
|
||||
third_derivs1_output << "\"}" << endl;
|
||||
}
|
||||
third_derivs1_output << "]}" << endl;
|
||||
|
||||
if (writeDetails)
|
||||
output << "\"dynamic_model_params_derivative_details\": {";
|
||||
output << "\"dynamic_model_params_derivative\": {";
|
||||
else
|
||||
output << "\"dynamic_model_params_derivatives\": {";
|
||||
output << "\"dynamic_model_params_derivatives_simple\": {";
|
||||
output << model_local_vars_output.str()
|
||||
<< ", " << model_output.str()
|
||||
<< ", " << jacobian_output.str()
|
||||
|
|
|
@ -247,6 +247,9 @@ public:
|
|||
//! Write JSON Output representation of original dynamic model
|
||||
void writeJsonOriginalModelOutput(ostream &output) const;
|
||||
|
||||
//! Write JSON Output representation of model info (useful stuff from M_)
|
||||
void writeJsonDynamicModelInfo(ostream &output) const;
|
||||
|
||||
//! Write JSON Output representation of dynamic model after computing pass
|
||||
void writeJsonComputingPassOutput(ostream &output, bool writeDetails) const;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool
|
|||
#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
||||
, bool cygwin, bool msvc, bool mingw
|
||||
#endif
|
||||
, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonprintderivdetail
|
||||
, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple
|
||||
);
|
||||
|
||||
void main1(char *modfile, string &basename, bool debug, bool save_macro, string &save_macro_file,
|
||||
|
@ -62,7 +62,7 @@ usage()
|
|||
#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
||||
<< " [cygwin] [msvc] [mingw]"
|
||||
#endif
|
||||
<< "[json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonprintderivdetail]"
|
||||
<< "[json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple]"
|
||||
<< endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ main(int argc, char **argv)
|
|||
JsonOutputPointType json = nojson;
|
||||
JsonFileOutputType json_output_mode = file;
|
||||
bool onlyjson = false;
|
||||
bool jsonprintderivdetail = false;
|
||||
bool jsonderivsimple = false;
|
||||
LanguageOutputType language = matlab;
|
||||
|
||||
// Parse options
|
||||
|
@ -251,7 +251,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
if (strlen(argv[arg]) <= 7 || argv[arg][6] != '=')
|
||||
{
|
||||
cerr << "Incorrect syntax for ouput option" << endl;
|
||||
cerr << "Incorrect syntax for output option" << endl;
|
||||
usage();
|
||||
}
|
||||
if (strlen(argv[arg]) == 14 && !strncmp(argv[arg] + 7, "dynamic", 7))
|
||||
|
@ -264,7 +264,7 @@ main(int argc, char **argv)
|
|||
output_mode = third;
|
||||
else
|
||||
{
|
||||
cerr << "Incorrect syntax for ouput option" << endl;
|
||||
cerr << "Incorrect syntax for output option" << endl;
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
@ -301,8 +301,8 @@ main(int argc, char **argv)
|
|||
json_output_mode = standardout;
|
||||
else if (!strcmp(argv[arg], "onlyjson"))
|
||||
onlyjson = true;
|
||||
else if (!strcmp(argv[arg], "jsonprintderivdetail"))
|
||||
jsonprintderivdetail = true;
|
||||
else if (!strcmp(argv[arg], "jsonderivsimple"))
|
||||
jsonderivsimple = true;
|
||||
else if (strlen(argv[arg]) >= 4 && !strncmp(argv[arg], "json", 4))
|
||||
{
|
||||
if (strlen(argv[arg]) <= 5 || argv[arg][4] != '=')
|
||||
|
@ -370,7 +370,7 @@ main(int argc, char **argv)
|
|||
#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
||||
, cygwin, msvc, mingw
|
||||
#endif
|
||||
, json, json_output_mode, onlyjson, jsonprintderivdetail
|
||||
, json, json_output_mode, onlyjson, jsonderivsimple
|
||||
);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -34,7 +34,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
|
|||
#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
|
||||
, bool cygwin, bool msvc, bool mingw
|
||||
#endif
|
||||
, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonprintderivdetail
|
||||
, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple
|
||||
)
|
||||
{
|
||||
ParsingDriver p(warnings, nostrict);
|
||||
|
@ -60,7 +60,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
|
|||
// Do computations
|
||||
mod_file->computingPass(no_tmp_terms, output_mode, params_derivs_order);
|
||||
if (json == computingpass)
|
||||
mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, jsonprintderivdetail);
|
||||
mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, jsonderivsimple);
|
||||
|
||||
// Write outputs
|
||||
if (output_mode != none)
|
||||
|
|
|
@ -86,7 +86,7 @@ html-local:
|
|||
endif
|
||||
|
||||
clean-local:
|
||||
rm -rf ../matlab/preprocessor*
|
||||
rm -rf ../matlab/preprocessor* ../julia/preprocessor*
|
||||
rm -rf doc/html/
|
||||
|
||||
EXTRA_DIST = $(BUILT_SOURCES) Doxyfile
|
||||
|
|
|
@ -232,7 +232,7 @@ ModFile::checkPass(bool nostrict)
|
|||
|
||||
if (mod_file_struct.dsge_prior_weight_initialized && mod_file_struct.dsge_prior_weight_in_estimated_params)
|
||||
{
|
||||
cerr << "ERROR: dsge_prior_weight cannot be both initalized and estimated." << endl;
|
||||
cerr << "ERROR: dsge_prior_weight cannot be both initialized and estimated." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -1290,7 +1290,7 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
|
|||
}
|
||||
|
||||
void
|
||||
ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonprintderivdetail)
|
||||
ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple)
|
||||
{
|
||||
if (json == nojson)
|
||||
return;
|
||||
|
@ -1298,13 +1298,21 @@ ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonF
|
|||
if (json == parsing || json == checkpass)
|
||||
symbol_table.freeze();
|
||||
|
||||
writeJsonOutputParsingCheck(basename, json_output_mode, json == transformpass);
|
||||
if (json_output_mode == standardout)
|
||||
cout << "//-- BEGIN JSON --// " << endl
|
||||
<< "{" << endl;
|
||||
|
||||
writeJsonOutputParsingCheck(basename, json_output_mode, json == transformpass, json == computingpass);
|
||||
|
||||
if (json == parsing || json == checkpass)
|
||||
symbol_table.unfreeze();
|
||||
|
||||
if (json == computingpass)
|
||||
writeJsonComputingPassOutput(basename, json_output_mode, jsonprintderivdetail);
|
||||
writeJsonComputingPassOutput(basename, json_output_mode, jsonderivsimple);
|
||||
|
||||
if (json_output_mode == standardout)
|
||||
cout << "}" << endl
|
||||
<< "//-- END JSON --// " << endl;
|
||||
|
||||
switch (json)
|
||||
{
|
||||
|
@ -1330,7 +1338,7 @@ ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonF
|
|||
}
|
||||
|
||||
void
|
||||
ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType json_output_mode, bool transformpass) const
|
||||
ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType json_output_mode, bool transformpass, bool computingpass) const
|
||||
{
|
||||
ostringstream output;
|
||||
output << "{" << endl;
|
||||
|
@ -1351,11 +1359,17 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
|||
}
|
||||
output << "]" << endl;
|
||||
}
|
||||
|
||||
if (computingpass)
|
||||
{
|
||||
output << ",";
|
||||
dynamic_model.writeJsonDynamicModelInfo(output);
|
||||
}
|
||||
output << "}" << endl;
|
||||
|
||||
ostringstream original_model_output;
|
||||
original_model_output << "";
|
||||
if (transformpass)
|
||||
if (transformpass || computingpass)
|
||||
{
|
||||
original_model_output << "{";
|
||||
original_model.writeJsonOriginalModelOutput(original_model_output);
|
||||
|
@ -1364,9 +1378,13 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
|||
|
||||
if (json_output_mode == standardout)
|
||||
{
|
||||
if (transformpass || computingpass)
|
||||
cout << "\"transformed_model\": ";
|
||||
else
|
||||
cout << "\"model\": ";
|
||||
cout << output.str();
|
||||
if (!original_model_output.str().empty())
|
||||
cout << original_model_output.str();
|
||||
cout << ", \"original_model\": " << original_model_output.str();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1418,83 +1436,77 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
|||
}
|
||||
|
||||
void
|
||||
ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonprintderivdetail) const
|
||||
ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonderivsimple) const
|
||||
{
|
||||
ostringstream static_output, static_detail_output;
|
||||
ostringstream static_output, static_simple_output;
|
||||
static_output << "{";
|
||||
static_model.writeJsonComputingPassOutput(static_output, false);
|
||||
static_model.writeJsonComputingPassOutput(static_output, true);
|
||||
static_output << "}" << endl;
|
||||
|
||||
ostringstream dynamic_output, dynamic_detail_output;
|
||||
ostringstream dynamic_output, dynamic_simple_output;
|
||||
dynamic_output << "{";
|
||||
dynamic_model.writeJsonComputingPassOutput(dynamic_output, false);
|
||||
dynamic_model.writeJsonComputingPassOutput(dynamic_output, true);
|
||||
dynamic_output << "}" << endl;
|
||||
|
||||
ostringstream original_model_output;
|
||||
original_model_output << "{";
|
||||
original_model.writeJsonOriginalModelOutput(original_model_output);
|
||||
original_model_output << "}" << endl;
|
||||
|
||||
ostringstream tmp_out, static_paramsd_output, static_paramsd_detail_output;
|
||||
ostringstream tmp_out, static_paramsd_output, static_paramsd_simple_output;
|
||||
tmp_out << "";
|
||||
static_paramsd_output << "";
|
||||
static_paramsd_detail_output << "";
|
||||
static_model.writeJsonParamsDerivativesFile(tmp_out, false);
|
||||
static_paramsd_simple_output << "";
|
||||
static_model.writeJsonParamsDerivativesFile(tmp_out, true);
|
||||
if (!tmp_out.str().empty())
|
||||
static_paramsd_output << "{" << tmp_out.str() << "}" << endl;
|
||||
|
||||
ostringstream tmp1_out, dynamic_paramsd_output, dynamic_paramsd_detail_output;
|
||||
ostringstream tmp1_out, dynamic_paramsd_output, dynamic_paramsd_simple_output;
|
||||
tmp1_out << "";
|
||||
dynamic_paramsd_output << "";
|
||||
dynamic_paramsd_detail_output << "";
|
||||
dynamic_model.writeJsonParamsDerivativesFile(tmp1_out, false);
|
||||
dynamic_paramsd_simple_output << "";
|
||||
dynamic_model.writeJsonParamsDerivativesFile(tmp1_out, true);
|
||||
if (!tmp1_out.str().empty())
|
||||
dynamic_paramsd_output << "{" << tmp1_out.str() << "}" << endl;
|
||||
|
||||
if (jsonprintderivdetail)
|
||||
if (jsonderivsimple)
|
||||
{
|
||||
static_detail_output << "{";
|
||||
static_model.writeJsonComputingPassOutput(static_detail_output, true);
|
||||
static_detail_output << "}";
|
||||
static_simple_output << "{";
|
||||
static_model.writeJsonComputingPassOutput(static_simple_output, false);
|
||||
static_simple_output << "}";
|
||||
|
||||
dynamic_detail_output << "{";
|
||||
dynamic_model.writeJsonComputingPassOutput(dynamic_detail_output, true);
|
||||
dynamic_detail_output << "}";
|
||||
dynamic_simple_output << "{";
|
||||
dynamic_model.writeJsonComputingPassOutput(dynamic_simple_output, false);
|
||||
dynamic_simple_output << "}";
|
||||
|
||||
ostringstream tmpd_out, tmpd1_out;
|
||||
tmpd_out << "";
|
||||
tmpd1_out << "";
|
||||
static_model.writeJsonParamsDerivativesFile(tmpd_out, true);
|
||||
if (!tmpd_out.str().empty())
|
||||
static_paramsd_detail_output << "{" << tmpd_out.str() << "}" << endl;
|
||||
static_paramsd_simple_output << "{" << tmpd_out.str() << "}" << endl;
|
||||
|
||||
dynamic_model.writeJsonParamsDerivativesFile(tmpd1_out, true);
|
||||
if (!tmpd1_out.str().empty())
|
||||
dynamic_paramsd_detail_output << "{" << tmpd1_out.str() << "}" << endl;
|
||||
dynamic_paramsd_simple_output << "{" << tmpd1_out.str() << "}" << endl;
|
||||
}
|
||||
|
||||
if (json_output_mode == standardout)
|
||||
{
|
||||
cout << original_model_output.str() << endl
|
||||
<< static_output.str() << endl
|
||||
<< dynamic_output.str() << endl;
|
||||
cout << ", \"static_model\": " << static_output.str() << endl
|
||||
<< ", \"dynamic_model\": " << dynamic_output.str() << endl;
|
||||
|
||||
if (!static_paramsd_output.str().empty())
|
||||
cout << static_paramsd_output.str() << endl;
|
||||
cout << ", \"static_params_deriv\": " << static_paramsd_output.str() << endl;
|
||||
|
||||
if (!dynamic_paramsd_output.str().empty())
|
||||
cout << dynamic_paramsd_output.str() << endl;
|
||||
cout << ", \"dynamic_params_deriv\":" << dynamic_paramsd_output.str() << endl;
|
||||
|
||||
if (jsonprintderivdetail)
|
||||
if (jsonderivsimple)
|
||||
{
|
||||
cout << static_detail_output.str() << endl
|
||||
<< dynamic_detail_output.str() << endl;
|
||||
cout << ", \"static_model_simple\": " << static_simple_output.str() << endl
|
||||
<< ", \"dynamic_model_simple\": " << dynamic_simple_output.str() << endl;
|
||||
|
||||
if (!static_paramsd_detail_output.str().empty())
|
||||
cout << static_paramsd_detail_output.str() << endl;
|
||||
if (!static_paramsd_simple_output.str().empty())
|
||||
cout << "," << static_paramsd_simple_output.str() << endl;
|
||||
|
||||
if (!dynamic_paramsd_detail_output.str().empty())
|
||||
cout << dynamic_paramsd_detail_output.str() << endl;
|
||||
if (!dynamic_paramsd_simple_output.str().empty())
|
||||
cout << "," << dynamic_paramsd_simple_output.str() << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1506,40 +1518,38 @@ ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType
|
|||
}
|
||||
|
||||
string fname_original, fname_static, fname_dynamic;
|
||||
fname_original = basename + "_original.json";
|
||||
fname_static = basename + "_static.json";
|
||||
fname_dynamic = basename + "_dynamic.json";
|
||||
|
||||
writeJsonFileHelper(fname_original, original_model_output);
|
||||
writeJsonFileHelper(fname_static, static_output);
|
||||
writeJsonFileHelper(fname_dynamic, dynamic_output);
|
||||
|
||||
if (jsonprintderivdetail)
|
||||
if (jsonderivsimple)
|
||||
{
|
||||
string fname_static_details, fname_dynamic_details;
|
||||
fname_static_details = basename + "_static_details.json";
|
||||
fname_dynamic_details = basename + "_dynamic_details.json";
|
||||
string fname_static_simple, fname_dynamic_simple;
|
||||
fname_static_simple = basename + "_static_simple.json";
|
||||
fname_dynamic_simple = basename + "_dynamic_simple.json";
|
||||
|
||||
writeJsonFileHelper(fname_static_details, static_detail_output);
|
||||
writeJsonFileHelper(fname_dynamic_details, dynamic_detail_output);
|
||||
writeJsonFileHelper(fname_static_simple, static_simple_output);
|
||||
writeJsonFileHelper(fname_dynamic_simple, dynamic_simple_output);
|
||||
}
|
||||
|
||||
if (!static_paramsd_output.str().empty())
|
||||
{
|
||||
string fname_static_params, fname_static_params_details;
|
||||
string fname_static_params, fname_static_params_simple;
|
||||
fname_static_params = basename + "_static_params_derivs.json";
|
||||
fname_static_params_details = basename + "_static_params_derivs_details.json";
|
||||
fname_static_params_simple = basename + "_static_params_derivs_simple.json";
|
||||
writeJsonFileHelper(fname_static_params, static_paramsd_output);
|
||||
writeJsonFileHelper(fname_static_params_details, static_paramsd_detail_output);
|
||||
writeJsonFileHelper(fname_static_params_simple, static_paramsd_simple_output);
|
||||
}
|
||||
|
||||
if (!dynamic_paramsd_output.str().empty())
|
||||
{
|
||||
string fname_dynamic_params, fname_dynamic_params_details;
|
||||
string fname_dynamic_params, fname_dynamic_params_simple;
|
||||
fname_dynamic_params = basename + "_params_derivs.json";
|
||||
fname_dynamic_params_details = basename + "_params_derivs_details.json";
|
||||
fname_dynamic_params_simple = basename + "_params_derivs_simple.json";
|
||||
writeJsonFileHelper(fname_dynamic_params, dynamic_paramsd_output);
|
||||
writeJsonFileHelper(fname_dynamic_params_details, dynamic_paramsd_detail_output);
|
||||
writeJsonFileHelper(fname_dynamic_params_simple, dynamic_paramsd_simple_output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ private:
|
|||
//! Warnings Encountered
|
||||
WarningConsolidation &warnings;
|
||||
//! Functions used in writing of JSON outut. See writeJsonOutput
|
||||
void writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType json_output_mode, bool transformpass) const;
|
||||
void writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonprintderivdetail) const;
|
||||
void writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType json_output_mode, bool transformpass, bool computingpass) const;
|
||||
void writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonderivsimple) const;
|
||||
void writeJsonFileHelper(string &fname, ostringstream &output) const;
|
||||
public:
|
||||
//! Add a statement
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
//! Initially created to enable Julia to work with .mod files
|
||||
//! Potentially outputs ModFile after the various parts of processing (parsing, checkPass, transformPass, computingPass)
|
||||
//! Allows user of other host language platforms (python, fortran, etc) to provide support for dynare .mod files
|
||||
void writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonprintderivdetail = false);
|
||||
void writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple = false);
|
||||
};
|
||||
|
||||
#endif // ! MOD_FILE_HH
|
||||
|
|
|
@ -341,7 +341,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "Type missmatch for equation " << equation_ID+1 << "\n";
|
||||
cerr << "Type mismatch for equation " << equation_ID+1 << "\n";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
output << ";\n";
|
||||
|
@ -2467,12 +2467,16 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
expr_t d1 = it->second;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(symb_id) << "\"";
|
||||
jacobian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
jacobian_output << "{\"row\": " << eq + 1;
|
||||
jacobian_output << ", \"col\": " << col + 1
|
||||
<< ", \"val\": \"";
|
||||
|
||||
jacobian_output << ", \"col\": " << col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << ", \"var\": \"" << symbol_table.getName(symb_id) << "\"";
|
||||
|
||||
jacobian_output << ", \"val\": \"";
|
||||
d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
|
||||
jacobian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -2506,13 +2510,16 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
int col_sym = tsid2*symbol_table.endo_nbr()+tsid1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(symb_id1) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(symb_id2) << "\"";
|
||||
hessian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian_output << "{\"row\": " << eq + 1;
|
||||
|
||||
hessian_output << ", \"col\": [" << col + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << ", \"var1\": \"" << symbol_table.getName(symb_id1) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(symb_id2) << "\"";
|
||||
|
||||
if (symb_id1 != symb_id2)
|
||||
hessian_output << ", " << col_sym + 1;
|
||||
hessian_output << "]"
|
||||
|
@ -2544,10 +2551,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
expr_t d3 = it->second;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivatives_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\"";
|
||||
third_derivatives_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivatives_output << "{\"row\": " << eq + 1;
|
||||
|
||||
|
@ -2569,17 +2573,23 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
|
|||
third_derivatives_output << ", ";
|
||||
third_derivatives_output << *it2 + 1;
|
||||
}
|
||||
third_derivatives_output << "]"
|
||||
<< ", \"val\": \"";
|
||||
third_derivatives_output << "]";
|
||||
|
||||
if (writeDetails)
|
||||
third_derivatives_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\"";
|
||||
|
||||
third_derivatives_output << ", \"val\": \"";
|
||||
d3->writeJsonOutput(third_derivatives_output, temp_term_union, tef_terms);
|
||||
third_derivatives_output << "\"}" << endl;
|
||||
}
|
||||
third_derivatives_output << "]}";
|
||||
|
||||
if (writeDetails)
|
||||
output << "\"static_model_derivative_details\": {";
|
||||
output << "\"static_model\": {";
|
||||
else
|
||||
output << "\"static_model_derivatives\": {";
|
||||
output << "\"static_model_simple\": {";
|
||||
output << model_local_vars_output.str()
|
||||
<< ", " << model_output.str()
|
||||
<< ", " << jacobian_output.str()
|
||||
|
@ -2629,12 +2639,16 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
jacobian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
jacobian_output << "{\"row\": " << eq + 1;
|
||||
jacobian_output << ", \"param_col\": " << param_col
|
||||
<< ", \"val\": \"";
|
||||
|
||||
if (writeDetails)
|
||||
jacobian_output << ", \"param_col\": " << param_col;
|
||||
|
||||
jacobian_output << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
|
||||
jacobian_output << ", \"val\": \"";
|
||||
d1->writeJsonOutput(jacobian_output, params_derivs_temporary_terms, tef_terms);
|
||||
jacobian_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -2659,11 +2673,14 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
hessian_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian_output << "{\"row\": " << eq + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
|
||||
<< ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
|
||||
hessian_output << ", \"var_col\": " << var_col
|
||||
<< ", \"param_col\": " << param_col
|
||||
<< ", \"val\": \"";
|
||||
|
@ -2692,14 +2709,18 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
hessian1_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
hessian1_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
hessian1_output << "{\"row\": " << eq + 1;
|
||||
|
||||
hessian1_output << ", \"param1_col\": " << param1_col
|
||||
<< ", \"param2_col\": " << param2_col
|
||||
<< ", \"val\": \"";
|
||||
<< ", \"param2_col\": " << param2_col;
|
||||
|
||||
if (writeDetails)
|
||||
hessian1_output << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
|
||||
hessian1_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(hessian1_output, params_derivs_temporary_terms, tef_terms);
|
||||
hessian1_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -2727,16 +2748,19 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var\": \"" << symbol_table.getName(var) << "\""
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
third_derivs_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivs_output << "{\"row\": " << eq + 1;
|
||||
third_derivs_output << ", \"var_col\": " << var_col
|
||||
<< ", \"param1_col\": " << param1_col
|
||||
<< ", \"param2_col\": " << param2_col
|
||||
<< ", \"val\": \"";
|
||||
<< ", \"param2_col\": " << param2_col;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs_output << ", \"var\": \"" << symbol_table.getName(var) << "\""
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
|
||||
<< ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
|
||||
|
||||
third_derivs_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(third_derivs_output, params_derivs_temporary_terms, tef_terms);
|
||||
third_derivs_output << "\"}" << endl;
|
||||
}
|
||||
|
@ -2765,25 +2789,29 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
|
|||
int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs1_output << "{\"eq\": " << eq + 1
|
||||
<< ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
third_derivs1_output << "{\"eq\": " << eq + 1;
|
||||
else
|
||||
third_derivs1_output << "{\"row\": " << eq + 1;
|
||||
|
||||
third_derivs1_output << ", \"var1_col\": " << var1_col
|
||||
<< ", \"var2_col\": " << var2_col
|
||||
<< ", \"param_col\": " << param_col
|
||||
<< ", \"val\": \"";
|
||||
<< ", \"param_col\": " << param_col;
|
||||
|
||||
if (writeDetails)
|
||||
third_derivs1_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
|
||||
<< ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
|
||||
<< ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
|
||||
|
||||
third_derivs1_output << ", \"val\": \"";
|
||||
d2->writeJsonOutput(third_derivs1_output, params_derivs_temporary_terms, tef_terms);
|
||||
third_derivs1_output << "\"}" << endl;
|
||||
}
|
||||
third_derivs1_output << "]}" << endl;
|
||||
|
||||
if (writeDetails)
|
||||
output << "\"static_model_params_derivative_details\": {";
|
||||
output << "\"static_model_params_derivative\": {";
|
||||
else
|
||||
output << "\"static_model_params_derivatives\": {";
|
||||
output << "\"static_model_params_derivatives_simple\": {";
|
||||
output << model_local_vars_output.str()
|
||||
<< ", " << model_output.str()
|
||||
<< ", " << jacobian_output.str()
|
||||
|
|
|
@ -999,3 +999,4 @@ clean-local:
|
|||
find . -name "*.aux" -type f -delete
|
||||
find . -name "*.log" -type f -delete
|
||||
find . -name "*.eps" -type f -delete
|
||||
find . -name "*.json" -type f -delete
|
||||
|
|
Loading…
Reference in New Issue