nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
exponential.hpp
Go to the documentation of this file.
1
3// toolboxes/stats/include/nk/stats/distributions/exponential.hpp
4//
5// Exponential distribution. Parameterized by the MEAN μ
6// (NOT the rate λ): f(x; μ) = exp(-x/μ) / μ. Special case Gamma(1, μ).
7
8#pragma once
9
10#include <memory_resource>
11#include <nk/value/value.hpp>
12
13#include <tuple>
14
15namespace nk {
16
19 namespace ops { class RngContext; } }
20
21namespace nk::stats {
22
33Value exppdf(const Value &x, double mu, std::pmr::memory_resource *mr = nullptr);
34
44Value expcdf(const Value &x, double mu, std::pmr::memory_resource *mr = nullptr);
45
55Value expinv(const Value &p, double mu, std::pmr::memory_resource *mr = nullptr);
56
67Value exprnd(::nk::ops::RngContext &rng, double mu, size_t rows = 1, size_t cols = 1, std::pmr::memory_resource *mr = nullptr);
68
76std::tuple<double, double> expstat(double mu);
77
78
80} // namespace nk::stats
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value expcdf(const Value &x, double mu, std::pmr::memory_resource *mr=nullptr)
Exponential cdf (F = expcdf(x, mu)).
Value expinv(const Value &p, double mu, std::pmr::memory_resource *mr=nullptr)
Exponential inverse cdf (x = expinv(p, mu)).
Value exprnd(::nk::ops::RngContext &rng, double mu, size_t rows=1, size_t cols=1, std::pmr::memory_resource *mr=nullptr)
Exponential random samples (r = exprnd(mu, rows, cols)).
Value exppdf(const Value &x, double mu, std::pmr::memory_resource *mr=nullptr)
Exponential pdf (y = exppdf(x, mu)).
std::tuple< double, double > expstat(double mu)
Exponential mean and variance ([m, v] = expstat(mu)).