Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
74100945
Commit
74100945
authored
Jun 11, 2010
by
Sébastien Villemot
Browse files
Estimation DLL: various minor changes
parent
e5d093c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
mex/sources/estimation/LogLikelihoodSubSample.cc
View file @
74100945
...
...
@@ -61,7 +61,7 @@ void
LogLikelihoodSubSample
::
updateParams
(
const
Vector
&
estParams
,
Vector
&
deepParams
,
Matrix
&
Q
,
Matrix
&
H
,
size_t
period
)
{
size_t
i
,
j
,
k
,
k1
,
k2
;
size_t
i
,
k
,
k1
,
k2
;
int
test
;
bool
found
;
std
::
vector
<
size_t
>::
const_iterator
it
;
...
...
@@ -79,7 +79,7 @@ LogLikelihoodSubSample::updateParams(const Vector &estParams, Vector &deepParams
switch
(
estiParDesc
.
estParams
[
i
].
ptype
)
{
case
EstimatedParameter
::
shock_SD
:
k
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID1
;
k
=
estiParDesc
.
estParams
[
i
].
ID1
;
Q
(
k
,
k
)
=
estParams
(
i
)
*
estParams
(
i
);
break
;
...
...
@@ -87,7 +87,7 @@ LogLikelihoodSubSample::updateParams(const Vector &estParams, Vector &deepParams
#ifdef DEBUG
mexPrintf
(
"Setting of H var_endo
\n
"
);
#endif
k
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID1
;
k
=
estiParDesc
.
estParams
[
i
].
ID1
;
H
(
k
,
k
)
=
estParams
(
i
)
*
estParams
(
i
);
break
;
...
...
@@ -95,8 +95,8 @@ LogLikelihoodSubSample::updateParams(const Vector &estParams, Vector &deepParams
#ifdef DEBUG
mexPrintf
(
"Setting of Q corrx
\n
"
);
#endif
k1
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID1
;
k2
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID2
;
k1
=
estiParDesc
.
estParams
[
i
].
ID1
;
k2
=
estiParDesc
.
estParams
[
i
].
ID2
;
Q
(
k1
,
k2
)
=
estParams
(
i
)
*
sqrt
(
Q
(
k1
,
k1
)
*
Q
(
k2
,
k2
));
Q
(
k2
,
k1
)
=
Q
(
k1
,
k2
);
// [CholQ,testQ] = chol(Q);
...
...
@@ -131,8 +131,8 @@ LogLikelihoodSubSample::updateParams(const Vector &estParams, Vector &deepParams
#ifdef DEBUG
mexPrintf
(
"Setting of H corrn
\n
"
);
#endif
k1
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID1
;
k2
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID2
;
k1
=
estiParDesc
.
estParams
[
i
].
ID1
;
k2
=
estiParDesc
.
estParams
[
i
].
ID2
;
// H(k1,k2) = xparam1(i)*sqrt(H(k1,k1)*H(k2,k2));
// H(k2,k1) = H(k1,k2);
H
(
k1
,
k2
)
=
estParams
(
i
)
*
sqrt
(
H
(
k1
,
k1
)
*
H
(
k2
,
k2
));
...
...
@@ -168,7 +168,7 @@ LogLikelihoodSubSample::updateParams(const Vector &estParams, Vector &deepParams
//if estim_params_.np > 0 // i.e. num of deep parameters >0
case
EstimatedParameter
::
deepPar
:
k
=
(
int
)
estiParDesc
.
estParams
[
i
].
ID1
;
k
=
estiParDesc
.
estParams
[
i
].
ID1
;
deepParams
(
k
)
=
estParams
(
i
);
break
;
default:
...
...
mex/sources/estimation/libmat/VDVEigDecomposition.cc
View file @
74100945
...
...
@@ -26,8 +26,9 @@ VDVEigDecomposition::VDVEigDecomposition(const Matrix &m) throw(VDVEigException)
if
(
m
.
getRows
()
!=
m
.
getCols
())
throw
(
VDVEigException
(
info
,
"Matrix is not square in VDVEigDecomposition constructor"
));
double
tmpwork
;
dsyev
(
"V"
,
"U"
,
&
n
,
V
.
getData
(),
&
lda
,
D
.
getData
(),
&
tmpwork
,
&
lwork
,
&
info
);
lwork
=
(
int
)
tmpwork
;
lwork
=
(
lapack_
int
)
tmpwork
;
work
=
new
double
[
lwork
];
if
(
info
<
0
)
throw
(
VDVEigException
(
info
,
"Internal error in VDVEigDecomposition constructor"
));
...
...
mex/sources/estimation/libmat/VDVEigDecomposition.hh
View file @
74100945
...
...
@@ -34,7 +34,6 @@ class VDVEigDecomposition
{
lapack_int
lda
,
n
;
lapack_int
lwork
,
info
;
double
tmpwork
;
double
*
work
;
bool
converged
;
Matrix
V
;
...
...
@@ -100,12 +99,14 @@ VDVEigDecomposition::calculate(const Mat &m) throw(VDVEigException)
if
(
m
.
getCols
()
!=
(
size_t
)
n
||
m
.
getLd
()
!=
(
size_t
)
lda
)
throw
(
VDVEigException
(
info
,
"Matrix not matching VDVEigDecomposition class"
));
double
tmpwork
;
lapack_int
tmplwork
=
-
1
;
V
=
m
;
dsyev
(
"V"
,
"U"
,
&
n
,
V
.
getData
(),
&
lda
,
D
.
getData
(),
&
tmpwork
,
&
tmplwork
,
&
info
);
if
(
lwork
<
tmpwork
)
if
(
lwork
<
(
lapack_int
)
tmpwork
)
{
lwork
=
tmpwork
;
lwork
=
(
lapack_int
)
tmpwork
;
delete
[]
work
;
work
=
new
double
[
lwork
];
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment