Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
particles
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dynare
particles
Commits
cdc7f6dd
Commit
cdc7f6dd
authored
Oct 02, 2015
by
Frédéric Karamé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify the weights to prevent crash in the cholesky of the covariance.
parent
7235de43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/gaussian_filter.m
src/gaussian_filter.m
+8
-4
No files found.
src/gaussian_filter.m
View file @
cdc7f6dd
...
...
@@ -92,14 +92,14 @@ if isempty(H)
H
=
0
;
H_lower_triangular_cholesky
=
0
;
else
H_lower_triangular_cholesky
=
reduced_rank_cholesky
(
H
)
'
;
H_lower_triangular_cholesky
=
chol
(
H
)
' ; %
reduced_rank_cholesky(H)'
;
end
% Get initial condition for the state vector.
StateVectorMean
=
ReducedForm
.
StateVectorMean
;
StateVectorVarianceSquareRoot
=
reduced_rank_cholesky
(
ReducedForm
.
StateVectorVariance
)
'
;
StateVectorVarianceSquareRoot
=
chol
(
ReducedForm
.
StateVectorVariance
)
';%
reduced_rank_cholesky(ReducedForm.StateVectorVariance)'
;
state_variance_rank
=
size
(
StateVectorVarianceSquareRoot
,
2
);
Q_lower_triangular_cholesky
=
reduced_rank_cholesky
(
Q
)
'
;
Q_lower_triangular_cholesky
=
chol
(
Q
)
'; %
reduced_rank_cholesky(Q)'
;
% Initialization of the likelihood.
const_lik
=
(
2
*
pi
)
^
(
number_of_observed_variables
/
2
)
;
...
...
@@ -126,12 +126,16 @@ for t=1:sample_size
1
/
number_of_particles
,
1
/
number_of_particles
,
ReducedForm
,
ThreadsOptions
)
;
SampleWeights
=
IncrementalWeights
/
number_of_particles
;
end
SampleWeights
=
SampleWeights
+
1e-6
*
ones
(
size
(
SampleWeights
,
1
),
1
)
;
SumSampleWeights
=
sum
(
SampleWeights
)
;
lik
(
t
)
=
log
(
SumSampleWeights
)
;
SampleWeights
=
SampleWeights
.
/
SumSampleWeights
;
StateVectorMean
=
StateParticles
*
SampleWeights
;
temp
=
bsxfun
(
@
minus
,
StateParticles
,
StateVectorMean
)
;
StateVectorVarianceSquareRoot
=
reduced_rank_cholesky
(
bsxfun
(
@
times
,
SampleWeights
',temp)*temp'
)
'
;
%disp(SampleWeights)
%disp(StateParticles)
%disp(StateVectorMean)
StateVectorVarianceSquareRoot
=
chol
(
bsxfun
(
@
times
,
SampleWeights
',temp)*temp'
)
';%reduced_rank_cholesky( bsxfun(@times,SampleWeights'
,
temp
)
*
temp
' )'
;
end
LIK
=
-
sum
(
lik
(
start
:
end
));
Write
Preview
Markdown
is supported
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