Skip to content
Snippets Groups Projects
Commit f7f44a7b authored by Frédéric Karamé's avatar Frédéric Karamé Committed by Johannes Pfeifer
Browse files

kitagawa.m: allow drawing defined number of particles instead of all particles

parent 48c18522
No related branches found
No related tags found
No related merge requests found
function indices = kitagawa(weights, noise) function indices = kitagawa(weights, noise, m)
% function indices = kitagawa(weights, noise, m)
% Return indices for resampling. % Return indices for resampling.
% %
% INPUTS % INPUTS
% - weights [double] n×1 vector of partcles' weights. % - weights [double] n×1 vector of particles' weights.
% - noise [double] scalar, uniform random deviates in [0,1] % - noise [double] scalar, uniform random deviates in [0,1]
% - m [integer] scalar, number of particles to resample
% %
% OUTPUTS % OUTPUTS
% - indices [integer] n×1 vector of indices in [1:n] % - indices [integer] m×1 vector of indices in [1:n]
% Copyright © 2022-2023 Dynare Team % Copyright © 2022-2024 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -26,7 +27,11 @@ function indices = kitagawa(weights, noise) ...@@ -26,7 +27,11 @@ function indices = kitagawa(weights, noise)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>. % along with Dynare. If not, see <https://www.gnu.org/licenses/>.
n= length(weights); if nargin<3
n = length(weights);
else
n = m ;
end
if nargin<2, noise = rand; end if nargin<2, noise = rand; end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment