just formatting changes
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2659 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
aa3b7c78f3
commit
473b4d9a2f
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// GP, based on work by O.Kamenik
|
||||
|
||||
|
@ -75,7 +75,6 @@ KordpDynare::KordpDynare(const char** endo, int num_endo,
|
|||
FSSparseTensor* t = new FSSparseTensor(iord, nY+nYs+nYss+nExog,nY);
|
||||
md.insert(t);
|
||||
}
|
||||
|
||||
}
|
||||
catch (...){
|
||||
mexPrintf("k_ord_dynare: dynare constructor, error in StateNamelist construction.\n");
|
||||
|
@ -120,7 +119,7 @@ KordpDynare::~KordpDynare()
|
|||
|
||||
|
||||
/** This clears the container of model derivatives and initializes it
|
||||
* inserting empty sparse tensors up to the given order. */
|
||||
* inserting empty sparse tensors up to the given order. */
|
||||
ModelDerivativeContainer::ModelDerivativeContainer(const KordpDynare& model,
|
||||
TensorContainer<FSSparseTensor>& mod_ders, int order): md(mod_ders)
|
||||
{
|
||||
|
@ -211,7 +210,7 @@ void KordpDynare::calcDerivatives(const Vector& yy, const Vector& xx)
|
|||
dynamicDLL.eval( llxYY, xx, //int nb_row_x,
|
||||
params, //int it_,
|
||||
out, g1, g2);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
catch (...){
|
||||
mexPrintf("k_ord_dynare.cpp: Error in dynamicDLL.eval in calcDerivatives");
|
||||
|
@ -232,10 +231,6 @@ void KordpDynare::calcDerivatives(const Vector& yy, const Vector& xx)
|
|||
/* This version is not currently in use */
|
||||
void KordpDynare::calcDerivatives(const Vector& yy, ogu::Jacobian& jacob)
|
||||
{
|
||||
// ConstVector yym(yy, nstat(), nys());
|
||||
// ConstVector yyp(yy, nstat()+npred(), nyss());
|
||||
|
||||
// Vector yyp(yy, nstat()+npred(), nyss());
|
||||
|
||||
//double *g1, *g2;
|
||||
TwoDMatrix * jj= &jacob;
|
||||
|
@ -409,16 +404,16 @@ Vector * KordpDynare::LLxSteady( const Vector& yS){
|
|||
* any the extra columns for exogenous vars, and then,
|
||||
* reorders its blocks given by the varOrder and the Dynare++ expectations:
|
||||
|
||||
* extra nboth+ npred (t-1) lags
|
||||
* varOrder
|
||||
* extra nboth+ npred (t-1) lags
|
||||
* varOrder
|
||||
static:
|
||||
pred
|
||||
both
|
||||
forward
|
||||
* extra both + nforw (t+1) leads, and
|
||||
* extra exogen
|
||||
* extra both + nforw (t+1) leads, and
|
||||
* extra exogen
|
||||
|
||||
* so to match the jacobian organisation expected by the Appoximation class
|
||||
* so to match the jacobian organisation expected by the Appoximation class
|
||||
both + nforw (t+1) leads
|
||||
static
|
||||
pred
|
||||
|
@ -429,13 +424,9 @@ Vector * KordpDynare::LLxSteady( const Vector& yS){
|
|||
************************************/
|
||||
|
||||
vector<int> * KordpDynare::ReorderDynareJacobianIndices( const vector<int> * varOrder){
|
||||
// if ((nJcols != tdx->ncols()) && ( nY != tdx->nrows())) {
|
||||
// mexPrintf("k_ord_dynare.cpp: Error in ReorderBlocks: wrong size of jacobian");
|
||||
// return;
|
||||
// }
|
||||
// create temporary square 2D matrix size nEndo x nEndo (sparse)
|
||||
// for the lag, current and lead blocks of the jacobian
|
||||
// int * JacobianIndices = (int*) calloc(nJcols+1, sizeof(int));
|
||||
// int * JacobianIndices = (int*) calloc(nJcols+1, sizeof(int));
|
||||
vector<int> * JacobianIndices = new vector<int>(nJcols);
|
||||
vector <int> tmp(nY);
|
||||
int i,j, rjoff=nJcols-nExog-1; //, ll_off, j;
|
||||
|
@ -448,7 +439,7 @@ vector<int> * KordpDynare::ReorderDynareJacobianIndices( const vector<int> * var
|
|||
// reorder in orde-var order & populate temporary nEndo (sparse) vector with
|
||||
// the lag, current and lead blocks of the jacobian respectively
|
||||
for (i=0;i<nY;i++){
|
||||
// tmp[varOrder[j]]=(int)ll_Incidence->get(ll_row,j);
|
||||
// tmp[varOrder[j]]=(int)ll_Incidence->get(ll_row,j);
|
||||
tmp[i]=((int)ll_Incidence->get(ll_row,(*varOrder)[i]-1));
|
||||
#ifdef DEBUG
|
||||
mexPrintf("get(ll_row,(*varOrder)[%d]-1)) = tmp[%d]=%d .\n",
|
||||
|
@ -586,7 +577,7 @@ void KordpDynare::ReorderBlocks(TwoDMatrix * tdx, const vector<int> * vOrder){
|
|||
* K-Order Perturbation instance of Jacobian:
|
||||
************************************/
|
||||
KordpJacobian::KordpJacobian(KordpDynare& dyn)
|
||||
: Jacobian(dyn.ny()), dyn(dyn)
|
||||
: Jacobian(dyn.ny()), dyn(dyn)
|
||||
{
|
||||
zeros();
|
||||
};
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Ondra Kamenik
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2005 Ondra Kamenik
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// based on: $Id: dynare3.h 1764 2008-03-31 14:30:55Z kamenik $
|
||||
// by 2005, Ondra Kamenik
|
||||
|
@ -41,34 +41,6 @@
|
|||
|
||||
class KordpDynare;
|
||||
|
||||
// derive from Approximation to get protected derivatives
|
||||
/******
|
||||
class FistOrderApproximation: public Approximation{
|
||||
TwoDMatrix *gy;
|
||||
TwoDMatrix *gu;
|
||||
public:
|
||||
FistOrderApproximation();
|
||||
FistOrderApproximation(FistOrderApproximation& fo): ::Approximation(fo){
|
||||
if (&(fo.GetGy())!=0){
|
||||
gy= new TwoDMatrix(fo.GetGy());
|
||||
gu= new TwoDMatrix(fo.GetGu());
|
||||
}
|
||||
};
|
||||
virtual ~FistOrderApproximation(){
|
||||
delete gy;
|
||||
delete gu;
|
||||
};
|
||||
virtual void approxAtSteady(); // NOTE: change the Approximation parent to use virual too so that it can be overriden !!
|
||||
//FGSContainer* GetRuleDers(){return rule_ders;};
|
||||
//FGSContainer* GetRuleDersSS(){return rule_ders_ss;};
|
||||
const TwoDMatrix& GetGy(){return (const TwoDMatrix&)(*gy);};
|
||||
const TwoDMatrix& GetGu(){return (const TwoDMatrix&)(*gu);};
|
||||
virtual void saveRuleDerivs(FirstOrder& fo);
|
||||
};
|
||||
***********/
|
||||
|
||||
|
||||
|
||||
/*////////////////////////////////////////////*/
|
||||
// instantiations of pure abstract class NameList in dynamic_model.h:
|
||||
/*////////////////////////////////////////////*/
|
||||
|
@ -79,10 +51,10 @@ public:
|
|||
DynareNameList(const KordpDynare& dynare, const char ** names);
|
||||
int getNum() const {return (int)names.size();}
|
||||
const char* getName(int i) const {return names[i];}
|
||||
/** This for each string of the input vector calculates its index
|
||||
* in the names. And returns the resulting vector of indices. If
|
||||
* the name cannot be found, then an exception is raised. */
|
||||
vector<int> selectIndices(const vector<const char*>& ns) const;
|
||||
/** This for each string of the input vector calculates its index
|
||||
* in the names. And returns the resulting vector of indices. If
|
||||
* the name cannot be found, then an exception is raised. */
|
||||
vector<int> selectIndices(const vector<const char*>& ns) const;
|
||||
};
|
||||
|
||||
class DynareExogNameList : public NameList {
|
||||
|
@ -112,11 +84,11 @@ public:
|
|||
//class DynamicModelDLL;
|
||||
class KordpJacobian;
|
||||
class KordpDynare : public DynamicModel {
|
||||
friend class DynareNameList;
|
||||
friend class DynareExogNameList;
|
||||
friend class DynareStateNameList;
|
||||
friend class KordpDynareJacobian;
|
||||
friend class DynamicModelDLL;
|
||||
friend class DynareNameList;
|
||||
friend class DynareExogNameList;
|
||||
friend class DynareStateNameList;
|
||||
friend class KordpDynareJacobian;
|
||||
friend class DynamicModelDLL;
|
||||
//////////
|
||||
const int nStat;
|
||||
const int nBoth;
|
||||
|
@ -194,8 +166,6 @@ public:
|
|||
{return *ySteady;}
|
||||
Vector& getSteady()
|
||||
{return *ySteady;}
|
||||
/// const ogdyn::DynareModel& getModel() const
|
||||
/// {return *model;}
|
||||
|
||||
// here is true public interface
|
||||
void solveDeterministicSteady(Vector& steady);
|
||||
|
@ -233,7 +203,7 @@ private:
|
|||
class ModelDerivativeContainer //: public ogp::FormulaDerEvalLoader
|
||||
{
|
||||
protected:
|
||||
// const ogp::FineAtoms& atoms;
|
||||
// const ogp::FineAtoms& atoms;
|
||||
TensorContainer<FSSparseTensor>& md;
|
||||
public:
|
||||
ModelDerivativeContainer(const KordpDynare& model, TensorContainer<FSSparseTensor>& mod_ders,
|
||||
|
@ -241,31 +211,31 @@ public:
|
|||
void load(int i, int iord, const int* vars, double res);
|
||||
};
|
||||
|
||||
/****************************
|
||||
* K-Order Perturbation instance of Jacobian:
|
||||
************************************/
|
||||
/****************************
|
||||
* K-Order Perturbation instance of Jacobian:
|
||||
************************************/
|
||||
|
||||
class KordpJacobian : public ogu::Jacobian ///, public ogp::FormulaDerEvalLoader
|
||||
{
|
||||
protected:
|
||||
class KordpJacobian : public ogu::Jacobian ///, public ogp::FormulaDerEvalLoader
|
||||
{
|
||||
protected:
|
||||
KordpDynare& dyn;
|
||||
public:
|
||||
public:
|
||||
KordpJacobian( KordpDynare& dyn);
|
||||
virtual ~KordpJacobian() {}
|
||||
// Load <mod>_dynamic.DLL
|
||||
// void load(const char** modName);
|
||||
// void load(const char** modName);
|
||||
void eval(const Vector& in);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/****************************
|
||||
* K-Order Perturbation instance of VectorFunction:
|
||||
************************************/
|
||||
/****************************
|
||||
* K-Order Perturbation instance of VectorFunction:
|
||||
************************************/
|
||||
|
||||
class KordpVectorFunction : public ogu::VectorFunction {
|
||||
protected:
|
||||
class KordpVectorFunction : public ogu::VectorFunction {
|
||||
protected:
|
||||
KordpDynare& d;
|
||||
public:
|
||||
public:
|
||||
KordpVectorFunction( KordpDynare& dyn)
|
||||
: d(dyn) {}
|
||||
virtual ~KordpVectorFunction() {}
|
||||
|
@ -274,10 +244,7 @@ public:
|
|||
int outDim() const
|
||||
{return d.ny();}
|
||||
void eval(const ConstVector& in, Vector& out);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/******************************************************
|
||||
// k_order_perturbation.cpp : Defines the entry point for the k-order perturbation application DLL.
|
||||
|
@ -134,8 +134,8 @@ extern "C" {
|
|||
mexPrintf("k_ord_perturbation: qz_criterium=%g, nParams=%d .\n",qz_criterium,npar);
|
||||
for (int i = 0; i < npar; i++) {
|
||||
mexPrintf("k_ord_perturbation: Params[%d]= %g.\n", i, (*modParams)[i]); }
|
||||
// for (int i = 0; i < npar; i++) {
|
||||
// mexPrintf("k_ord_perturbation: params_vec[%d]= %g.\n", i, params_vec[i] ); }
|
||||
// for (int i = 0; i < npar; i++) {
|
||||
// mexPrintf("k_ord_perturbation: params_vec[%d]= %g.\n", i, params_vec[i] ); }
|
||||
#endif
|
||||
|
||||
mxFldp = mxGetField(M_, 0,"Sigma_e" );
|
||||
|
@ -144,9 +144,9 @@ extern "C" {
|
|||
TwoDMatrix * vCov = new TwoDMatrix(npar, npar, dparams);
|
||||
|
||||
|
||||
// mxFldp = mxGetField(oo_, 0,"steady_state" ); // use in order of declaration
|
||||
// mxFldp = mxGetField(oo_, 0,"steady_state" ); // use in order of declaration
|
||||
mxFldp = mxGetField(dr, 0,"ys" ); // and not in order of dr.order_var
|
||||
// mxFldp = mxGetField(oo_, 0,"dyn_ys" ); // and NOT extended ys
|
||||
// mxFldp = mxGetField(oo_, 0,"dyn_ys" ); // and NOT extended ys
|
||||
dparams = (double *) mxGetData(mxFldp);
|
||||
const int nSteady = (int)mxGetM(mxFldp);
|
||||
Vector * ySteady = new Vector(dparams, nSteady);
|
||||
|
@ -244,8 +244,8 @@ extern "C" {
|
|||
#ifdef DEBUG
|
||||
for (int i = 0; i < nEndo; i++) {
|
||||
mexPrintf("k_ord_perturbation: EndoNameList[%d]= %s.\n", i, endoNamesMX[i] ); }
|
||||
// for (int i = 0; i < nPar; i++) {
|
||||
// mexPrintf("k_ord_perturbation: Params[%d]= %g.\n", i, (*modParams)[i]); }
|
||||
// for (int i = 0; i < nPar; i++) {
|
||||
// mexPrintf("k_ord_perturbation: Params[%d]= %g.\n", i, (*modParams)[i]); }
|
||||
for (int i = 0; i < nSteady; i++) {
|
||||
mexPrintf("k_ord_perturbation: ysteady[%d]= %g.\n", i, (*ySteady)[i]); }
|
||||
|
||||
|
@ -309,7 +309,7 @@ extern "C" {
|
|||
|
||||
std::string ss_matrix_name(fName);//params.prefix);
|
||||
ss_matrix_name += "_steady_states";
|
||||
// ConstTwoDMatrix(app.getSS()).writeMat4(matfd, ss_matrix_name.c_str());
|
||||
// ConstTwoDMatrix(app.getSS()).writeMat4(matfd, ss_matrix_name.c_str());
|
||||
ss.writeMat4(matfd, ss_matrix_name.c_str());
|
||||
|
||||
// write the folded decision rule to the Mat-4 file
|
||||
|
@ -353,7 +353,7 @@ extern "C" {
|
|||
TwoDMatrix tmp_ss(nEndo,1, mxGetPr(plhs[0]));
|
||||
tmp_ss = (const TwoDMatrix&)ss;
|
||||
#ifdef DEBUG
|
||||
// tmp_ss.print(); !! This print Crashes???
|
||||
// tmp_ss.print(); !! This print Crashes???
|
||||
#endif
|
||||
}
|
||||
if (nlhs >= 2)
|
||||
|
@ -427,8 +427,8 @@ extern "C" {
|
|||
e.print(errfd);
|
||||
fclose(errfd);
|
||||
return;// 255;
|
||||
}
|
||||
};
|
||||
} //catch
|
||||
}; // end of mexFunction()
|
||||
}; // end of extern C
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
@ -447,7 +447,7 @@ const char ** DynareMxArrayToString(const char * cNamesCharStr,const int len,con
|
|||
{
|
||||
char cNamesMX[len][width+1] ;//
|
||||
#ifdef DEBUG
|
||||
mexPrintf("loop DynareMxArrayToString cNamesCharStr = %s \n", cNamesCharStr);
|
||||
mexPrintf("loop DynareMxArrayToString cNamesCharStr = %s \n", cNamesCharStr);
|
||||
#endif
|
||||
for (int i=0;i<width;i++){
|
||||
for (int j=0;j<len;j++){
|
||||
|
@ -462,7 +462,7 @@ mexPrintf("loop DynareMxArrayToString cNamesCharStr = %s \n", cNamesCharStr);
|
|||
for (int j=0;j<len;j++){
|
||||
cNamesMX[j][width]='\0';
|
||||
#ifdef DEBUG
|
||||
// mexPrintf("String [%d]= %s \n", j, cNamesMX[j]);
|
||||
// mexPrintf("String [%d]= %s \n", j, cNamesMX[j]);
|
||||
#endif
|
||||
char * token= (char*) mxCalloc ( strlen(cNamesMX[j])+1,sizeof(char));
|
||||
strcpy (token, cNamesMX[j]);
|
||||
|
@ -495,7 +495,7 @@ DynamicModelDLL::DynamicModelDLL(const char * modName, const int y_length, const
|
|||
#ifdef WINDOWS
|
||||
if (sExt==NULL) sExt=(".dll");
|
||||
HINSTANCE dynamicHinstance;
|
||||
// dynamicHinstance=::LoadLibraryEx(strcat(fNname,"_.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);//sExt); //"_.dll");
|
||||
// dynamicHinstance=::LoadLibraryEx(strcat(fNname,"_.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);//sExt); //"_.dll");
|
||||
dynamicHinstance=::LoadLibrary(strcat(fName,sExt));//.dll); //"_.dll");
|
||||
if (dynamicHinstance==NULL)
|
||||
throw 1; //alt: return;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the K_ORDER_PERTURBATION_EXPORTS
|
||||
|
@ -42,9 +42,9 @@
|
|||
|
||||
// <model>_Dynamic DLL pointer
|
||||
#ifdef WINDOWS
|
||||
typedef void *(DynamicFn)
|
||||
typedef void *(DynamicFn)
|
||||
#else // linux
|
||||
typedef void (*DynamicFn)
|
||||
typedef void (*DynamicFn)
|
||||
#endif
|
||||
(double *y, double *x, int nb_row_x, double *params,
|
||||
int it_, double *residual, double *g1, double *g2);
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
const int jcols; // tot num var t-1, t and t+1 instances + exogs = Num of Jacobian columns
|
||||
const int nMax_lag; // no of lags
|
||||
const int nExog; // no of exogenous
|
||||
// const char * sExt; // dynamic file extension: dll, mexw32, ...
|
||||
// const char * sExt; // dynamic file extension: dll, mexw32, ...
|
||||
#ifdef WINDOWS
|
||||
HINSTANCE dynamicHinstance; // DLL instance pointer in Windows
|
||||
# else // linux
|
||||
|
@ -84,9 +84,7 @@ public:
|
|||
DynamicModelDLL(const char* fname, const int length,const int jcols,
|
||||
const int nMax_lag, const int nExog, const char * sExt);
|
||||
virtual ~DynamicModelDLL(){close();};
|
||||
// DynamicFn get(){return DynamicDLLfunc;};
|
||||
// void
|
||||
// ((DynamicFn())*) get(){return Dynamic;};
|
||||
|
||||
// evaluate Dynamic model DLL
|
||||
void eval(double *y, double *x, int nb_row_x, double *params,
|
||||
int it_, double *residual, double *g1, double *g2){
|
||||
|
@ -98,8 +96,8 @@ public:
|
|||
int it_, Vector&residual, TwoDMatrix*g1, TwoDMatrix*g2);
|
||||
void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
|
||||
Vector& residual, TwoDMatrix *g1, TwoDMatrix *g2);
|
||||
// void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
|
||||
// Vector& residual, double *g1, double *g2);
|
||||
// void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
|
||||
// Vector& residual, double *g1, double *g2);
|
||||
// close DLL: If the referenced object was successfully closed,
|
||||
// close() returns 0, non 0 otherwise
|
||||
int close();
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2008-2009 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
* Dynare is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Dynare is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
* This main() is for testing k_order DLL entry point by linking to
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char* argv[])
|
|||
int var_order[]//[18]
|
||||
= {
|
||||
5, 6, 8, 10, 11, 12, 14, 7, 13, 1, 2, 3, 4, 9, 15, 16
|
||||
// 5, 6, 8, 10, 11, 12, 16, 7, 13, 14, 15, 1, 2, 3, 4, 9, 17, 18
|
||||
// 5, 6, 8, 10, 11, 12, 16, 7, 13, 14, 15, 1, 2, 3, 4, 9, 17, 18
|
||||
};
|
||||
//Vector * varOrder = new Vector(var_order, nEndo);
|
||||
vector<int> * var_order_vp = new vector<int>(nEndo);//nEndo));
|
||||
|
|
Loading…
Reference in New Issue