Merge branch 'master' of kirikou.dynare.org:/srv/d_kirikou/git/dynare

time-shift
Stéphane Adjemian (Scylla) 2010-05-12 17:59:09 +02:00
commit c1ce80d338
6 changed files with 62 additions and 14 deletions

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2010 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/>.
*/
#ifndef _LAPACK_BINDINGS_HH
#define _LAPACK_BINDINGS_HH
#include <dynlapack.h>
#include "Vector.hh"
#include "Matrix.hh"
namespace lapack
{
// calc Cholesky Decomposition (Mat A, char "U"pper/"L"ower)
template<class Mat>
inline int
choleskyDecomp(Mat A, const char *UL)
{
assert(A.getCols() == A.getRows());
lapack_int lpinfo = 0;
lapack_int lrows = A.getRows();
lapack_int ldl = A.getLd();
dpotrf(UL, &lrows, A.getData(), &ldl, &lpinfo);
int info = (int) lpinfo;
return info;
}
/**
* "DSTEQR computes all eigenvalues and, optionally, eigenvectors of a sym-
* metric tridiagonal matrix using the implicit QL or QR method. The eigen-
* vectors of a full or band symmetric matrix can also be found if DSYTRD or
* DSPTRD or DSBTRD has been used to reduce this matrix to tridiagonal form."
*/
} // End of namespace
#endif

View File

@ -128,7 +128,7 @@ main(int argc, char **argv)
double lyapunov_tol = 1e-16;
int info = 0;
const MatrixView
const MatrixConstView
dataView(&lyapunov_tol, 1, 1, 1); // dummy
Matrix
yView(dataView.getRows(),dataView.getCols()); // dummy
@ -144,7 +144,7 @@ main(int argc, char **argv)
std::cout << "Initialize KF with Q: " << std::endl << Q << std::endl;
initializeKalmanFilter.initialize(steadyState, deepParams, R, Q, RQRt, T, Pstar, Pinf,
initializeKalmanFilter.initialize(steadyStateVW, deepParams, R, Q, RQRt, T, Pstar, Pinf,
penalty, dataView, yView, info);
std::cout << "Matrix T: " << std::endl << T << std::endl;

View File

@ -119,7 +119,7 @@ main(int argc, char **argv)
int info = 0;
Matrix yView(nobs,192); // dummy
yView.setAll(0.2);
const MatrixView dataView(yView, 0, 0, nobs, yView.getCols() ); // dummy
const MatrixConstView dataView(yView, 0, 0, nobs, yView.getCols() ); // dummy
Vector vll(yView.getCols());
VectorView vwll(vll,0,vll.getSize());
@ -130,7 +130,7 @@ main(int argc, char **argv)
varobs_arg, riccati_tol, lyapunov_tol, info);
size_t start=0, period=0;
double ll=kalman.compute(dataView, steadyState, Q, H, deepParams,
double ll=kalman.compute(dataView, steadyStateVW, Q, H, deepParams,
vwll, start, period, penalty, info);
std::cout << "ll: " << std::endl << ll << std::endl;

View File

@ -39,7 +39,7 @@ main (int argc, char** argv)
std::vector<size_t> zeta_mixed_arg;
std::vector<size_t> zeta_static_arg;
double qz_criterium=1.0+1.0e-9;
Vector steadyState(n_endo), deepParams(npar);
Vector deepParams(npar);
double dYSparams [] = {
1.0110, 2.2582, 0.4477, 1.0000,
@ -66,8 +66,7 @@ main (int argc, char** argv)
VectorView modParamsVW (dparams, npar,1);
deepParams=modParamsVW;
VectorView steadyStateVW(dYSparams,n_endo,1);
steadyState=steadyStateVW;
VectorView steadyState(dYSparams,n_endo,1);
std::cout << "Vector deepParams: " << std::endl << deepParams << std::endl;
std::cout << "Matrix vCov: " << std::endl << vCov << std::endl;
std::cout << "Vector steadyState: " << std::endl << steadyState << std::endl;

View File

@ -325,12 +325,6 @@ IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *m
int v2 = mv2i->value;
vector<int> result;
if (v2 < v1)
{
int x = v2;
v2 = v1;
v1 = x;
}
for (; v1 <= v2; v1++)
result.push_back(v1);
return new ArrayMV<int>(driver, result);

View File

@ -153,7 +153,7 @@ public:
//! Creates a integer range
/*! Arguments must be of type IntMV.
Returns an integer array containing all integers between mv1 and mv2.
If mv2 < mv1, constructs the range in decreasing order.
If mv2 < mv1, returns an empty range (for consistency with MATLAB).
*/
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
};