diff --git a/mex/sources/estimation/libmat/LapackBindings.hh b/mex/sources/estimation/libmat/LapackBindings.hh
new file mode 100644
index 000000000..f9a0f465b
--- /dev/null
+++ b/mex/sources/estimation/libmat/LapackBindings.hh
@@ -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 .
+ */
+
+#ifndef _LAPACK_BINDINGS_HH
+#define _LAPACK_BINDINGS_HH
+
+#include
+
+#include "Vector.hh"
+#include "Matrix.hh"
+
+namespace lapack
+{
+ // calc Cholesky Decomposition (Mat A, char "U"pper/"L"ower)
+ template
+ 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
diff --git a/mex/sources/estimation/tests/testInitKalman.cc b/mex/sources/estimation/tests/testInitKalman.cc
index c261f9b71..0f34007b1 100644
--- a/mex/sources/estimation/tests/testInitKalman.cc
+++ b/mex/sources/estimation/tests/testInitKalman.cc
@@ -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;
diff --git a/mex/sources/estimation/tests/testKalman.cc b/mex/sources/estimation/tests/testKalman.cc
index b240a1bce..7db171f6b 100644
--- a/mex/sources/estimation/tests/testKalman.cc
+++ b/mex/sources/estimation/tests/testKalman.cc
@@ -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;
diff --git a/mex/sources/estimation/tests/testModelSolution.cc b/mex/sources/estimation/tests/testModelSolution.cc
index 3a6ad7e61..20709a049 100644
--- a/mex/sources/estimation/tests/testModelSolution.cc
+++ b/mex/sources/estimation/tests/testModelSolution.cc
@@ -39,7 +39,7 @@ main (int argc, char** argv)
std::vector zeta_mixed_arg;
std::vector 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;
diff --git a/preprocessor/macro/MacroValue.cc b/preprocessor/macro/MacroValue.cc
index d21180756..98833caba 100644
--- a/preprocessor/macro/MacroValue.cc
+++ b/preprocessor/macro/MacroValue.cc
@@ -325,12 +325,6 @@ IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *m
int v2 = mv2i->value;
vector result;
- if (v2 < v1)
- {
- int x = v2;
- v2 = v1;
- v1 = x;
- }
for (; v1 <= v2; v1++)
result.push_back(v1);
return new ArrayMV(driver, result);
diff --git a/preprocessor/macro/MacroValue.hh b/preprocessor/macro/MacroValue.hh
index 52b566f4c..e379a6026 100644
--- a/preprocessor/macro/MacroValue.hh
+++ b/preprocessor/macro/MacroValue.hh
@@ -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);
};