Commit 66867386 authored by Frédéric Karamé's avatar Frédéric Karamé
Browse files

include modifications for parallelisation.

parent fb7ec278
...@@ -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 ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment