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
3f2e29f7
Commit
3f2e29f7
authored
Sep 23, 2011
by
Sébastien Villemot
Browse files
Adapt block_kalman_filter to Dynare's way of handling errors in MEX files
parent
b21a99d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
matlab/DsgeLikelihood.m
View file @
3f2e29f7
...
...
@@ -465,7 +465,8 @@ singularity_flag = 0;
if
((
kalman_algo
==
1
)
||
(
kalman_algo
==
3
))
%
Multivariate
Kalman
Filter
if
no_missing_data_flag
if
options_
.
block
==
1
LIK
=
block_kalman_filter
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
start
,
mf
,
kalman_tol
,
riccati_tol
,
M_
.
nz_state_var
,
M_
.
n_diag
);
[
err
,
LIK
]
=
block_kalman_filter
(
T
,
R
,
Q
,
H
,
Pstar
,
Y
,
start
,
mf
,
kalman_tol
,
riccati_tol
,
M_
.
nz_state_var
,
M_
.
n_diag
);
mexErrCheck
(
'
block_kalman_filter
'
,
err
);
else
LIK
=
kalman_filter
(
Y
,
diffuse_periods
+
1
,
size
(
Y
,
2
),
...
a
,
Pstar
,
...
...
...
mex/sources/block_kalman_filter/block_kalman_filter.cc
View file @
3f2e29f7
...
...
@@ -213,8 +213,8 @@ det(double* F, int dim)
void
mexFunction
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[])
{
if
(
nlhs
>
2
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"kalman_filter provides at most
2
output argument."
);
if
(
nlhs
>
3
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"kalman_filter provides at most
3
output argument."
);
if
(
nrhs
!=
12
)
DYN_MEX_FUNC_ERR_MSG_TXT
(
"kalman_filter requires exactly 12 input arguments."
);
//(T,R,Q,H,P,Y,start,mf,kalman_tol,riccati_tol, block)
...
...
@@ -792,16 +792,19 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
t
++
;
}
}
if
(
nlhs
>=
1
)
// info = 0
plhs
[
0
]
=
mxCreateDoubleScalar
(
0
);
if
(
nlhs
>=
2
)
{
plhs
[
0
]
=
mxCreateDoubleMatrix
(
1
,
1
,
mxREAL
);
double
*
pind
=
mxGetPr
(
plhs
[
0
]);
plhs
[
1
]
=
mxCreateDoubleMatrix
(
1
,
1
,
mxREAL
);
double
*
pind
=
mxGetPr
(
plhs
[
1
]);
pind
[
0
]
=
LIK
;
}
if
(
nlhs
==
2
)
plhs
[
1
]
=
plik
;
if
(
nlhs
==
3
)
plhs
[
2
]
=
plik
;
mxFree
(
w
);
#ifdef DIRECT
/*mxDestroyArray(nze);
...
...
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