1function [A,B] = kalman_transition_matrix(dr,iv,ic,exo_nbr)
2%function [A,B] = kalman_transition_matrix(dr,iv,ic,exo_nbr)
3% Builds the transition equation of the state space representation out of ghx and ghu for Kalman filter
4%
5% INPUTS
6%    dr:      structure of decisions rules for stochastic simulations
7%    iv:      selected variables
8%    ic:      state variables position in the transition matrix columns
9%    exo_nbr: number of exogenous variables
10%
11% OUTPUTS
12%    A:       matrix of predetermined variables effects in linear solution (ghx)
13%    B:       matrix of shocks effects in linear solution (ghu)
14%
15% SPECIAL REQUIREMENTS
16%    none
17
18% Copyright (C) 2003-2017 Dynare Team
19%
20% This file is part of Dynare.
21%
22% Dynare is free software: you can redistribute it and/or modify
23% it under the terms of the GNU General Public License as published by
24% the Free Software Foundation, either version 3 of the License, or
25% (at your option) any later version.
26%
27% Dynare is distributed in the hope that it will be useful,
28% but WITHOUT ANY WARRANTY; without even the implied warranty of
29% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30% GNU General Public License for more details.
31%
32% You should have received a copy of the GNU General Public License
33% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
34
35n_iv = length(iv);
36
37A = zeros(n_iv,n_iv);
38
39A(:,ic) = dr.ghx(iv,:);
40
41if nargout>1
42    B = dr.ghu(iv,:);
43end
44