RandLib 2.0.0
Probability distributions, fitting, and heavy-tail tools for C++20
Loading...
Searching...
No Matches
moments.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <randlib/fit/mle.hpp>
4
5#include <ranges>
6#include <span>
7#include <type_traits>
8
9namespace randlib
10{
11
12template <class Distribution>
14FitResult<Distribution> fit_moments(std::span<const typename Distribution::value_type> sample)
15{
16 return fit<Distribution>(sample, Method::MethodOfMoments);
17}
18
19template <class Distribution, std::ranges::contiguous_range Range>
20 requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Range>>, typename Distribution::value_type> &&
23{
24 return fit_moments<Distribution>(std::span<const typename Distribution::value_type>(sample));
25}
26
27} // namespace randlib
Real standardNormal(G &g)
Ziggurat algorithm of Marsaglia and Tsang with 256 layers and an explicit sign bit.
Definition variates.hpp:45
Definition bivariate_normal.hpp:10
FitResult< Distribution > fit_moments(std::span< const typename Distribution::value_type > sample)
Definition moments.hpp:14
Definition result.hpp:36