2010-04-23 18:39:07 +02:00
|
|
|
/*
|
2018-08-21 11:46:59 +02:00
|
|
|
* Copyright (C) 2010-2018 Dynare Team
|
2010-04-23 18:39:07 +02:00
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
#include <algorithm>
|
|
|
|
|
2018-09-03 17:16:28 +02:00
|
|
|
#include "ModelEquationBlock.hh"
|
2010-04-23 18:39:07 +02:00
|
|
|
|
2018-08-14 14:23:21 +02:00
|
|
|
SteadyStateModel::SteadyStateModel(SymbolTable &symbol_table_arg,
|
|
|
|
NumericalConstants &num_constants_arg,
|
|
|
|
ExternalFunctionsTable &external_functions_table_arg,
|
|
|
|
const StaticModel &static_model_arg) :
|
2018-10-04 17:18:27 +02:00
|
|
|
DataTree{symbol_table_arg, num_constants_arg, external_functions_table_arg},
|
|
|
|
static_model{static_model_arg}
|
2010-04-23 18:39:07 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-10-09 18:27:19 +02:00
|
|
|
SteadyStateModel::SteadyStateModel(const SteadyStateModel &m) :
|
|
|
|
DataTree {m},
|
|
|
|
static_model {m.static_model}
|
|
|
|
{
|
|
|
|
for (const auto &it : m.def_table)
|
|
|
|
def_table.push_back(make_pair(it.first, it.second->cloneDynamic(*this)));
|
|
|
|
}
|
|
|
|
|
|
|
|
SteadyStateModel &
|
|
|
|
SteadyStateModel::operator=(const SteadyStateModel &m)
|
|
|
|
{
|
|
|
|
DataTree::operator=(m);
|
|
|
|
|
|
|
|
assert(&static_model == &m.static_model);
|
|
|
|
|
|
|
|
def_table.clear();
|
|
|
|
for (const auto &it : m.def_table)
|
|
|
|
def_table.push_back(make_pair(it.first, it.second->cloneDynamic(*this)));
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-04-23 18:39:07 +02:00
|
|
|
void
|
2010-09-16 19:18:45 +02:00
|
|
|
SteadyStateModel::addDefinition(int symb_id, expr_t expr)
|
2010-04-23 18:39:07 +02:00
|
|
|
{
|
2011-01-26 19:55:01 +01:00
|
|
|
AddVariable(symb_id); // Create the variable node to be used in write method
|
|
|
|
|
2018-07-17 18:34:07 +02:00
|
|
|
assert(symbol_table.getType(symb_id) == SymbolType::endogenous
|
|
|
|
|| symbol_table.getType(symb_id) == SymbolType::modFileLocalVariable
|
|
|
|
|| symbol_table.getType(symb_id) == SymbolType::parameter);
|
2010-04-23 18:39:07 +02:00
|
|
|
|
|
|
|
// Add the variable
|
2011-01-26 19:55:01 +01:00
|
|
|
vector<int> v;
|
|
|
|
v.push_back(symb_id);
|
2018-06-04 12:48:09 +02:00
|
|
|
def_table.emplace_back(v, expr);
|
2011-01-26 19:55:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SteadyStateModel::addMultipleDefinitions(const vector<int> &symb_ids, expr_t expr)
|
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
for (int symb_id : symb_ids)
|
2011-01-26 19:55:01 +01:00
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
AddVariable(symb_id); // Create the variable nodes to be used in write method
|
2018-07-17 18:34:07 +02:00
|
|
|
assert(symbol_table.getType(symb_id) == SymbolType::endogenous
|
|
|
|
|| symbol_table.getType(symb_id) == SymbolType::modFileLocalVariable
|
|
|
|
|| symbol_table.getType(symb_id) == SymbolType::parameter);
|
2011-01-26 19:55:01 +01:00
|
|
|
}
|
2018-06-04 12:48:09 +02:00
|
|
|
def_table.emplace_back(symb_ids, expr);
|
2010-04-23 18:39:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-30 15:46:17 +02:00
|
|
|
SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const
|
2010-05-31 17:43:17 +02:00
|
|
|
{
|
2014-02-25 17:58:13 +01:00
|
|
|
if (def_table.size() == 0)
|
2014-02-24 16:40:28 +01:00
|
|
|
return;
|
|
|
|
|
2017-08-30 15:46:17 +02:00
|
|
|
mod_file_struct.steady_state_model_present = true;
|
2011-01-26 19:55:01 +01:00
|
|
|
vector<int> so_far_defined;
|
|
|
|
|
2018-06-04 12:26:16 +02:00
|
|
|
for (const auto & i : def_table)
|
2010-05-31 17:43:17 +02:00
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
const vector<int> &symb_ids = i.first;
|
2011-01-26 19:55:01 +01:00
|
|
|
|
|
|
|
// Check that symbols are not already defined
|
2018-06-04 12:26:16 +02:00
|
|
|
for (int symb_id : symb_ids)
|
|
|
|
if (find(so_far_defined.begin(), so_far_defined.end(), symb_id)
|
2011-01-26 19:55:01 +01:00
|
|
|
!= so_far_defined.end())
|
2018-06-04 12:26:16 +02:00
|
|
|
warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(symb_id) << "' is declared twice" << endl;
|
2017-05-16 16:30:27 +02:00
|
|
|
|
2010-05-31 17:43:17 +02:00
|
|
|
// Check that expression has no undefined symbol
|
2017-08-30 15:46:17 +02:00
|
|
|
if (!mod_file_struct.ramsey_model_present)
|
2010-05-31 17:43:17 +02:00
|
|
|
{
|
2013-11-29 15:32:49 +01:00
|
|
|
set<int> used_symbols;
|
2018-06-04 12:26:16 +02:00
|
|
|
const expr_t &expr = i.second;
|
2018-07-17 18:34:07 +02:00
|
|
|
expr->collectVariables(SymbolType::endogenous, used_symbols);
|
|
|
|
expr->collectVariables(SymbolType::modFileLocalVariable, used_symbols);
|
2018-06-04 12:26:16 +02:00
|
|
|
for (int used_symbol : used_symbols)
|
|
|
|
if (find(so_far_defined.begin(), so_far_defined.end(), used_symbol)
|
2011-01-26 19:55:01 +01:00
|
|
|
== so_far_defined.end())
|
2010-05-31 17:43:17 +02:00
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
cerr << "ERROR: in the 'steady_state_model' block, variable '" << symbol_table.getName(used_symbol)
|
2011-01-26 19:55:01 +01:00
|
|
|
<< "' is undefined in the declaration of variable '" << symbol_table.getName(symb_ids[0]) << "'" << endl;
|
2010-05-31 17:43:17 +02:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
2011-01-26 19:55:01 +01:00
|
|
|
|
|
|
|
copy(symb_ids.begin(), symb_ids.end(), back_inserter(so_far_defined));
|
2010-05-31 17:43:17 +02:00
|
|
|
}
|
2014-02-24 17:27:19 +01:00
|
|
|
|
|
|
|
set<int> orig_endogs = symbol_table.getOrigEndogenous();
|
2018-06-04 12:26:16 +02:00
|
|
|
for (int orig_endog : orig_endogs)
|
2014-02-24 17:27:19 +01:00
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
if (find(so_far_defined.begin(), so_far_defined.end(), orig_endog)
|
2014-02-24 17:27:19 +01:00
|
|
|
== so_far_defined.end())
|
2018-06-04 12:26:16 +02:00
|
|
|
warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(orig_endog) << "' is not assigned a value" << endl;
|
2014-02-24 17:27:19 +01:00
|
|
|
}
|
2010-05-31 17:43:17 +02:00
|
|
|
}
|
|
|
|
|
2017-08-30 11:32:01 +02:00
|
|
|
void
|
|
|
|
SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
|
|
|
|
{
|
|
|
|
ofstream output, content_output;
|
|
|
|
string filename = basename + "_steady_state.tex";
|
|
|
|
string content_basename = basename + "_steady_state_content";
|
|
|
|
string content_filename = content_basename + ".tex";
|
|
|
|
|
2018-06-27 15:12:12 +02:00
|
|
|
output.open(filename, ios::out | ios::binary);
|
2017-08-30 11:32:01 +02:00
|
|
|
if (!output.is_open())
|
|
|
|
{
|
|
|
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2018-06-27 15:12:12 +02:00
|
|
|
content_output.open(content_filename, ios::out | ios::binary);
|
2017-08-30 11:32:01 +02:00
|
|
|
if (!content_output.is_open())
|
|
|
|
{
|
|
|
|
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
output << "\\documentclass[10pt,a4paper]{article}" << endl
|
|
|
|
<< "\\usepackage[landscape]{geometry}" << endl
|
|
|
|
<< "\\usepackage{fullpage}" << endl
|
|
|
|
<< "\\usepackage{amsfonts}" << endl
|
|
|
|
<< "\\usepackage{breqn}" << endl
|
|
|
|
<< "\\begin{document}" << endl
|
|
|
|
<< "\\footnotesize" << endl;
|
|
|
|
|
2018-06-04 12:26:16 +02:00
|
|
|
for (const auto & it : def_table)
|
2018-06-04 15:03:26 +02:00
|
|
|
for (auto it1 = it.first.begin(); it1 != it.first.end(); it1++)
|
2017-08-30 11:32:01 +02:00
|
|
|
{
|
|
|
|
int id = *it1;
|
2018-06-04 12:26:16 +02:00
|
|
|
expr_t value = it.second;
|
2017-08-30 11:32:01 +02:00
|
|
|
content_output << "\\begin{dmath}" << endl
|
|
|
|
<< symbol_table.getTeXName(id) << " = ";
|
2018-09-05 18:27:13 +02:00
|
|
|
value->writeOutput(content_output, ExprNodeOutputType::latexStaticModel);
|
2017-08-30 11:32:01 +02:00
|
|
|
content_output << endl << "\\end{dmath}" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
static_model.writeLatexAuxVarRecursiveDefinitions(content_output);
|
|
|
|
|
|
|
|
output << "\\include{" << content_basename << "}" << endl
|
|
|
|
<< "\\end{document}" << endl;
|
|
|
|
|
|
|
|
output.close();
|
|
|
|
content_output.close();
|
|
|
|
}
|
|
|
|
|
2010-05-31 17:43:17 +02:00
|
|
|
void
|
2015-07-28 17:27:56 +02:00
|
|
|
SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model, bool julia) const
|
2010-04-23 18:39:07 +02:00
|
|
|
{
|
2014-02-24 16:40:28 +01:00
|
|
|
if (def_table.size() == 0)
|
2010-04-23 18:39:07 +02:00
|
|
|
return;
|
|
|
|
|
2018-06-27 15:01:31 +02:00
|
|
|
string filename = julia ? basename + "SteadyState2.jl" : packageDir(basename) + "/steadystate.m";
|
2010-04-23 18:39:07 +02:00
|
|
|
ofstream output;
|
2018-06-27 15:12:12 +02:00
|
|
|
output.open(filename, ios::out | ios::binary);
|
2010-04-23 18:39:07 +02:00
|
|
|
if (!output.is_open())
|
|
|
|
{
|
|
|
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2018-09-05 18:27:13 +02:00
|
|
|
ExprNodeOutputType output_type = (julia ? ExprNodeOutputType::juliaSteadyStateFile : ExprNodeOutputType::steadyStateFile);
|
2015-07-28 17:27:56 +02:00
|
|
|
|
|
|
|
if (!julia)
|
2018-06-27 15:01:31 +02:00
|
|
|
output << "function [ys_, params, info] = steadystate("
|
2015-07-28 17:27:56 +02:00
|
|
|
<< "ys_, exo_, params)" << endl
|
|
|
|
<< "% Steady state generated by Dynare preprocessor" << endl
|
|
|
|
<< " info = 0;" << endl;
|
|
|
|
else
|
2015-08-21 12:00:47 +02:00
|
|
|
output << "module " << basename << "SteadyState2" << endl
|
|
|
|
<< "#" << endl
|
|
|
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
|
|
|
<< "# from " << basename << ".mod" << endl
|
|
|
|
<< "#" << endl
|
2015-08-19 11:28:25 +02:00
|
|
|
<< "export steady_state!" << endl << endl
|
2015-08-19 12:11:08 +02:00
|
|
|
<< "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
|
|
|
|
<< "params::Vector{Float64})" << endl;
|
2010-04-23 18:39:07 +02:00
|
|
|
|
2018-06-04 12:26:16 +02:00
|
|
|
for (const auto & i : def_table)
|
2010-04-23 18:39:07 +02:00
|
|
|
{
|
2018-06-04 12:26:16 +02:00
|
|
|
const vector<int> &symb_ids = i.first;
|
2010-04-23 18:39:07 +02:00
|
|
|
output << " ";
|
2011-01-26 19:55:01 +01:00
|
|
|
if (symb_ids.size() > 1)
|
|
|
|
output << "[";
|
|
|
|
for (size_t j = 0; j < symb_ids.size(); j++)
|
|
|
|
{
|
2018-10-10 13:03:52 +02:00
|
|
|
getVariable(symb_ids[j])->ExprNode::writeOutput(output, output_type);
|
2011-01-26 19:55:01 +01:00
|
|
|
if (j < symb_ids.size()-1)
|
|
|
|
output << ",";
|
|
|
|
}
|
|
|
|
if (symb_ids.size() > 1)
|
|
|
|
output << "]";
|
|
|
|
|
|
|
|
output << "=";
|
2018-06-04 12:26:16 +02:00
|
|
|
i.second->writeOutput(output, output_type);
|
2010-04-23 18:39:07 +02:00
|
|
|
output << ";" << endl;
|
|
|
|
}
|
2015-07-28 17:27:56 +02:00
|
|
|
if (!julia)
|
|
|
|
output << " % Auxiliary equations" << endl;
|
|
|
|
else
|
|
|
|
output << " # Auxiliary equations" << endl;
|
2016-04-04 17:11:03 +02:00
|
|
|
static_model.writeAuxVarRecursiveDefinitions(output, output_type);
|
2015-07-28 17:27:56 +02:00
|
|
|
|
2015-08-18 16:31:30 +02:00
|
|
|
if (!julia)
|
|
|
|
output << " check_=0;" << endl;
|
|
|
|
|
2015-07-28 17:27:56 +02:00
|
|
|
output << "end" << endl;
|
|
|
|
if (julia)
|
|
|
|
output << "end" << endl;
|
2018-09-04 09:41:12 +02:00
|
|
|
output.close();
|
2010-04-23 18:39:07 +02:00
|
|
|
}
|
|
|
|
|
2017-10-16 17:24:55 +02:00
|
|
|
void
|
|
|
|
SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComputingPass) const
|
|
|
|
{
|
|
|
|
if (def_table.size() == 0)
|
|
|
|
return;
|
|
|
|
|
2018-06-04 14:17:36 +02:00
|
|
|
vector<pair<string, string>> eqtags;
|
2017-10-16 17:24:55 +02:00
|
|
|
|
|
|
|
output << "{\"steady_state_model\": [";
|
|
|
|
|
|
|
|
for (size_t i = 0; i < def_table.size(); i++)
|
|
|
|
{
|
|
|
|
const vector<int> &symb_ids = def_table[i].first;
|
|
|
|
if (i != 0)
|
|
|
|
output << ",";
|
|
|
|
output << "{\"lhs\": ";
|
|
|
|
if (symb_ids.size() > 1)
|
|
|
|
output << "[";
|
|
|
|
for (size_t j = 0; j < symb_ids.size(); j++)
|
|
|
|
{
|
|
|
|
if (j != 0)
|
|
|
|
output << ",";
|
|
|
|
output << "\"";
|
2018-10-10 13:03:52 +02:00
|
|
|
getVariable(symb_ids[j])->writeJsonOutput(output, {}, {}, false);
|
2017-10-16 17:24:55 +02:00
|
|
|
output << "\"";
|
|
|
|
}
|
|
|
|
if (symb_ids.size() > 1)
|
|
|
|
output << "]";
|
|
|
|
output << ", \"rhs\":\"";
|
2018-05-29 11:59:42 +02:00
|
|
|
def_table[i].second->writeJsonOutput(output, {}, {}, false);
|
2017-10-16 17:24:55 +02:00
|
|
|
output << "\"}" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (transformComputingPass)
|
|
|
|
static_model.writeJsonAuxVarRecursiveDefinitions(output);
|
|
|
|
|
|
|
|
output << "]}";
|
|
|
|
}
|
2018-09-03 17:16:28 +02:00
|
|
|
|
|
|
|
Epilogue::Epilogue(SymbolTable &symbol_table_arg,
|
|
|
|
NumericalConstants &num_constants_arg,
|
|
|
|
ExternalFunctionsTable &external_functions_table_arg,
|
|
|
|
TrendComponentModelTable &trend_component_model_table_arg,
|
|
|
|
VarModelTable &var_model_table_arg) :
|
2018-10-04 17:18:27 +02:00
|
|
|
DynamicModel{symbol_table_arg, num_constants_arg, external_functions_table_arg,
|
|
|
|
trend_component_model_table_arg, var_model_table_arg}
|
2018-09-03 17:16:28 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-10-09 18:27:19 +02:00
|
|
|
Epilogue::Epilogue(const Epilogue &m) :
|
|
|
|
DynamicModel {m},
|
|
|
|
endogs {m.endogs},
|
|
|
|
exogs {m.exogs}
|
|
|
|
{
|
|
|
|
for (const auto &it : m.def_table)
|
|
|
|
def_table.push_back(make_pair(it.first, it.second->cloneDynamic(*this)));
|
|
|
|
}
|
|
|
|
|
|
|
|
Epilogue &
|
|
|
|
Epilogue::operator=(const Epilogue &m)
|
|
|
|
{
|
|
|
|
DynamicModel::operator=(m);
|
|
|
|
|
|
|
|
endogs = m.endogs;
|
|
|
|
exogs = m.exogs;
|
|
|
|
|
|
|
|
def_table.clear();
|
|
|
|
for (const auto &it : m.def_table)
|
|
|
|
def_table.push_back(make_pair(it.first, it.second->cloneDynamic(*this)));
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2018-09-03 17:16:28 +02:00
|
|
|
void
|
|
|
|
Epilogue::addDefinition(int symb_id, expr_t expr)
|
|
|
|
{
|
|
|
|
AddVariable(symb_id); // Create the variable node to be used in write method
|
|
|
|
def_table.emplace_back(symb_id, expr);
|
|
|
|
endogs.emplace(symb_id);
|
|
|
|
expr->collectVariables(SymbolType::endogenous, exogs);
|
|
|
|
expr->collectVariables(SymbolType::exogenous, exogs);
|
|
|
|
expr->collectVariables(SymbolType::endogenousEpilogue, exogs);
|
|
|
|
expr->collectVariables(SymbolType::exogenousEpilogue, exogs);
|
|
|
|
for (auto it : endogs)
|
|
|
|
exogs.erase(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Epilogue::checkPass(WarningConsolidation &warnings) const
|
|
|
|
{
|
|
|
|
if (def_table.size() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
vector<int> so_far_defined;
|
|
|
|
for (const auto & it : def_table)
|
|
|
|
{
|
|
|
|
if (find(so_far_defined.begin(), so_far_defined.end(), it.first) != so_far_defined.end())
|
|
|
|
{
|
|
|
|
cerr << "WARNING: in the 'epilogue' block, variable '" << symbol_table.getName(it.first)
|
|
|
|
<< "' is declared twice" << endl;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
so_far_defined.push_back(it.first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Epilogue::writeEpilogueFile(const string &basename) const
|
|
|
|
{
|
|
|
|
if (def_table.size() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string filename = packageDir(basename) + "/epilogue.m";
|
|
|
|
ofstream output;
|
|
|
|
output.open(filename, ios::out | ios::binary);
|
|
|
|
if (!output.is_open())
|
|
|
|
{
|
|
|
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
2018-09-05 18:27:13 +02:00
|
|
|
ExprNodeOutputType output_type = ExprNodeOutputType::epilogueFile;
|
2018-09-03 17:16:28 +02:00
|
|
|
output << "function ds = epilogue(params, ds)" << endl
|
|
|
|
<< "% function ds = epilogue(params, ds)" << endl
|
|
|
|
<< "% Epilogue file generated by Dynare preprocessor" << endl << endl
|
|
|
|
<< "epilogue_ds_first_date__ = ds.firstdate;" << endl
|
|
|
|
<< "epilogue_loop_begin_idx__ = lastdate(ds) - ds.lastobservedperiod;" << endl
|
|
|
|
<< "epilogue_loop_end_idx__ = lastdate(ds) - firstdate(ds) + 1;" << endl << endl;
|
|
|
|
|
|
|
|
output << "% endogenous" << endl;
|
|
|
|
for (auto symb_id : endogs)
|
|
|
|
output << symbol_table.getName(symb_id) << " = ds." << symbol_table.getName(symb_id) << ".data;" << endl;
|
|
|
|
output << endl
|
|
|
|
<< "% exogenous" << endl;
|
|
|
|
for (auto symb_id : exogs)
|
|
|
|
output << symbol_table.getName(symb_id) << " = ds." << symbol_table.getName(symb_id) << ".data;" << endl;
|
|
|
|
output << endl
|
|
|
|
<< "for epilogue_it__ = epilogue_loop_begin_idx__::epilogue_loop_end_idx__" << endl;
|
|
|
|
|
|
|
|
deriv_node_temp_terms_t tef_terms;
|
|
|
|
temporary_terms_t temporary_terms;
|
|
|
|
temporary_terms_idxs_t temporary_terms_idxs;
|
|
|
|
for (const auto & it : def_table)
|
|
|
|
if (it.second->containsExternalFunction())
|
|
|
|
{
|
|
|
|
output << " ";
|
|
|
|
it.second->writeExternalFunctionOutput(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms);
|
|
|
|
}
|
|
|
|
output << endl;
|
|
|
|
for (const auto & it : def_table)
|
|
|
|
{
|
|
|
|
output << " ";
|
2018-10-10 13:03:52 +02:00
|
|
|
getVariable(it.first)->ExprNode::writeOutput(output, output_type);
|
2018-09-03 17:16:28 +02:00
|
|
|
output << " = ";
|
|
|
|
it.second->writeOutput(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms);
|
|
|
|
output << ";" << endl;
|
|
|
|
}
|
|
|
|
output << "end" << endl << endl;
|
|
|
|
for (auto symb_id : endogs)
|
|
|
|
output << "ds." << symbol_table.getName(symb_id) << " = dseries(" << symbol_table.getName(symb_id)
|
|
|
|
<< ", epilogue_ds_first_date__);" << endl;
|
|
|
|
output << endl
|
|
|
|
<< "end" << endl;
|
|
|
|
output.close();
|
|
|
|
}
|