Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CopulaFactory.cpp
Go to the documentation of this file.
1#include "CopulaFactory.h"
2
13std::unique_ptr<ICopula> make(unsigned int seed, CopulaConfig cfg) {
14 return std::visit([seed](auto&& c) -> std::unique_ptr<ICopula> {
15 using T = std::decay_t<decltype(c)>;
16 if constexpr (std::is_same_v<T, GaussianCopulaConfig>)
17 return std::make_unique<GaussianCopula>(seed, c.R);
18 else if constexpr (std::is_same_v<T, StudentTCopulaConfig>)
19 return std::make_unique<StudentTCopula>(seed, c.R, c.nu);
20 }, cfg);
21}
22
23std::unique_ptr<ICopula> CopulaFactory::create(CopulaType name,
24 CopulaConfig config,
25 unsigned int seed) {
26 switch (name) {
28 return make(seed, config);
30 return make(seed, config);
31 default:
32 throw std::invalid_argument("Unknown copula.");
33 }
34}
std::unique_ptr< ICopula > make(unsigned int seed, CopulaConfig cfg)
Internal helper constructing a copula from the active variant alternative.
Factory utilities for constructing copula objects from typed configurations.
CopulaType
Identifies the copula family used to model dependence.
Definition CopulaType.h:32
@ GAUSSIAN
Gaussian copula, defined by a correlation matrix.
@ STUDENT_T
Student-t copula, defined by a correlation matrix and degrees of freedom.
static std::unique_ptr< ICopula > create(CopulaType name, CopulaConfig config, unsigned int seed=std::random_device{}())
Creates a concrete copula instance.
double T(double x)
Wilson coefficient T(x).