diff --git a/mex/sources/korderpert/src/k_ord_dynare.h b/mex/sources/korderpert/src/k_ord_dynare.h deleted file mode 100644 index fc962ffdb..000000000 --- a/mex/sources/korderpert/src/k_ord_dynare.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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 . - */ - -// based on: $Id: dynare3.h 1764 2008-03-31 14:30:55Z kamenik $ -// by 2005, Ondra Kamenik - -#ifndef K_ORD_DYNARE3_H -#define K_ORD_DYNARE3_H -#include -#include "t_container.h" -#include "sparse_tensor.h" -#include "decision_rule.h" -#include "dynamic_model.h" - -#include "exception.h" -#include "dynare_exception.h" -#include "fs_tensor.h" -#include "SylvException.h" -#include "tl_exception.h" -#include "kord_exception.h" -#include "nlsolve.h" -#include "approximation.h" -#include "k_order_perturbation.h" - -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: -/*////////////////////////////////////////////*/ -class DynareNameList : public NameList { - vector names; -public: - DynareNameList(const KordpDynare& dynare); - 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 selectIndices(const vector& ns) const; -}; - -class DynareExogNameList : public NameList { - vector names; -public: - DynareExogNameList(const KordpDynare& dynare); - DynareExogNameList(const KordpDynare& dynare, const char ** names); - int getNum() const - {return (int)names.size();} - const char* getName(int i) const - {return names[i];} -}; - -class DynareStateNameList : public NameList { - vector names; -public: - DynareStateNameList(const KordpDynare& dynare, const DynareNameList& dnl, - const DynareExogNameList& denl); - int getNum() const - {return (int)names.size();} - const char* getName(int i) const - {return names[i];} -}; -/*********************************************/ -// The following only implements DynamicModel with help of ogdyn::DynareModel -// instantiation of pure abstract DynamicModel decl. in dynamic_model.h -//class DynamicModelDLL; -class KordpJacobian; -class KordpDynare : public DynamicModel { -friend class DynareNameList; -friend class DynareExogNameList; -friend class DynareStateNameList; -friend class KordpDynareJacobian; -friend class DynamicModelDLL; - ////////// - const int nStat; - const int nBoth; - const int nPred; - const int nForw; - const int nExog; - const int nPar; - const int nYs; // ={npred + nboth ; } - const int nYss; // nyss ={ nboth + nforw ; } - const int nY; // = num_endo={ nstat + npred + nboth + nforw ; } - const int nJcols; // no of jacobian columns= nExog+nEndo+nsPred+nsForw - const int nSteps; - const int nOrder; - Journal& journal; - /// DynamicModel* model; - ///const char* modName; - Vector* ySteady; - Vector* params; - TwoDMatrix* vCov; - TensorContainer md; // ModelDerivatives - DynareNameList* dnl; - DynareExogNameList* denl; - DynareStateNameList* dsnl; - const double ss_tol; - const vector* varOrder; - const TwoDMatrix * ll_Incidence; - double qz_criterium; - vector * JacobianIndices; -public: - KordpDynare(const char** endo, int num_endo, - const char** exo, int num_exo, int num_par, //const char** par, - Vector* ySteady, TwoDMatrix* vCov, Vector* params, int nstat,int nPred, - int nforw, int nboth, const int nJcols, const int nSteps, const int ord, //const char* modName, - Journal& jr, DynamicModelDLL& dynamicDLL, double sstol, - const vector* varOrder, const TwoDMatrix * ll_Incidence, - double qz_criterium ); - - /** Makes a deep copy of the object. */ - KordpDynare(const KordpDynare& dyn); - virtual ~KordpDynare(); - int nstat() const - {return nStat;} - int nboth() const - {return nBoth;} - int npred() const - {return nPred;} - int nforw() const - {return nForw;} - int nexog() const - {return nExog;} - int nys() const - {return nYs;} - int nyss() const - {return nYss;} - int ny() const - {return nY;} - int steps() const - {return nSteps;} - int order() const - {return nOrder;} - const NameList& getAllEndoNames() const - {return *dnl;} - const NameList& getStateNames() const - {return *dsnl;} - const NameList& getExogNames() const - {return *denl;} - const TwoDMatrix& getVcov() const - {return *vCov;} - Vector& getParams() - {return *params;} - - const TensorContainer& getModelDerivatives() const - {return md;} - const Vector& getSteady() const - {return *ySteady;} - Vector& getSteady() - {return *ySteady;} - /// const ogdyn::DynareModel& getModel() const - /// {return *model;} - - // here is true public interface - void solveDeterministicSteady(Vector& steady); - void solveDeterministicSteady() - {solveDeterministicSteady(*ySteady);} - void evaluateSystem(Vector& out, const Vector& yy, const Vector& xx); - void evaluateSystem(Vector& out, const Vector& yym, const Vector& yy, - const Vector& yyp, const Vector& xx); - void calcDerivatives(const Vector& yy, const Vector& xx); - //void calcDerivatives(const Vector& yy, TwoDMatrix& jj); - void calcDerivatives(const Vector& yy, ogu::Jacobian& jacob); - void calcDerivativesAtSteady(); - DynamicModelDLL& dynamicDLL; - /// void writeMat4(FILE* fd, const char* prefix) const; - /// void writeDump(const std::string& basename) const; - DynamicModel* clone() const - {return new KordpDynare(*this);} - void ReorderCols(TwoDMatrix * tdx, const int * varOrder); - void ReorderCols(TwoDMatrix * tdx, const vector * varOrder); - Vector * KordpDynare::LLxSteady( const Vector& yS); // returns ySteady extended with leads and lags - -private: - void writeModelInfo(Journal& jr) const; - int * ReorderDynareJacobianIndices( const int * varOrder); - vector * ReorderDynareJacobianIndices( const vector * varOrder); - void ReorderBlocks(TwoDMatrix * tdx, const int * varOrder); -}; - - /**************************** - * K-Order Perturbation instance of Jacobian: - ************************************/ - - class KordpJacobian : public ogu::Jacobian ///, public ogp::FormulaDerEvalLoader - { - protected: - KordpDynare& dyn; - public: - KordpJacobian( KordpDynare& dyn); - virtual ~KordpJacobian() {} - // Load _dynamic.DLL -// void load(const char** modName); - void eval(const Vector& in); - }; - - - /**************************** - * K-Order Perturbation instance of VectorFunction: - ************************************/ - - class KordpVectorFunction : public ogu::VectorFunction { - protected: - KordpDynare& d; - public: - KordpVectorFunction( KordpDynare& dyn) - : d(dyn) {} - virtual ~KordpVectorFunction() {} - int inDim() const - {return d.ny();} - int outDim() const - {return d.ny();} - void eval(const ConstVector& in, Vector& out); - }; - -#endif - - // Local Variables: - // mode:C++ - // End: