nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
resample.hpp
Go to the documentation of this file.
1
3
// toolboxes/stats/include/nk/stats/resample/resample.hpp
4
//
5
// Random sampling and resampling utilities.
6
7
#pragma once
8
9
#include <memory_resource>
10
#include <nk/value/span.hpp>
11
#include <nk/value/value.hpp>
12
13
namespace
nk {
14
17
namespace
ops {
class
RngContext
; } }
18
19
namespace
nk::stats {
20
36
Value
randsample
(
::nk::ops::RngContext
&rng,
int
N,
int
K,
bool
with_replacement,
const
Value
&weights,
37
std::pmr::memory_resource *mr =
nullptr
);
38
52
Value
datasample
(
::nk::ops::RngContext
&rng,
const
Value
&X,
int
K,
int
dim,
bool
with_replacement,
53
const
Value
&weights, std::pmr::memory_resource *mr =
nullptr
);
54
55
// NOTE: bootstrp / jackknife are not exposed as Engine-free C++ cores — they
56
// must invoke a user statistic via the engine, so the logic lives inline in
57
// their register half (bundle/.../resample/resample_reg.cpp).
58
67
Value
combnk
(
int
N,
int
K,
68
std::pmr::memory_resource *mr =
nullptr
);
69
79
Value
combnk
(
Span<const double>
v,
int
K,
80
std::pmr::memory_resource *mr =
nullptr
);
81
82
84
}
// namespace nk::stats
nk::Span
Definition
span.hpp:11
nk::Value
Core MATLAB-compatible multidimensional array and scalar value type.
Definition
value.hpp:61
nk::ops::RngContext
Definition
rng_context.hpp:29
nk::stats::randsample
Value randsample(::nk::ops::RngContext &rng, int N, int K, bool with_replacement, const Value &weights, std::pmr::memory_resource *mr=nullptr)
Sample integers from 1..N (r = randsample(N, K, replacement, weights)).
nk::stats::combnk
Value combnk(int N, int K, std::pmr::memory_resource *mr=nullptr)
Enumerate K-combinations of 1..N (C = combnk(N, K)).
nk::stats::datasample
Value datasample(::nk::ops::RngContext &rng, const Value &X, int K, int dim, bool with_replacement, const Value &weights, std::pmr::memory_resource *mr=nullptr)
Sample rows / columns of an array (Y = datasample(X, K, dim, replacement, weights)).
src
toolboxes
stats
include
nk
stats
resample
resample.hpp
Generated by
1.17.0