Commit 8d7ff0e1 authored by sebastien's avatar sebastien
Browse files

v4 parser: removed old test directory


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1492 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 53822c7b
#include <iostream>
#include <list>
#include <sstream>
using namespace std;
#include "ComputingTasks.h"
int main(void)
{
TmpSymbolTable tst1, tst2;
SymbolTable st;
ComputingTasks ct;
tst1.AddTempSymbol("a");
tst1.AddTempSymbol("b");
tst1.AddTempSymbol("c");
tst1.AddTempSymbol("d");
tst1.AddTempSymbol("e");
tst2.AddTempSymbol("aa");
tst2.AddTempSymbol("bb");
tst2.AddTempSymbol("cc");
tst2.AddTempSymbol("dd");
tst2.AddTempSymbol("ee");
ct.Set();
ct.SetSteady();
ct.SetCheck();
ct.SetSimul();
ct.SetStochSimul(tst1);
ct.SetOption("o1", "o2");
ct.SetEstimationInit();
//ct.SetEstimation();
//ct.SetEstimation();
//ct.SetEstimation();
ct.SetCalibInit();
ct.SetCalibVariance();
ct.SetCalibCovariance();
ct.SetCalibAutoCorrelation();
ct.SetCalib();
ct.SetOsr(tst1);
ct.SetOlr(tst1,tst2);
ct.SetOptimWeightsInit();
ct.SetOptimWeights1();
ct.SetOptimWeights2();
ct.RunEstimation();
cout << ct.get();
}
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
#include "d_tab.h"
#include "Expression.h"
int main(void)
{
Expression exp;
exp.AddConstant("alpha");
exp.AddToken(0,eExogenous,EXP); //0
exp.AddToken(0,eParameter,0,eExogenousDet,PLUS); //1
exp.AddToken(0,eTempResult,UMINUS); //2
exp.AddToken(1,eExogenous,1,eTempResult,TIMES); //3
exp.AddToken(3,eTempResult,0,eNumericalConstant,TIMES); //4
exp.AddToken(4,eTempResult,0,eTempResult,COMMA); //5
exp.AddToken(5,eTempResult,0,eExogenous,COMMA); //6
exp.AddToken(6,eTempResult,"function1"); //7
cout << exp.get() << endl;
}
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
#include "d_tab.h"
#include "SymbolTable.h"
#include "VariableTable.h"
#include "ModelTree.h"
#include "NumericalConstants.h"
int main(void)
{
SymbolTable st;
VariableTable vt;
NumericalConstants nc;
ModelTree model;
vector<int> t(20);
//Adding 2 different symbols with AddSymbolDeclar
SymbolTable::AddSymbolDeclar("c",eExogenous);
//SymbolTable::PrintSymbolTable();
SymbolTable::AddSymbolDeclar("k",eEndogenous);
//SymbolTable::PrintSymbolTable();
SymbolTable::AddSymbolDeclar("aa",eParameter);
//SymbolTable::PrintSymbolTable();
SymbolTable::AddSymbolDeclar("x",eExogenous);
SymbolTable::AddSymbolDeclar("alph",eParameter);
SymbolTable::AddSymbolDeclar("delt",eParameter);
VariableTable::AddVariable("k",0);
VariableTable::AddVariable("x",0);
VariableTable::AddVariable("c",0);
//VariableTable::AddVariable("k",1);
//VariableTable::AddVariable("y",0);
t[0] = model.AddToken("aa");
t[1] = model.AddToken("x");
t[2] = model.AddToken("k");
t[3] = model.AddToken(Argument(t[0], eTempResult),
Argument(t[1], eTempResult), TIMES);
t[4] = model.AddToken("alph");
t[5] = model.AddToken(Argument(t[2], eTempResult),
Argument(t[4], eTempResult), POWER);
t[6] = model.AddToken(Argument(t[3], eTempResult),
Argument(t[5], eTempResult), TIMES);
t[7] = model.AddToken("delt");
//t[8] = model.AddToken("1");
t[9] = model.AddToken(Argument(1, eTempResult),
Argument(t[7], eTempResult), MINUS);
t[10] = model.AddToken(Argument(t[9], eTempResult),
Argument(t[2], eTempResult), TIMES);
t[11] = model.AddToken(Argument(t[2], eTempResult),
UMINUS);
t[12] = model.AddToken(Argument(t[11], eTempResult),
Argument(t[6], eTempResult), PLUS);
t[13] = model.AddToken(Argument(t[12], eTempResult),
Argument(t[10], eTempResult), PLUS);
t[14] = model.AddToken("c");
t[15] = model.AddToken(Argument(t[14], eTempResult),
Argument(t[13], eTempResult), EQUAL);
model.derive(2);
cout << model.getDynamicModel() << endl;
}
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
#include "d_tab.h"
#include "Expression.h"
#include "NumericalInitialization.h"
int main(void)
{
SymbolTable st;
Expression exp;
SymbolTable::AddSymbolDeclar("a",eExogenous);//0
SymbolTable::AddSymbolDeclar("b",eParameter);//1
SymbolTable::AddSymbolDeclar("c",eExogenous);//2
SymbolTable::AddSymbolDeclar("d",eExogenousDet);//3
SymbolTable::AddSymbolDeclar("x",eParameter);//3
SymbolTable::AddSymbolDeclar("y",eExogenous);//3
exp.AddConstant("alpha");
exp.AddToken(0,eExogenous,EXP); //0
exp.AddToken(0,eParameter,0,eExogenousDet,PLUS); //1
exp.AddToken(0,eTempResult,UMINUS); //2
exp.AddToken(1,eExogenous,1,eTempResult,TIMES); //3
exp.AddToken(3,eTempResult,0,eNumericalConstant,TIMES); //4
exp.AddToken(4,eTempResult,0,eTempResult,COMMA); //5
exp.AddToken(5,eTempResult,0,eExogenous,COMMA); //6
exp.AddToken(6,eTempResult,"function1"); //6
cout << exp.get();
//Testing if symbol exists
if (!SymbolTable::Exist("x"))
{
cout << "Error : Unknown parameter: " << "x" << endl;
exit(-1);
}
NumericalInitialization numinit;
numinit.SetConstant("x","ok");
numinit.InitInitval();
numinit.SetInit("y",exp.get());
numinit.EndInitval();
numinit.InitEndval();
numinit.EndEndval();
numinit.InitHistval();
numinit.SetHist("y",3, exp.get());
cout << numinit.get();
}
#include <string>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;
#include "SigmaeInitialization.h"
int main(void)
{
SigmaeInitialization siginit;
siginit.AddExpression("00");
siginit.EndOfRow();
siginit.AddExpression("10");
siginit.AddExpression("11");
siginit.EndOfRow();
siginit.AddExpression("20");
siginit.AddExpression("21");
siginit.AddExpression("22");
siginit.EndOfRow();
siginit.AddExpression("30");
siginit.AddExpression("31");
siginit.AddExpression("32");
siginit.AddExpression("33");
siginit.EndOfRow();
cout << siginit.get();
}
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#include "SymbolTable.h"
int main(void)
{
SymbolTable st;
ModelParameters mparams;
//Adding 3 different symbols with AddSymbolDeclar
cout << "\nTrying AddSymbolDeclar Symbol 1, RecursiveVariable";
SymbolTable::AddSymbolDeclar("Symbol 1",eRecursiveVariable);
SymbolTable::PrintSymbolTable();
cout << "\nTrying AddSymbolDeclar Symbol 2, ExogenousDet";
SymbolTable::AddSymbolDeclar("Symbol 2",eExogenousDet);
SymbolTable::PrintSymbolTable();
cout << "\nTrying AddSymbolDeclar Symbol 3, Endogenous";
SymbolTable::AddSymbolDeclar("Symbol 3",eEndogenous);
SymbolTable::PrintSymbolTable();
// Adding an existing symbol,same type, with AddSymbolDeclar
cout << "\nTrying AddSymbolDeclar Symbol 3, Endogenous";
SymbolTable::AddSymbolDeclar("Symbol 3", eEndogenous);
SymbolTable::PrintSymbolTable();
// Adding an existing symbol, type is different, with AddSymbolDeclar
cout << "\nTrying AddSymbolDeclar Symbol 3, Exogenous";
SymbolTable::AddSymbolDeclar("Symbol 3", eExogenous);
SymbolTable::PrintSymbolTable();
// Adding a new symbol with AddSymbolInline
cout << "\nTrying AddSymbolInline Symbol 4, RecursiveVariable";
SymbolTable::AddSymbolInline("Symbol 4",eRecursiveVariable);
SymbolTable::PrintSymbolTable();
// Adding an existing non referenced symbol,same type, with AddSymbolInline
cout << "\nTrying AddSymbolInline Symbol 2, ExogenousDet";
SymbolTable::AddSymbolInline("Symbol 2",eExogenousDet);
SymbolTable::PrintSymbolTable();
// Adding an existing non referenced symbol, type is different, with AddSymbolInline
cout << "\nTrying AddSymbolInline Symbol 1, Endogenous";
SymbolTable::AddSymbolInline("Symbol 1",eEndogenous);
SymbolTable::PrintSymbolTable();
// Adding an existing referenced symbol, same type, with AddSymbolInline
cout << "\nTrying AddSymbolInline Symbol 4, Exogenous";
SymbolTable::AddSymbolInline("Symbol 4",eExogenous);
SymbolTable::PrintSymbolTable();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment