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
Mark Song
particles
Commits
66867386
Commit
66867386
authored
Jun 28, 2018
by
Frédéric Karamé
Browse files
include modifications for parallelisation.
parent
fb7ec278
Changes
1
Show whitespace changes
Inline
Side-by-side
src/conditional_particle_filter.m
View file @
66867386
...
@@ -102,15 +102,17 @@ ks = 0 ;
...
@@ -102,15 +102,17 @@ ks = 0 ;
StateParticles
=
bsxfun
(
@
plus
,
StateVectorVarianceSquareRoot
*
randn
(
state_variance_rank
,
number_of_particles
),
StateVectorMean
);
StateParticles
=
bsxfun
(
@
plus
,
StateVectorVarianceSquareRoot
*
randn
(
state_variance_rank
,
number_of_particles
),
StateVectorMean
);
SampleWeights
=
ones
(
1
,
number_of_particles
)/
number_of_particles
;
SampleWeights
=
ones
(
1
,
number_of_particles
)/
number_of_particles
;
for
t
=
1
:
sample_size
for
t
=
1
:
sample_size
for
i
=
1
:
number_of_particles
obs
=
Y
(:,
t
);
[
StateParticles
(:,
i
),
SampleWeights
(
i
),
flag
]
=
...
flag
=
zeros
(
number_of_particles
)
;
conditional_filter_proposal
(
ReducedForm
,
Y
(:,
t
),
StateParticles
(:,
i
),
SampleWeights
(
i
),
Q_lower_triangular_cholesky
,
H_lower_triangular_cholesky
,
H
,
ParticleOptions
,
ThreadsOptions
,
normconst2
)
;
parfor
i
=
1
:
number_of_particles
if
flag
==
1
[
StateParticles
(:,
i
),
SampleWeights
(
i
),
flag
(
i
)]
=
...
conditional_filter_proposal
(
ReducedForm
,
obs
,
StateParticles
(:,
i
),
SampleWeights
(
i
),
Q_lower_triangular_cholesky
,
H_lower_triangular_cholesky
,
H
,
ParticleOptions
,
ThreadsOptions
,
normconst2
)
;
end
if
sum
(
flag
)
~=
0
LIK
=-
Inf
;
LIK
=-
Inf
;
lik
(
t
)
=-
Inf
;
lik
(
t
)
=-
Inf
;
return
return
end
end
end
SumSampleWeights
=
sum
(
SampleWeights
)
;
SumSampleWeights
=
sum
(
SampleWeights
)
;
lik
(
t
)
=
log
(
SumSampleWeights
)
;
lik
(
t
)
=
log
(
SumSampleWeights
)
;
SampleWeights
=
SampleWeights
.
/
SumSampleWeights
;
SampleWeights
=
SampleWeights
.
/
SumSampleWeights
;
...
...
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