Minor updates
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3124 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
30d2f00cc2
commit
91df747554
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
addpath '../../matlab'; % For matlab_ver_less_than
|
addpath '../../matlab'; % For matlab_ver_less_than
|
||||||
|
|
||||||
MATLAB_PATH = matlabroot;
|
%MATLAB_PATH = matlabroot;
|
||||||
|
MATLAB_PATH = regexprep(matlabroot,'\\','/');
|
||||||
COMPILE_OPTIONS = '';
|
COMPILE_OPTIONS = '';
|
||||||
|
|
||||||
if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
|
if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
|
||||||
|
|
|
@ -225,6 +225,9 @@ DsgeLikelihood::~DsgeLikelihood()
|
||||||
delete &deepParams;
|
delete &deepParams;
|
||||||
delete &ghx;
|
delete &ghx;
|
||||||
delete &ghu;
|
delete &ghu;
|
||||||
|
delete &dynareParams;
|
||||||
|
delete &dr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "ioutils.h"
|
#include "ioutils.h"
|
||||||
#include "mex.h"
|
#include "mex.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "SylvException.h"
|
//#include "SylvException.h"
|
||||||
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
||||||
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@
|
||||||
//#include "k_ord_dynare.h"
|
//#include "k_ord_dynare.h"
|
||||||
//using namespace std;
|
//using namespace std;
|
||||||
enum {base, caller, global};
|
enum {base, caller, global};
|
||||||
char* mexBase[]={"base", "caller", "global"};
|
enum {M_, oo_, options_,bayestopt_, estim_params_, dr};
|
||||||
|
extern const char *DynareParamStructsNm [];
|
||||||
|
extern const char* mexBase[];
|
||||||
|
|
||||||
const int numParStructs=5;
|
const int numParStructs=5;
|
||||||
#define numParStructsM 7
|
//#define numParStructsM 6
|
||||||
|
|
||||||
enum {M_, dr_, oo_, options_,bayestopt_, estim_params_, trend_coeff_};
|
|
||||||
char *DynareParamStructsNm [numParStructsM]={"M_", "dr_", "oo_", "options_", "bayestopt_", "estim_params_", "trend_coeff_"};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
struct DynareParamsStructMap
|
struct DynareParamsStructMap
|
||||||
|
@ -61,7 +61,7 @@ char* structName;
|
||||||
|
|
||||||
class MexStructParam;
|
class MexStructParam;
|
||||||
|
|
||||||
class MexStruct :public GeneralParams
|
class MexStruct :public virtual GeneralParams
|
||||||
{
|
{
|
||||||
vector <int> parStructBase;
|
vector <int> parStructBase;
|
||||||
vector <const mxArray*> parStruct; // array of struct pointers
|
vector <const mxArray*> parStruct; // array of struct pointers
|
||||||
|
@ -69,7 +69,7 @@ class MexStruct :public GeneralParams
|
||||||
const int numParStruct;
|
const int numParStruct;
|
||||||
const string structName;
|
const string structName;
|
||||||
|
|
||||||
mxArray* getMxField( const string& field) //throw (SYLV_MES_EXCEPTION)
|
mxArray* getMxField( const string& field)
|
||||||
{
|
{
|
||||||
map<string, int>::iterator it=parNamStructMap.find(field);
|
map<string, int>::iterator it=parNamStructMap.find(field);
|
||||||
if (it==parNamStructMap.end())
|
if (it==parNamStructMap.end())
|
||||||
|
@ -77,14 +77,14 @@ class MexStruct :public GeneralParams
|
||||||
return mxGetField(parStruct[it->second], 0, field.c_str() );
|
return mxGetField(parStruct[it->second], 0, field.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
StructBaseNameMap* getMxFieldStruct( const string& field) //throw (SYLV_MES_EXCEPTION)
|
StructBaseNameMap* getMxFieldStruct( const string& field)
|
||||||
{
|
{
|
||||||
map<string, int>::iterator it=parNamStructMap.find(field);
|
map<string, int>::iterator it=parNamStructMap.find(field);
|
||||||
if (it==parNamStructMap.end())
|
if (it==parNamStructMap.end())
|
||||||
throw(SYLV_MES_EXCEPTION("no parameter with such name"));
|
throw(SYLV_MES_EXCEPTION("no parameter with such name"));
|
||||||
StructBaseNameMap* dpsm=new StructBaseNameMap;
|
StructBaseNameMap* dpsm=new StructBaseNameMap;
|
||||||
dpsm->baseName=mexBase[parStructBase[it->second]];
|
dpsm->baseName=(char*)mexBase[parStructBase[it->second]];
|
||||||
dpsm->structName=DynareParamStructsNm[it->second];
|
dpsm->structName=(char*)DynareParamStructsNm[it->second];
|
||||||
|
|
||||||
return dpsm;
|
return dpsm;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ class MexStruct :public GeneralParams
|
||||||
mexStruct=mexGetVariable(base, structName);
|
mexStruct=mexGetVariable(base, structName);
|
||||||
}
|
}
|
||||||
**/
|
**/
|
||||||
~MexStruct();
|
~MexStruct(){};
|
||||||
void *
|
void *
|
||||||
getMxArrayField(const string& field)
|
getMxArrayField(const string& field)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ class MexStruct :public GeneralParams
|
||||||
* holds single Matlab structure passed as parameter
|
* holds single Matlab structure passed as parameter
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
||||||
class MexStructParam :public GeneralParams
|
class MexStructParam :public virtual GeneralParams
|
||||||
{
|
{
|
||||||
const mxArray* parStruct; // struct pointer
|
const mxArray* parStruct; // struct pointer
|
||||||
const GeneralParams* parStructParent; // if any
|
const GeneralParams* parStructParent; // if any
|
||||||
|
@ -159,7 +159,7 @@ class MexStructParam :public GeneralParams
|
||||||
parStruct(paramStruct), parStructParent(parent), structName(string("")){};
|
parStruct(paramStruct), parStructParent(parent), structName(string("")){};
|
||||||
MexStructParam(const mxArray* paramStruct, const string& name):
|
MexStructParam(const mxArray* paramStruct, const string& name):
|
||||||
parStruct(paramStruct), parStructParent(NULL), structName(name){};
|
parStruct(paramStruct), parStructParent(NULL), structName(name){};
|
||||||
~MexStructParam();
|
~MexStructParam(){};
|
||||||
void *
|
void *
|
||||||
getMxArrayField(const string& field)
|
getMxArrayField(const string& field)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "SylvException.h"
|
#include "SylvException.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
//using namespace std;
|
||||||
|
|
||||||
|
|
||||||
struct charArraySt
|
struct charArraySt
|
||||||
|
@ -36,9 +36,8 @@ class GeneralParams
|
||||||
// map <string, int> params;
|
// map <string, int> params;
|
||||||
// const char *structName;
|
// const char *structName;
|
||||||
public:
|
public:
|
||||||
GeneralParams();
|
GeneralParams(){};
|
||||||
GeneralParams( const string& parStructName, const string& base);
|
virtual ~GeneralParams(){};
|
||||||
virtual ~GeneralParams();
|
|
||||||
virtual string& name()=0;
|
virtual string& name()=0;
|
||||||
virtual void *
|
virtual void *
|
||||||
getField(const string& field)=0;
|
getField(const string& field)=0;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
//vector<int>nullVec(0);
|
||||||
int GeneralMatrix::md_length = 32;
|
int GeneralMatrix::md_length = 32;
|
||||||
|
|
||||||
GeneralMatrix::GeneralMatrix(const GeneralMatrix& m)
|
GeneralMatrix::GeneralMatrix(const GeneralMatrix& m)
|
||||||
|
@ -87,7 +88,7 @@ It ignores non-positive elements passing zero length vector is equivalent
|
||||||
to Matlab operator ":" = all elements of that dimension in its order */
|
to Matlab operator ":" = all elements of that dimension in its order */
|
||||||
GeneralMatrix::GeneralMatrix(const GeneralMatrix& a, const vector<int>&vrows, const vector<int>&vcols)
|
GeneralMatrix::GeneralMatrix(const GeneralMatrix& a, const vector<int>&vrows, const vector<int>&vcols)
|
||||||
{
|
{
|
||||||
int nrows, ncols;
|
int nrows=0, ncols=0;
|
||||||
if (vrows.size()==0 && vcols.size()==0)
|
if (vrows.size()==0 && vcols.size()==0)
|
||||||
{
|
{
|
||||||
*this=a;
|
*this=a;
|
||||||
|
@ -175,11 +176,11 @@ GeneralMatrix::multElements(const GeneralMatrix& m)
|
||||||
GeneralMatrix&
|
GeneralMatrix&
|
||||||
GeneralMatrix::repmat(int multv, int multh)
|
GeneralMatrix::repmat(int multv, int multh)
|
||||||
{
|
{
|
||||||
GeneralMatrix repMat=*(new GeneralMatrix ( multv*rows, multh*cols));
|
GeneralMatrix* repMat=(new GeneralMatrix ( multv*rows, multh*cols));
|
||||||
for (int i=0;i<multv;++i)
|
for (int i=0;i<multv;++i)
|
||||||
for (int j=0;j<multh;++j)
|
for (int j=0;j<multh;++j)
|
||||||
repMat.place(*this, multv*i, multh*j);
|
(*repMat).place(*this, multv*i, multh*j);
|
||||||
return repMat;
|
return *repMat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -471,9 +472,9 @@ void
|
||||||
GeneralMatrix::AssignByVectors(GeneralMatrix& a, const vector<int>& vToRows, const vector<int>& vToCols
|
GeneralMatrix::AssignByVectors(GeneralMatrix& a, const vector<int>& vToRows, const vector<int>& vToCols
|
||||||
, const GeneralMatrix& b, const vector<int>& vrows, const vector<int>& vcols)
|
, const GeneralMatrix& b, const vector<int>& vrows, const vector<int>& vcols)
|
||||||
{
|
{
|
||||||
int nrows, ncols, tonrows, toncols;
|
int nrows=0, ncols=0, tonrows=0, toncols=0;
|
||||||
const vector<int> *vpToCols, *vpToRows, *vpRows, *vpCols;
|
const vector<int> *vpToCols=0, *vpToRows=0, *vpRows=0, *vpCols=0;
|
||||||
vector<int> *tmpvpToCols, *tmpvpToRows, *tmpvpRows, *tmpvpCols;
|
vector<int> *tmpvpToCols=0, *tmpvpToRows=0, *tmpvpRows=0, *tmpvpCols=0;
|
||||||
|
|
||||||
if (vToRows.size()==0 && vToCols.size()==0 &&vrows.size()==0 && vcols.size()==0)
|
if (vToRows.size()==0 && vToCols.size()==0 &&vrows.size()==0 && vcols.size()==0)
|
||||||
a=b;
|
a=b;
|
||||||
|
@ -579,10 +580,10 @@ GeneralMatrix::AssignByVectors(GeneralMatrix& a, const vector<int>& vToRows, con
|
||||||
a.get((*vpToRows)[i]-1,(*vpToCols)[j]-1)=b.get((*vpRows)[i]-1, (*vpCols)[j]-1);
|
a.get((*vpToRows)[i]-1,(*vpToCols)[j]-1)=b.get((*vpRows)[i]-1, (*vpCols)[j]-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(tmpvpToCols);
|
if (tmpvpToCols) delete(tmpvpToCols);
|
||||||
delete(tmpvpToRows);
|
if (tmpvpToRows) delete(tmpvpToRows);
|
||||||
delete(tmpvpRows);
|
if (tmpvpRows) delete(tmpvpRows);
|
||||||
delete(tmpvpCols);
|
if (tmpvpCols) delete(tmpvpCols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
vector<int>nullVec(0);
|
//#define nullVec (const vector<int>(0))
|
||||||
|
const vector<int>nullVec(0);
|
||||||
|
|
||||||
class GeneralMatrix;
|
class GeneralMatrix;
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ class GeneralMatrix {
|
||||||
int rows;
|
int rows;
|
||||||
int cols;
|
int cols;
|
||||||
int ld;
|
int ld;
|
||||||
GeneralMatrix * tmpGMp;
|
GeneralMatrix * tmpGMp;
|
||||||
public:
|
public:
|
||||||
GeneralMatrix(int m, int n)
|
GeneralMatrix(int m, int n)
|
||||||
: data(m*n), rows(m), cols(n), ld(m) {}
|
: data(m*n), rows(m), cols(n), ld(m) {}
|
||||||
|
|
Loading…
Reference in New Issue