Update: k_ord_dynare.cpp that prints the order when running ReorderDynareJacobianIndice
and k_order_perturbation with MAT file printout git-svn-id: https://www.dynare.org/svn/dynare/trunk@2380 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
88afe87f0c
commit
e247e3ef0b
|
@ -402,6 +402,10 @@ Vector * KordpDynare::LLxSteady( const Vector& yS){
|
||||||
mexPrintf(" Error in LLxSteady - wrong index?");
|
mexPrintf(" Error in LLxSteady - wrong index?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
for (int j=0;j<nJcols-nExog;j++)
|
||||||
|
mexPrintf("LLxSteady: [%d] =%f .\n", j, (*llxSteady)[j]);
|
||||||
|
#endif
|
||||||
return llxSteady;
|
return llxSteady;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,39 +269,43 @@ extern "C" {
|
||||||
else
|
else
|
||||||
irf_list_ind = ((const DynareNameList&)dynare.getExogNames()).selectIndices(params.irf_list);
|
irf_list_ind = ((const DynareNameList&)dynare.getExogNames()).selectIndices(params.irf_list);
|
||||||
****************/
|
****************/
|
||||||
try {
|
|
||||||
// intiate tensor library
|
// intiate tensor library
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mexPrintf("k_order_perturbation: Call tls init\n");
|
mexPrintf("k_order_perturbation: Call tls init\n");
|
||||||
#endif
|
#endif
|
||||||
tls.init(dynare.order(),
|
tls.init(dynare.order(),
|
||||||
dynare.nstat()+2*dynare.npred()+3*dynare.nboth()+
|
dynare.nstat()+2*dynare.npred()+3*dynare.nboth()+
|
||||||
2*dynare.nforw()+dynare.nexog());
|
2*dynare.nforw()+dynare.nexog());
|
||||||
|
|
||||||
// construct main K-order approximation class
|
// construct main K-order approximation class
|
||||||
// FistOrderApproximation app(dynare, journal, nSteps);
|
// FistOrderApproximation app(dynare, journal, nSteps);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mexPrintf("k_order_perturbation: Call Approximation constructor \n");
|
mexPrintf("k_order_perturbation: Call Approximation constructor \n");
|
||||||
#endif
|
#endif
|
||||||
Approximation app(dynare, journal, nSteps);
|
Approximation app(dynare, journal, nSteps);
|
||||||
// run stochastic steady
|
// run stochastic steady
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mexPrintf("k_order_perturbation: Calling walkStochSteady.\n");
|
mexPrintf("k_order_perturbation: Calling walkStochSteady.\n");
|
||||||
#endif
|
#endif
|
||||||
app.walkStochSteady();
|
app.walkStochSteady();
|
||||||
|
|
||||||
} catch (const KordException& e) {
|
// open mat file
|
||||||
// tell about the exception and continue
|
std::string matfile(fName);//(params.basename);
|
||||||
printf("Caught (not yet fatal) Kord exception: ");
|
matfile += ".mat";
|
||||||
e.print();
|
FILE* matfd = NULL;
|
||||||
JournalRecord rec(journal);
|
if (NULL == (matfd=fopen(matfile.c_str(), "wb"))) {
|
||||||
rec << "Solution routine not finished (" << e.get_message()
|
fprintf(stderr, "Couldn't open %s for writing.\n", matfile.c_str());
|
||||||
<< "), see what happens" << endrec;
|
exit(1);
|
||||||
} catch (const TLException& e) {
|
}
|
||||||
mexErrMsgTxt("Caugth TL exception.");
|
|
||||||
} catch (SylvException& e) {
|
std::string ss_matrix_name(fName);//params.prefix);
|
||||||
mexErrMsgTxt("Caught Sylv exception.");
|
ss_matrix_name += "_steady_states";
|
||||||
}
|
ConstTwoDMatrix(app.getSS()).writeMat4(matfd, ss_matrix_name.c_str());
|
||||||
|
|
||||||
|
// write the folded decision rule to the Mat-4 file
|
||||||
|
app.getFoldDecisionRule().writeMat4(matfd, fName);//params.prefix);
|
||||||
|
|
||||||
|
fclose(matfd);
|
||||||
|
|
||||||
/***********************
|
/***********************
|
||||||
std::string ss_matrix_name("K_ordp");//params.prefix);
|
std::string ss_matrix_name("K_ordp");//params.prefix);
|
||||||
|
|
|
@ -215,8 +215,7 @@ int main(int argc, char* argv[])
|
||||||
mexPrintf("k_order_perturbation: Calling walkStochSteady.\n");
|
mexPrintf("k_order_perturbation: Calling walkStochSteady.\n");
|
||||||
#endif
|
#endif
|
||||||
app.walkStochSteady();
|
app.walkStochSteady();
|
||||||
|
|
||||||
|
|
||||||
// open mat file
|
// open mat file
|
||||||
std::string matfile(fName);//(params.basename);
|
std::string matfile(fName);//(params.basename);
|
||||||
matfile += ".mat";
|
matfile += ".mat";
|
||||||
|
|
Loading…
Reference in New Issue