<commit_before>#ifndef V_SMC_CORE_SAMPLER_HPP
#define V_SMC_CORE_SAMPLER_HPP

#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vSMC/internal/common.hpp>

namespace vSMC {

/// \brief SMC Sampler
template <typename T>
class Sampler
{
    public :

    /// The type of initialization functor
    typedef internal::function<std::size_t (Particle<T> &, void *)>
        initialize_type;

    /// The type of move functor
    typedef internal::function<std::size_t (std::size_t, Particle<T> &)>
        move_type;

    /// The type ESS history vector
    typedef std::vector<double> ess_type;

    /// The type resampling history vector
    typedef std::vector<bool> resampled_type;

    /// The type accept count history vector
    typedef std::vector<std::size_t> accept_type;

    /// \brief Construct a sampler with given number of particles
    ///
    /// \param N The number of particles
    /// \param init The functor used to initialize the particles
    /// \param move The functor used to move the particles and weights
    /// \param mcmc The functor used to perform MCMC move
    /// \param scheme The resampling scheme. See ResampleScheme
    /// \param threshold The threshold for performing resampling
    /// \param seed The seed to the parallel RNG system
    explicit Sampler (
            std::size_t N,
            const initialize_type &init = NULL,
            const move_type &move = NULL,
            const move_type &mcmc = NULL,
            ResampleScheme scheme = STRATIFIED,
            double threshold = 0.5,
            typename Particle<T>::seed_type seed = V_SMC_CRNG_SEED) :
        initialized_(false), init_(init), move_(move), mcmc_(mcmc),
        scheme_(scheme), threshold_(threshold * N),
        particle_(N, seed), iter_num_(0)
    {
        particle_.sampler(this);
    }

    /// \brief Size of the particle set
    ///
    /// \return The number of particles
    std::size_t size () const
    {
        return particle_.size();
    }

    /// \brief Size of records
    ///
    /// \return The number of iterations recorded (including the
    /// initialization step)
    std::size_t iter_size () const
    {
        return ess_.size();<commit_msg>use Particle<T>::size_type for Sampler constructor;<commit_after>#ifndef V_SMC_CORE_SAMPLER_HPP
#define V_SMC_CORE_SAMPLER_HPP

#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vSMC/internal/common.hpp>

namespace vSMC {

/// \brief SMC Sampler
template <typename T>
class Sampler
{
    public :

    /// The type of initialization functor
    typedef internal::function<std::size_t (Particle<T> &, void *)>
        initialize_type;

    /// The type of move functor
    typedef internal::function<std::size_t (std::size_t, Particle<T> &)>
        move_type;

    /// The type ESS history vector
    typedef std::vector<double> ess_type;

    /// The type resampling history vector
    typedef std::vector<bool> resampled_type;

    /// The type accept count history vector
    typedef std::vector<std::size_t> accept_type;

    /// \brief Construct a sampler with given number of particles
    ///
    /// \param N The number of particles
    /// \param init The functor used to initialize the particles
    /// \param move The functor used to move the particles and weights
    /// \param mcmc The functor used to perform MCMC move
    /// \param scheme The resampling scheme. See ResampleScheme
    /// \param threshold The threshold for performing resampling
    /// \param seed The seed to the parallel RNG system
    explicit Sampler (
            typename Particle<T>::size_type N,
            const initialize_type &init = NULL,
            const move_type &move = NULL,
            const move_type &mcmc = NULL,
            ResampleScheme scheme = STRATIFIED,
            double threshold = 0.5,
            typename Particle<T>::seed_type seed = V_SMC_CRNG_SEED) :
        initialized_(false), init_(init), move_(move), mcmc_(mcmc),
        scheme_(scheme), threshold_(threshold * N),
        particle_(N, seed), iter_num_(0)
    {
        particle_.sampler(this);
    }

    /// \brief Size of the particle set
    ///
    /// \return The number of particles
    typename Particle<T>::size_type size () const
    {
        return particle_.size();
    }

    /// \brief Size of records
    ///
    /// \return The number of iterations recorded (including the
    /// initialization step)
    std::size_t iter_size () const
    {
        return ess_.size();
{'fraction_non_alphanumeric': 0.10434204696499778, 'fraction_numerical': 0.001329198050509526, 'mean_word_length': 2.519095869056898, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '97429', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1280, 'n_words': 423}