nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
geometric.hpp
Go to the documentation of this file.
1
3
// toolboxes/stats/include/nk/stats/distributions/geometric.hpp
4
//
5
// Geometric distribution (number of failures before the first success).
6
// Convention: f(k; p) = (1-p)^k ยท p, k = 0, 1, 2, ...
7
8
#pragma once
9
10
#include <memory_resource>
11
#include <nk/value/value.hpp>
12
13
#include <tuple>
14
15
namespace
nk {
16
19
namespace
ops {
class
RngContext
; } }
20
21
namespace
nk::stats {
22
34
Value
geopdf
(
const
Value
&k,
double
p,
35
std::pmr::memory_resource *mr =
nullptr
);
36
46
Value
geocdf
(
const
Value
&k,
double
p,
47
std::pmr::memory_resource *mr =
nullptr
);
48
58
Value
geoinv
(
const
Value
&q,
double
p,
59
std::pmr::memory_resource *mr =
nullptr
);
60
69
Value
geornd
(
::nk::ops::RngContext
&rng,
double
p,
size_t
rows = 1,
size_t
cols = 1,
70
std::pmr::memory_resource *mr =
nullptr
);
71
79
std::tuple<double, double>
geostat
(
double
p);
80
81
83
}
// namespace nk::stats
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::geornd
Value geornd(::nk::ops::RngContext &rng, double p, size_t rows=1, size_t cols=1, std::pmr::memory_resource *mr=nullptr)
Geometric random samples (r = geornd(p, rows, cols)).
nk::stats::geoinv
Value geoinv(const Value &q, double p, std::pmr::memory_resource *mr=nullptr)
Geometric inverse cdf (k = geoinv(q, p)).
nk::stats::geocdf
Value geocdf(const Value &k, double p, std::pmr::memory_resource *mr=nullptr)
Geometric cdf (F = geocdf(k, p)).
nk::stats::geopdf
Value geopdf(const Value &k, double p, std::pmr::memory_resource *mr=nullptr)
Geometric pmf (y = geopdf(k, p)).
nk::stats::geostat
std::tuple< double, double > geostat(double p)
Geometric mean and variance ([m, v] = geostat(p)).
src
toolboxes
stats
include
nk
stats
distributions
geometric.hpp
Generated by
1.17.0