Merge remote-tracking branch 'remotes/origin/master'

time-shift
Marco Ratto 2016-09-07 09:34:28 +02:00
commit 96bc8133e7
8 changed files with 27 additions and 19 deletions

View File

@ -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",
"EA"]}).
Note that there is no boolean type: @emph{false} is
represented by integer zero and @emph{true} is any non-null integer.
Note that there is no boolean type: @emph{false} is represented by integer zero
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:
@itemize

View File

@ -93,7 +93,7 @@ if nargin==11
end
fprintf(fidTeX,header_string);
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');
for i=1:size(values,1)
fprintf(fidTeX,label_format_leftbound,deblank(labels(i,:)));

View File

@ -85,6 +85,7 @@ if rplottype == 0
plot(ix(i),y(:,i)) ;
title (t,'Interpreter','none') ;
xlabel('Periods') ;
xlim([min(ix(i)) max(ix(i))])
if size(s1,1) > 1
if isoctave
legend(s1);
@ -101,6 +102,7 @@ elseif rplottype == 1
for j = 1:size(y,1)
hh=dyn_figure(options_,'Name',['Simulated Trajectory']);
plot(ix(i),y(j,i)) ;
xlim([min(ix(i)) max(ix(i))])
title(['Plot of ' s1(j,:)],'Interpreter','none') ;
xlabel('Periods') ;
dyn_saveas(hh,[M_.fname, filesep, 'graphs', filesep, 'SimulatedTrajectory_' deblank(s1(j,:))],options_)

View File

@ -2098,7 +2098,7 @@ ParsingDriver::plot_conditional_forecast(string *periods)
void
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();
}

View File

@ -352,8 +352,10 @@ MShocksStatement::writeOutput(ostream &output, const string &basename, bool mini
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),
symbol_table(symbol_table_arg),
path_length(-1)
{
}
@ -387,19 +389,13 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
int k = 1;
for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
it != paths.end(); it++)
it != paths.end(); it++, k++)
{
if (it == paths.begin())
{
output << "constrained_vars_ = " << it->first +1 << ";" << endl;
}
output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
else
{
output << "constrained_vars_ = [constrained_vars_; " << it->first +1 << "];" << endl;
}
output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
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);
output << ";" << endl;
}
k++;
}
}

View File

@ -94,9 +94,11 @@ class ConditionalForecastPathsStatement : public Statement
{
private:
const AbstractShocksStatement::det_shocks_t paths;
const SymbolTable &symbol_table;
int path_length;
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 writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2014 Dynare Team
* Copyright (C) 2008-2016 Dynare Team
*
* This file is part of Dynare.
*
@ -150,7 +150,12 @@ expr : INTEGER
| expr TIMES expr
{ TYPERR_CATCH($$ = *$1 * *$3, @$); }
| 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
{ TYPERR_CATCH($$ = *$1 < *$3, @$); }
| expr GREATER expr

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2013 Dynare Team
* Copyright (C) 2008-2016 Dynare Team
*
* This file is part of Dynare.
*
@ -158,6 +158,7 @@ public:
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);
inline int get_int_value() const { return value; };
};
//! Represents a string value in macro language