vSMC  v3.0.0
Scalable Monte Carlo
resample.h
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/resample/resample.h
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2016, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef VSMC_RESAMPLE_RESAMPLE_H
33 #define VSMC_RESAMPLE_RESAMPLE_H
34 
35 #include <vsmc/internal/common.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
43 
46  size_t n, size_t m, const double *weight, double *resid, size_t *integ);
47 
49 void vsmc_resample_trans_u01_rep(size_t n, size_t m, const double *weight,
50  const double *u01, size_t *replication);
51 
54  size_t n, size_t m, const size_t *replication, size_t *index);
55 
57 void vsmc_resample_multinomial(size_t n, size_t m, vsmc_rng rng,
58  const double *weight, size_t *replication);
59 
61 void vsmc_resample_stratified(size_t n, size_t m, vsmc_rng rng,
62  const double *weight, size_t *replication);
63 
65 void vsmc_resample_systematic(size_t n, size_t m, vsmc_rng rng,
66  const double *weight, size_t *replication);
67 
69 void vsmc_resample_residual(size_t n, size_t m, vsmc_rng rng,
70  const double *weight, size_t *replication);
71 
73 void vsmc_resample_residual_stratified(size_t n, size_t m, vsmc_rng rng,
74  const double *weight, size_t *replication);
75 
77 void vsmc_resample_residual_systematic(size_t n, size_t m, vsmc_rng rng,
78  const double *weight, size_t *replication);
79 
81 
82 #ifdef __cplusplus
83 } // extern "C"
84 #endif
85 
86 #endif // VSMC_RESAMPLE_RESAMPLE_H
void vsmc_resample_stratified(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleStratified
void vsmc_resample_trans_u01_rep(size_t n, size_t m, const double *weight, const double *u01, size_t *replication)
vsmc::resample_trans_u01_rep
size_t vsmc_resample_trans_residual(size_t n, size_t m, const double *weight, double *resid, size_t *integ)
vsmc::resample_trans_residual
void vsmc_resample_residual_stratified(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleResidualStratified
void vsmc_resample_trans_rep_index(size_t n, size_t m, const size_t *replication, size_t *index)
vsmc::resample_trans_rep_index
void vsmc_resample_residual_systematic(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleSystematic
RealType u01(UIntType u) noexcept
Convert uniform unsigned integers to floating points within [0, 1].
Definition: u01.hpp:213
void vsmc_resample_systematic(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleSystematic
void vsmc_resample_residual(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleResidual
vSMC RNG types
Definition: defines.h:172
void vsmc_resample_multinomial(size_t n, size_t m, vsmc_rng rng, const double *weight, size_t *replication)
vsmc::ResampleMultinomial