trunk preprocessor: automatic reindentation of all code with emacs
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2372 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
867daedd40
commit
723b260f9f
|
@ -418,7 +418,7 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int count_Block, Block
|
||||||
|
|
||||||
void
|
void
|
||||||
BlockTriangular::Free_Block(Model_Block* ModelBlock) const
|
BlockTriangular::Free_Block(Model_Block* ModelBlock) const
|
||||||
{
|
{
|
||||||
int blk, i;
|
int blk, i;
|
||||||
for (blk = 0;blk < ModelBlock->Size;blk++)
|
for (blk = 0;blk < ModelBlock->Size;blk++)
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ BlockTriangular::Free_Block(Model_Block* ModelBlock) const
|
||||||
free(ModelBlock);
|
free(ModelBlock);
|
||||||
free(Index_Equ_IM);
|
free(Index_Equ_IM);
|
||||||
free(Index_Var_IM);
|
free(Index_Var_IM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
t_type
|
t_type
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Useful documentation: Matlab 7 Mat-File Format
|
Useful documentation: Matlab 7 Mat-File Format
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
||||||
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
||||||
*/
|
*/
|
||||||
#include "MatlabFile.hh"
|
#include "MatlabFile.hh"
|
||||||
|
|
||||||
|
@ -1048,9 +1048,9 @@ MatlabFile::Delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
CollectStruct collect_struct;
|
CollectStruct collect_struct;
|
||||||
MatlabFile matlab_file;
|
MatlabFile matlab_file;
|
||||||
matlab_file.MatFileRead("gimf_steady.mat");
|
matlab_file.MatFileRead("gimf_steady.mat");
|
||||||
|
@ -1071,7 +1071,7 @@ main(int argc, char** argv)
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,32 +55,32 @@ ModelTree::ModelTree(SymbolTable &symbol_table_arg,
|
||||||
|
|
||||||
int
|
int
|
||||||
ModelTree::equation_number() const
|
ModelTree::equation_number() const
|
||||||
{
|
{
|
||||||
return(equations.size());
|
return(equations.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeDerivative(ostream &output, int eq, int symb_id, int lag,
|
ModelTree::writeDerivative(ostream &output, int eq, int symb_id, int lag,
|
||||||
ExprNodeOutputType output_type,
|
ExprNodeOutputType output_type,
|
||||||
const temporary_terms_type &temporary_terms,
|
const temporary_terms_type &temporary_terms,
|
||||||
SymbolType type) const
|
SymbolType type) const
|
||||||
{
|
{
|
||||||
first_derivatives_type::const_iterator it = first_derivatives.find(make_pair(eq, variable_table.getID(type, symb_id, lag)));
|
first_derivatives_type::const_iterator it = first_derivatives.find(make_pair(eq, variable_table.getID(type, symb_id, lag)));
|
||||||
if (it != first_derivatives.end())
|
if (it != first_derivatives.end())
|
||||||
(it->second)->writeOutput(output, output_type, temporary_terms);
|
(it->second)->writeOutput(output, output_type, temporary_terms);
|
||||||
else
|
else
|
||||||
output << 0;
|
output << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::compileDerivative(ofstream &code_file, int eq, int symb_id, int lag, ExprNodeOutputType output_type, map_idx_type &map_idx) const
|
ModelTree::compileDerivative(ofstream &code_file, int eq, int symb_id, int lag, ExprNodeOutputType output_type, map_idx_type &map_idx) const
|
||||||
{
|
{
|
||||||
first_derivatives_type::const_iterator it = first_derivatives.find(make_pair(eq, variable_table.getID(eEndogenous, symb_id, lag)));
|
first_derivatives_type::const_iterator it = first_derivatives.find(make_pair(eq, variable_table.getID(eEndogenous, symb_id, lag)));
|
||||||
if (it != first_derivatives.end())
|
if (it != first_derivatives.end())
|
||||||
(it->second)->compile(code_file,false, output_type, temporary_terms, map_idx);
|
(it->second)->compile(code_file,false, output_type, temporary_terms, map_idx);
|
||||||
else
|
else
|
||||||
code_file.write(&FLDZ, sizeof(FLDZ));
|
code_file.write(&FLDZ, sizeof(FLDZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -177,7 +177,7 @@ ModelTree::computeTemporaryTerms(int order)
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeTemporaryTerms(ostream &output, ExprNodeOutputType output_type) const
|
ModelTree::writeTemporaryTerms(ostream &output, ExprNodeOutputType output_type) const
|
||||||
{
|
{
|
||||||
// A copy of temporary terms
|
// A copy of temporary terms
|
||||||
temporary_terms_type tt2;
|
temporary_terms_type tt2;
|
||||||
|
|
||||||
|
@ -203,11 +203,11 @@ ModelTree::writeTemporaryTerms(ostream &output, ExprNodeOutputType output_type)
|
||||||
}
|
}
|
||||||
if (!OFFSET(output_type))
|
if (!OFFSET(output_type))
|
||||||
output << ";" << endl;
|
output << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type) const
|
ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type) const
|
||||||
{
|
{
|
||||||
for (map<int, NodeID>::const_iterator it = local_variables_table.begin();
|
for (map<int, NodeID>::const_iterator it = local_variables_table.begin();
|
||||||
it != local_variables_table.end(); it++)
|
it != local_variables_table.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +222,7 @@ ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_t
|
||||||
value->writeOutput(output, output_type, temporary_terms_type());
|
value->writeOutput(output, output_type, temporary_terms_type());
|
||||||
output << ";" << endl;
|
output << ";" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -255,7 +255,7 @@ ModelTree::BuildIncidenceMatrix()
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type) const
|
ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type) const
|
||||||
{
|
{
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < (int) equations.size(); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
|
@ -272,7 +272,7 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type)
|
||||||
|
|
||||||
output << "residual" << LPAR(output_type) << eq + OFFSET(output_type) << RPAR(output_type) << "= lhs-rhs;" << endl;
|
output << "residual" << LPAR(output_type) << eq + OFFSET(output_type) << RPAR(output_type) << "= lhs-rhs;" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::computeTemporaryTermsOrdered(int order, Model_Block *ModelBlock)
|
ModelTree::computeTemporaryTermsOrdered(int order, Model_Block *ModelBlock)
|
||||||
|
@ -389,7 +389,7 @@ ModelTree::computeTemporaryTermsOrdered(int order, Model_Block *ModelBlock)
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeModelEquationsOrdered_M( Model_Block *ModelBlock, const string &dynamic_basename) const
|
ModelTree::writeModelEquationsOrdered_M( Model_Block *ModelBlock, const string &dynamic_basename) const
|
||||||
{
|
{
|
||||||
int i,j,k,m;
|
int i,j,k,m;
|
||||||
string tmp_s, sps;
|
string tmp_s, sps;
|
||||||
ostringstream tmp_output, tmp1_output, global_output;
|
ostringstream tmp_output, tmp1_output, global_output;
|
||||||
|
@ -564,7 +564,7 @@ ModelTree::writeModelEquationsOrdered_M( Model_Block *ModelBlock, const string &
|
||||||
output << " residual(" << i+1 << ", it_) = (";
|
output << " residual(" << i+1 << ", it_) = (";
|
||||||
goto end;
|
goto end;
|
||||||
default:
|
default:
|
||||||
end:
|
end:
|
||||||
output << tmp_output.str();
|
output << tmp_output.str();
|
||||||
output << ") - (";
|
output << ") - (";
|
||||||
rhs->writeOutput(output, oMatlabDynamicModelSparse, temporary_terms);
|
rhs->writeOutput(output, oMatlabDynamicModelSparse, temporary_terms);
|
||||||
|
@ -860,11 +860,11 @@ end:
|
||||||
prev_Simulation_Type=ModelBlock->Block_List[j].Simulation_Type;
|
prev_Simulation_Type=ModelBlock->Block_List[j].Simulation_Type;
|
||||||
output.close();
|
output.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeModelStaticEquationsOrdered_M(Model_Block *ModelBlock, const string &static_basename) const
|
ModelTree::writeModelStaticEquationsOrdered_M(Model_Block *ModelBlock, const string &static_basename) const
|
||||||
{
|
{
|
||||||
int i,j,k,m, var, eq, g1_index = 1;
|
int i,j,k,m, var, eq, g1_index = 1;
|
||||||
string tmp_s, sps;
|
string tmp_s, sps;
|
||||||
ostringstream tmp_output, tmp1_output, global_output;
|
ostringstream tmp_output, tmp1_output, global_output;
|
||||||
|
@ -996,7 +996,7 @@ ModelTree::writeModelStaticEquationsOrdered_M(Model_Block *ModelBlock, const str
|
||||||
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
case SOLVE_TWO_BOUNDARIES_SIMPLE:
|
||||||
goto end;
|
goto end;
|
||||||
default:
|
default:
|
||||||
end:
|
end:
|
||||||
output << sps << "residual(" << i+1 << ") = (";
|
output << sps << "residual(" << i+1 << ") = (";
|
||||||
output << tmp_output.str();
|
output << tmp_output.str();
|
||||||
output << ") - (";
|
output << ") - (";
|
||||||
|
@ -1078,12 +1078,12 @@ end:
|
||||||
output.close();
|
output.close();
|
||||||
}
|
}
|
||||||
//output << "return;\n\n\n";
|
//output << "return;\n\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeModelEquationsCodeOrdered(const string file_name, const Model_Block *ModelBlock, const string bin_basename, ExprNodeOutputType output_type, map_idx_type map_idx) const
|
ModelTree::writeModelEquationsCodeOrdered(const string file_name, const Model_Block *ModelBlock, const string bin_basename, ExprNodeOutputType output_type, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
struct Uff_l
|
struct Uff_l
|
||||||
{
|
{
|
||||||
int u, var, lag;
|
int u, var, lag;
|
||||||
|
@ -1269,7 +1269,7 @@ ModelTree::writeModelEquationsCodeOrdered(const string file_name, const Model_Bl
|
||||||
Uf[v].Ufl=NULL;
|
Uf[v].Ufl=NULL;
|
||||||
goto end;
|
goto end;
|
||||||
default:
|
default:
|
||||||
end:
|
end:
|
||||||
lhs->compile(code_file,false, output_type, temporary_terms, map_idx);
|
lhs->compile(code_file,false, output_type, temporary_terms, map_idx);
|
||||||
rhs->compile(code_file,false, output_type, temporary_terms, map_idx);
|
rhs->compile(code_file,false, output_type, temporary_terms, map_idx);
|
||||||
code_file.write(&FBINARY, sizeof(FBINARY));
|
code_file.write(&FBINARY, sizeof(FBINARY));
|
||||||
|
@ -1464,12 +1464,12 @@ end:
|
||||||
code_file.write(&FENDBLOCK, sizeof(FENDBLOCK));
|
code_file.write(&FENDBLOCK, sizeof(FENDBLOCK));
|
||||||
code_file.write(&FEND, sizeof(FEND));
|
code_file.write(&FEND, sizeof(FEND));
|
||||||
code_file.close();
|
code_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeStaticMFile(const string &static_basename) const
|
ModelTree::writeStaticMFile(const string &static_basename) const
|
||||||
{
|
{
|
||||||
string filename = static_basename + ".m";
|
string filename = static_basename + ".m";
|
||||||
|
|
||||||
ofstream mStaticModelFile;
|
ofstream mStaticModelFile;
|
||||||
|
@ -1490,12 +1490,12 @@ ModelTree::writeStaticMFile(const string &static_basename) const
|
||||||
writeStaticModel(mStaticModelFile);
|
writeStaticModel(mStaticModelFile);
|
||||||
|
|
||||||
mStaticModelFile.close();
|
mStaticModelFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeDynamicMFile(const string &dynamic_basename) const
|
ModelTree::writeDynamicMFile(const string &dynamic_basename) const
|
||||||
{
|
{
|
||||||
string filename = dynamic_basename + ".m";
|
string filename = dynamic_basename + ".m";
|
||||||
|
|
||||||
ofstream mDynamicModelFile;
|
ofstream mDynamicModelFile;
|
||||||
|
@ -1515,11 +1515,11 @@ ModelTree::writeDynamicMFile(const string &dynamic_basename) const
|
||||||
writeDynamicModel(mDynamicModelFile);
|
writeDynamicModel(mDynamicModelFile);
|
||||||
|
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeStaticCFile(const string &static_basename) const
|
ModelTree::writeStaticCFile(const string &static_basename) const
|
||||||
{
|
{
|
||||||
string filename = static_basename + ".c";
|
string filename = static_basename + ".c";
|
||||||
|
|
||||||
ofstream mStaticModelFile;
|
ofstream mStaticModelFile;
|
||||||
|
@ -1580,11 +1580,11 @@ ModelTree::writeStaticCFile(const string &static_basename) const
|
||||||
<< "}" << endl;
|
<< "}" << endl;
|
||||||
|
|
||||||
mStaticModelFile.close();
|
mStaticModelFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeDynamicCFile(const string &dynamic_basename) const
|
ModelTree::writeDynamicCFile(const string &dynamic_basename) const
|
||||||
{
|
{
|
||||||
string filename = dynamic_basename + ".c";
|
string filename = dynamic_basename + ".c";
|
||||||
ofstream mDynamicModelFile;
|
ofstream mDynamicModelFile;
|
||||||
|
|
||||||
|
@ -1662,11 +1662,11 @@ ModelTree::writeDynamicCFile(const string &dynamic_basename) const
|
||||||
<< " Dynamic(y, x, nb_row_x, params, it_, residual, g1, g2);" << endl
|
<< " Dynamic(y, x, nb_row_x, params, it_, residual, g1, g2);" << endl
|
||||||
<< "}" << endl;
|
<< "}" << endl;
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeStaticModel(ostream &StaticOutput) const
|
ModelTree::writeStaticModel(ostream &StaticOutput) const
|
||||||
{
|
{
|
||||||
ostringstream model_output; // Used for storing model equations
|
ostringstream model_output; // Used for storing model equations
|
||||||
ostringstream jacobian_output; // Used for storing jacobian equations
|
ostringstream jacobian_output; // Used for storing jacobian equations
|
||||||
ostringstream hessian_output;
|
ostringstream hessian_output;
|
||||||
|
@ -1801,11 +1801,11 @@ ModelTree::writeStaticModel(ostream &StaticOutput) const
|
||||||
<< " }" << endl
|
<< " }" << endl
|
||||||
<< "}" << endl << endl;
|
<< "}" << endl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
ModelTree::reform(const string name1) const
|
ModelTree::reform(const string name1) const
|
||||||
{
|
{
|
||||||
string name=name1;
|
string name=name1;
|
||||||
int pos = name.find("\\", 0);
|
int pos = name.find("\\", 0);
|
||||||
while (pos >= 0)
|
while (pos >= 0)
|
||||||
|
@ -1819,12 +1819,12 @@ ModelTree::reform(const string name1) const
|
||||||
pos = name.find("\\", pos);
|
pos = name.find("\\", pos);
|
||||||
}
|
}
|
||||||
return (name);
|
return (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename, const int &num,
|
ModelTree::Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename, const int &num,
|
||||||
int &u_count_int, bool &file_open, bool is_two_boundaries) const
|
int &u_count_int, bool &file_open, bool is_two_boundaries) const
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
std::ofstream SaveCode;
|
std::ofstream SaveCode;
|
||||||
if (file_open)
|
if (file_open)
|
||||||
|
@ -1879,11 +1879,11 @@ ModelTree::Write_Inf_To_Bin_File(const string &dynamic_basename, const string &b
|
||||||
SaveCode.write(reinterpret_cast<char *>(&eqr1), sizeof(eqr1));
|
SaveCode.write(reinterpret_cast<char *>(&eqr1), sizeof(eqr1));
|
||||||
}
|
}
|
||||||
SaveCode.close();
|
SaveCode.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeSparseStaticMFile(const string &static_basename, const string &basename, const int mode) const
|
ModelTree::writeSparseStaticMFile(const string &static_basename, const string &basename, const int mode) const
|
||||||
{
|
{
|
||||||
string filename;
|
string filename;
|
||||||
ofstream mStaticModelFile;
|
ofstream mStaticModelFile;
|
||||||
ostringstream tmp, tmp1, tmp_eq;
|
ostringstream tmp, tmp1, tmp_eq;
|
||||||
|
@ -2099,11 +2099,11 @@ ModelTree::writeSparseStaticMFile(const string &static_basename, const string &b
|
||||||
writeModelStaticEquationsOrdered_M(block_triangular.ModelBlock, static_basename);
|
writeModelStaticEquationsOrdered_M(block_triangular.ModelBlock, static_basename);
|
||||||
mStaticModelFile.close();
|
mStaticModelFile.close();
|
||||||
chdir("..");
|
chdir("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string &basename, const int mode) const
|
ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string &basename, const int mode) const
|
||||||
{
|
{
|
||||||
string sp;
|
string sp;
|
||||||
ofstream mDynamicModelFile;
|
ofstream mDynamicModelFile;
|
||||||
ostringstream tmp, tmp1, tmp_eq;
|
ostringstream tmp, tmp1, tmp_eq;
|
||||||
|
@ -2454,11 +2454,11 @@ ModelTree::writeSparseDynamicMFile(const string &dynamic_basename, const string
|
||||||
writeModelEquationsOrdered_M( block_triangular.ModelBlock, dynamic_basename);
|
writeModelEquationsOrdered_M( block_triangular.ModelBlock, dynamic_basename);
|
||||||
|
|
||||||
chdir("..");
|
chdir("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeDynamicModel(ostream &DynamicOutput) const
|
ModelTree::writeDynamicModel(ostream &DynamicOutput) const
|
||||||
{
|
{
|
||||||
ostringstream lsymetric; // Used when writing symetric elements in Hessian
|
ostringstream lsymetric; // Used when writing symetric elements in Hessian
|
||||||
ostringstream model_output; // Used for storing model equations
|
ostringstream model_output; // Used for storing model equations
|
||||||
ostringstream jacobian_output; // Used for storing jacobian equations
|
ostringstream jacobian_output; // Used for storing jacobian equations
|
||||||
|
@ -2657,11 +2657,11 @@ ModelTree::writeDynamicModel(ostream &DynamicOutput) const
|
||||||
}
|
}
|
||||||
DynamicOutput << "}" << endl << endl;
|
DynamicOutput << "}" << endl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeOutput(ostream &output) const
|
ModelTree::writeOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
/* Writing initialisation for M_.lead_lag_incidence matrix
|
/* Writing initialisation for M_.lead_lag_incidence matrix
|
||||||
M_.lead_lag_incidence is a matrix with as many columns as there are
|
M_.lead_lag_incidence is a matrix with as many columns as there are
|
||||||
endogenous variables and as many rows as there are periods in the
|
endogenous variables and as many rows as there are periods in the
|
||||||
|
@ -2885,7 +2885,7 @@ ModelTree::writeOutput(ostream &output) const
|
||||||
}
|
}
|
||||||
if (symbol_table.parameter_nbr)
|
if (symbol_table.parameter_nbr)
|
||||||
output << "M_.params = repmat(NaN," << symbol_table.parameter_nbr << ", 1);\n";
|
output << "M_.params = repmat(NaN," << symbol_table.parameter_nbr << ", 1);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::addEquation(NodeID eq)
|
ModelTree::addEquation(NodeID eq)
|
||||||
|
@ -3019,7 +3019,7 @@ ModelTree::BlockLinear(Model_Block *ModelBlock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
follow:
|
follow:
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3069,7 +3069,7 @@ ModelTree::computingPass(const eval_context_type &eval_context, bool no_tmp_term
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeStaticFile(const string &basename) const
|
ModelTree::writeStaticFile(const string &basename) const
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case eStandardMode:
|
case eStandardMode:
|
||||||
|
@ -3091,11 +3091,11 @@ ModelTree::writeStaticFile(const string &basename) const
|
||||||
writeStaticCFile(basename + "_static");
|
writeStaticCFile(basename + "_static");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::writeDynamicFile(const string &basename) const
|
ModelTree::writeDynamicFile(const string &basename) const
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case eStandardMode:
|
case eStandardMode:
|
||||||
|
@ -3123,15 +3123,15 @@ ModelTree::writeDynamicFile(const string &basename) const
|
||||||
//block_triangular.Free_IM_X(block_triangular.First_IM_X);
|
//block_triangular.Free_IM_X(block_triangular.First_IM_X);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModelTree::matrixHelper(ostream &output, int eq_nb, int col_nb, ExprNodeOutputType output_type) const
|
ModelTree::matrixHelper(ostream &output, int eq_nb, int col_nb, ExprNodeOutputType output_type) const
|
||||||
{
|
{
|
||||||
output << LPAR(output_type);
|
output << LPAR(output_type);
|
||||||
if (OFFSET(output_type))
|
if (OFFSET(output_type))
|
||||||
output << eq_nb + 1 << ", " << col_nb + 1;
|
output << eq_nb + 1 << ", " << col_nb + 1;
|
||||||
else
|
else
|
||||||
output << eq_nb + col_nb * equations.size();
|
output << eq_nb + col_nb * equations.size();
|
||||||
output << RPAR(output_type);
|
output << RPAR(output_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Usefull documentation: Matlab 7 Mat-File Format
|
Usefull documentation: Matlab 7 Mat-File Format
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
||||||
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAT_FILE_HH
|
#ifndef _MAT_FILE_HH
|
||||||
|
@ -42,7 +42,7 @@ using namespace std;
|
||||||
|
|
||||||
|
|
||||||
enum Data_Type
|
enum Data_Type
|
||||||
{
|
{
|
||||||
miINT8 = 1, //8 bit, signed
|
miINT8 = 1, //8 bit, signed
|
||||||
miUINT8 = 2, //8 bit, unsigned
|
miUINT8 = 2, //8 bit, unsigned
|
||||||
miINT16 = 3, //16-bit, signed
|
miINT16 = 3, //16-bit, signed
|
||||||
|
@ -58,10 +58,10 @@ enum Data_Type
|
||||||
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
|
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
|
||||||
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
|
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
|
||||||
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
|
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Array_Type
|
enum Array_Type
|
||||||
{
|
{
|
||||||
Cell_array = 1,
|
Cell_array = 1,
|
||||||
Structure_ = 2,
|
Structure_ = 2,
|
||||||
Object_ = 3,
|
Object_ = 3,
|
||||||
|
@ -75,17 +75,17 @@ enum Array_Type
|
||||||
Unsigned_integer_16_bit = 11,
|
Unsigned_integer_16_bit = 11,
|
||||||
Signed_integer_32_bit = 12,
|
Signed_integer_32_bit = 12,
|
||||||
Unsigned_integer_32_bit = 13
|
Unsigned_integer_32_bit = 13
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum Function_Returned_Type
|
enum Function_Returned_Type
|
||||||
{
|
{
|
||||||
Numerical =1,
|
Numerical =1,
|
||||||
AlphaNumeric =2,
|
AlphaNumeric =2,
|
||||||
Matrix =3,
|
Matrix =3,
|
||||||
Compressed =4,
|
Compressed =4,
|
||||||
Unknown =5
|
Unknown =5
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArrayElem;
|
class ArrayElem;
|
||||||
class SimpleElem;
|
class SimpleElem;
|
||||||
|
@ -106,7 +106,7 @@ typedef struct Header
|
||||||
short int Version;
|
short int Version;
|
||||||
char Edian_Indicator[2];
|
char Edian_Indicator[2];
|
||||||
}
|
}
|
||||||
Header_t;
|
Header_t;
|
||||||
|
|
||||||
typedef struct Data_Header
|
typedef struct Data_Header
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ typedef struct Data_Header
|
||||||
ShortInt DataType;
|
ShortInt DataType;
|
||||||
uLongInt Number_of_Bytes;
|
uLongInt Number_of_Bytes;
|
||||||
}
|
}
|
||||||
Data_Header_t;
|
Data_Header_t;
|
||||||
|
|
||||||
typedef struct Array_Flag
|
typedef struct Array_Flag
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ typedef struct Array_Flag
|
||||||
char undef1[2];
|
char undef1[2];
|
||||||
uLongInt nzmax;
|
uLongInt nzmax;
|
||||||
}
|
}
|
||||||
Array_Flag_t;
|
Array_Flag_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct returned_ReadData
|
typedef struct returned_ReadData
|
||||||
|
@ -149,7 +149,7 @@ typedef struct CollectStruct
|
||||||
map<string,vector<string> > variable_string_name;
|
map<string,vector<string> > variable_string_name;
|
||||||
map<string,vector<double> > variable_double_name;
|
map<string,vector<double> > variable_double_name;
|
||||||
}
|
}
|
||||||
CollectStruct;
|
CollectStruct;
|
||||||
|
|
||||||
typedef vector<int> Array_Dimensions_t;
|
typedef vector<int> Array_Dimensions_t;
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ public:
|
||||||
|
|
||||||
class CellArray : public ArrayElem
|
class CellArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -303,7 +303,7 @@ class CellArray : public ArrayElem
|
||||||
|
|
||||||
class Structure : public ArrayElem
|
class Structure : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -312,7 +312,7 @@ class Structure : public ArrayElem
|
||||||
|
|
||||||
class Object : public ArrayElem
|
class Object : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -321,7 +321,7 @@ class Object : public ArrayElem
|
||||||
|
|
||||||
class CharacterArray : public ArrayElem
|
class CharacterArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -330,7 +330,7 @@ class CharacterArray : public ArrayElem
|
||||||
|
|
||||||
class SparseArray : public ArrayElem
|
class SparseArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -339,7 +339,7 @@ class SparseArray : public ArrayElem
|
||||||
|
|
||||||
class DoublePrecisionArray : public ArrayElem
|
class DoublePrecisionArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -348,7 +348,7 @@ class DoublePrecisionArray : public ArrayElem
|
||||||
|
|
||||||
class SinglePrecisionArray : public ArrayElem
|
class SinglePrecisionArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -357,7 +357,7 @@ class SinglePrecisionArray : public ArrayElem
|
||||||
|
|
||||||
class Bit8SignedInteger : public ArrayElem
|
class Bit8SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -366,7 +366,7 @@ class Bit8SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit8UnsignedInteger : public ArrayElem
|
class Bit8UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -375,7 +375,7 @@ class Bit8UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit16SignedInteger : public ArrayElem
|
class Bit16SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -384,7 +384,7 @@ class Bit16SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit16UnsignedInteger : public ArrayElem
|
class Bit16UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -393,7 +393,7 @@ class Bit16UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit32SignedInteger : public ArrayElem
|
class Bit32SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -402,7 +402,7 @@ class Bit32SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit32UnsignedInteger : public ArrayElem
|
class Bit32UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -412,7 +412,7 @@ class Bit32UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class MatlabFile
|
class MatlabFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Header_t header;
|
Header_t header;
|
||||||
vector<PSimpleElem> VSimpl;
|
vector<PSimpleElem> VSimpl;
|
||||||
MatlabFile();
|
MatlabFile();
|
||||||
|
|
Loading…
Reference in New Issue