Merge remote-tracking branch 'remotes/origin/master'
commit
96bc8133e7
|
@ -9699,8 +9699,11 @@ String literals have to be enclosed between @strong{double} quotes
|
||||||
elements are separated by commas (like @code{[1,2,3]} or @code{["US",
|
elements are separated by commas (like @code{[1,2,3]} or @code{["US",
|
||||||
"EA"]}).
|
"EA"]}).
|
||||||
|
|
||||||
Note that there is no boolean type: @emph{false} is
|
Note that there is no boolean type: @emph{false} is represented by integer zero
|
||||||
represented by integer zero and @emph{true} is any non-null integer.
|
and @emph{true} is any non-null integer. Further note that, as the
|
||||||
|
macro-processor cannot handle non-integer real numbers, integer division
|
||||||
|
results in the quotient with the fractional part truncated (hence,
|
||||||
|
@math{5/3=3/3=1}).
|
||||||
|
|
||||||
The following operators can be used on integers:
|
The following operators can be used on integers:
|
||||||
@itemize
|
@itemize
|
||||||
|
|
|
@ -93,7 +93,7 @@ if nargin==11
|
||||||
end
|
end
|
||||||
fprintf(fidTeX,header_string);
|
fprintf(fidTeX,header_string);
|
||||||
fprintf(fidTeX,'\\midrule \\endhead \n');
|
fprintf(fidTeX,'\\midrule \\endhead \n');
|
||||||
fprintf(fidTeX,['\\bottomrule \\multicolumn{',num2str(size(headers,1)),'}{r}{(Continued on next page)} \\\\ \\hline \\endfoot \n']);
|
fprintf(fidTeX,['\\midrule \\multicolumn{',num2str(size(headers,1)),'}{r}{(Continued on next page)} \\\\ \\bottomrule \\endfoot \n']);
|
||||||
fprintf(fidTeX,'\\bottomrule \\endlastfoot \n');
|
fprintf(fidTeX,'\\bottomrule \\endlastfoot \n');
|
||||||
for i=1:size(values,1)
|
for i=1:size(values,1)
|
||||||
fprintf(fidTeX,label_format_leftbound,deblank(labels(i,:)));
|
fprintf(fidTeX,label_format_leftbound,deblank(labels(i,:)));
|
||||||
|
|
|
@ -85,6 +85,7 @@ if rplottype == 0
|
||||||
plot(ix(i),y(:,i)) ;
|
plot(ix(i),y(:,i)) ;
|
||||||
title (t,'Interpreter','none') ;
|
title (t,'Interpreter','none') ;
|
||||||
xlabel('Periods') ;
|
xlabel('Periods') ;
|
||||||
|
xlim([min(ix(i)) max(ix(i))])
|
||||||
if size(s1,1) > 1
|
if size(s1,1) > 1
|
||||||
if isoctave
|
if isoctave
|
||||||
legend(s1);
|
legend(s1);
|
||||||
|
@ -101,6 +102,7 @@ elseif rplottype == 1
|
||||||
for j = 1:size(y,1)
|
for j = 1:size(y,1)
|
||||||
hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
|
hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
|
||||||
plot(ix(i),y(j,i)) ;
|
plot(ix(i),y(j,i)) ;
|
||||||
|
xlim([min(ix(i)) max(ix(i))])
|
||||||
title(['Plot of ' s1(j,:)],'Interpreter','none') ;
|
title(['Plot of ' s1(j,:)],'Interpreter','none') ;
|
||||||
xlabel('Periods') ;
|
xlabel('Periods') ;
|
||||||
dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(j,:))],options_)
|
dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(j,:))],options_)
|
||||||
|
|
|
@ -2098,7 +2098,7 @@ ParsingDriver::plot_conditional_forecast(string *periods)
|
||||||
void
|
void
|
||||||
ParsingDriver::conditional_forecast_paths()
|
ParsingDriver::conditional_forecast_paths()
|
||||||
{
|
{
|
||||||
mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks));
|
mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks, mod_file->symbol_table));
|
||||||
det_shocks.clear();
|
det_shocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,8 +352,10 @@ MShocksStatement::writeOutput(ostream &output, const string &basename, bool mini
|
||||||
writeDetShocks(output);
|
writeDetShocks(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg) :
|
ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
|
||||||
|
const SymbolTable &symbol_table_arg) :
|
||||||
paths(paths_arg),
|
paths(paths_arg),
|
||||||
|
symbol_table(symbol_table_arg),
|
||||||
path_length(-1)
|
path_length(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -387,19 +389,13 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
||||||
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
|
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
|
||||||
|
|
||||||
int k = 1;
|
int k = 1;
|
||||||
|
|
||||||
for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
|
for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
|
||||||
it != paths.end(); it++)
|
it != paths.end(); it++, k++)
|
||||||
{
|
{
|
||||||
if (it == paths.begin())
|
if (it == paths.begin())
|
||||||
{
|
output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
|
||||||
output << "constrained_vars_ = " << it->first +1 << ";" << endl;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
|
||||||
output << "constrained_vars_ = [constrained_vars_; " << it->first +1 << "];" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
|
const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
|
||||||
for (int i = 0; i < (int) elems.size(); i++)
|
for (int i = 0; i < (int) elems.size(); i++)
|
||||||
|
@ -409,7 +405,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
||||||
elems[i].value->writeOutput(output);
|
elems[i].value->writeOutput(output);
|
||||||
output << ";" << endl;
|
output << ";" << endl;
|
||||||
}
|
}
|
||||||
k++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,11 @@ class ConditionalForecastPathsStatement : public Statement
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const AbstractShocksStatement::det_shocks_t paths;
|
const AbstractShocksStatement::det_shocks_t paths;
|
||||||
|
const SymbolTable &symbol_table;
|
||||||
int path_length;
|
int path_length;
|
||||||
public:
|
public:
|
||||||
ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg);
|
ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
|
||||||
|
const SymbolTable &symbol_table_arg);
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2008-2014 Dynare Team
|
* Copyright (C) 2008-2016 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -150,7 +150,12 @@ expr : INTEGER
|
||||||
| expr TIMES expr
|
| expr TIMES expr
|
||||||
{ TYPERR_CATCH($$ = *$1 * *$3, @$); }
|
{ TYPERR_CATCH($$ = *$1 * *$3, @$); }
|
||||||
| expr DIVIDE expr
|
| expr DIVIDE expr
|
||||||
{ TYPERR_CATCH($$ = *$1 / *$3, @$); }
|
{
|
||||||
|
if (dynamic_cast<const IntMV *>($3) != NULL
|
||||||
|
&& ((IntMV *)$3)->get_int_value() == 0)
|
||||||
|
driver.error(@$, "Division by zero");
|
||||||
|
TYPERR_CATCH($$ = *$1 / *$3, @$);
|
||||||
|
}
|
||||||
| expr LESS expr
|
| expr LESS expr
|
||||||
{ TYPERR_CATCH($$ = *$1 < *$3, @$); }
|
{ TYPERR_CATCH($$ = *$1 < *$3, @$); }
|
||||||
| expr GREATER expr
|
| expr GREATER expr
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2008-2013 Dynare Team
|
* Copyright (C) 2008-2016 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -158,6 +158,7 @@ public:
|
||||||
If mv2 < mv1, returns an empty range (for consistency with MATLAB).
|
If mv2 < mv1, returns an empty range (for consistency with MATLAB).
|
||||||
*/
|
*/
|
||||||
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
|
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
|
||||||
|
inline int get_int_value() const { return value; };
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Represents a string value in macro language
|
//! Represents a string value in macro language
|
||||||
|
|
Loading…
Reference in New Issue