[rand.dist.pois.weibull]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103891 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// weibull_distribution& operator=(const weibull_distribution&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d1(20, 0.75);
|
||||
D d2;
|
||||
assert(d1 != d2);
|
||||
d2 = d1;
|
||||
assert(d1 == d2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// weibull_distribution(const weibull_distribution&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d1(20, 1.75);
|
||||
D d2 = d1;
|
||||
assert(d1 == d2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test1();
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// explicit weibull_distribution(result_type a = 0, result_type b = 1);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d;
|
||||
assert(d.a() == 1);
|
||||
assert(d.b() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d(14.5);
|
||||
assert(d.a() == 14.5);
|
||||
assert(d.b() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d(14.5, 5.25);
|
||||
assert(d.a() == 14.5);
|
||||
assert(d.b() == 5.25);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// explicit weibull_distribution(const param_type& parm);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(0.25, 10);
|
||||
D d(p);
|
||||
assert(d.a() == 0.25);
|
||||
assert(d.b() == 10);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// bool operator=(const weibull_distribution& x,
|
||||
// const weibull_distribution& y);
|
||||
// bool operator!(const weibull_distribution& x,
|
||||
// const weibull_distribution& y);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d1(2.5, 4);
|
||||
D d2(2.5, 4);
|
||||
assert(d1 == d2);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d1(2.5, 4);
|
||||
D d2(2.5, 4.5);
|
||||
assert(d1 != d2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// template<class _URNG> result_type operator()(_URNG& g);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
T
|
||||
sqr(T x)
|
||||
{
|
||||
return x * x;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(0.5, 2);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = d.b() * std::tgamma(1 + 1/d.a());
|
||||
D::result_type x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(1, .5);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = d.b() * std::tgamma(1 + 1/d.a());
|
||||
D::result_type x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(2, 3);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = d.b() * std::tgamma(1 + 1/d.a());
|
||||
D::result_type x_var = sqr(d.b()) * std::tgamma(1 + 2/d.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
T
|
||||
sqr(T x)
|
||||
{
|
||||
return x * x;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(0.5, 2);
|
||||
P p(1, .5);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = p.b() * std::tgamma(1 + 1/p.a());
|
||||
D::result_type x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(1, .5);
|
||||
P p(2, 3);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = p.b() * std::tgamma(1 + 1/p.a());
|
||||
D::result_type x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::mt19937 G;
|
||||
G g;
|
||||
D d(2, 3);
|
||||
P p(.5, 2);
|
||||
const int N = 100000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
D::result_type mean = std::accumulate(u.begin(), u.end(),
|
||||
D::result_type(0)) / u.size();
|
||||
D::result_type var = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
var += sqr(u[i] - mean);
|
||||
var /= u.size();
|
||||
D::result_type x_mean = p.b() * std::tgamma(1 + 1/p.a());
|
||||
D::result_type x_var = sqr(p.b()) * std::tgamma(1 + 2/p.a()) - sqr(x_mean);
|
||||
assert(std::abs(mean - x_mean) / x_mean < 0.02);
|
||||
assert(std::abs(var - x_var) / x_var < 0.02);
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// param_type param() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(.125, .5);
|
||||
D d(p);
|
||||
assert(d.param() == p);
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// template <class CharT, class Traits, class RealType>
|
||||
// basic_ostream<CharT, Traits>&
|
||||
// operator<<(basic_ostream<CharT, Traits>& os,
|
||||
// const weibull_distribution<RealType>& x);
|
||||
|
||||
// template <class CharT, class Traits, class RealType>
|
||||
// basic_istream<CharT, Traits>&
|
||||
// operator>>(basic_istream<CharT, Traits>& is,
|
||||
// weibull_distribution<RealType>& x);
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d1(7, 5);
|
||||
std::ostringstream os;
|
||||
os << d1;
|
||||
std::istringstream is(os.str());
|
||||
D d2;
|
||||
is >> d2;
|
||||
assert(d1 == d2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// result_type max() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d(5, .25);
|
||||
D::result_type m = d.max();
|
||||
assert(m == INFINITY);
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
|
||||
// result_type min() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
D d(.5, .5);
|
||||
assert(d.min() == 0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p0(.75, 6);
|
||||
param_type p;
|
||||
p = p0;
|
||||
assert(p.a() == .75);
|
||||
assert(p.b() == 6);
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p0(10, .125);
|
||||
param_type p = p0;
|
||||
assert(p.a() == 10);
|
||||
assert(p.b() == .125);
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p;
|
||||
assert(p.a() == 1);
|
||||
assert(p.b() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p(10);
|
||||
assert(p.a() == 10);
|
||||
assert(p.b() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p(10, 5);
|
||||
assert(p.a() == 10);
|
||||
assert(p.b() == 5);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p1(0.75, .5);
|
||||
param_type p2(0.75, .5);
|
||||
assert(p1 == p2);
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p1(0.75, .5);
|
||||
param_type p2(0.5, .5);
|
||||
assert(p1 != p2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
typedef param_type::distribution_type distribution_type;
|
||||
static_assert((std::is_same<D, distribution_type>::value), "");
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution;
|
||||
|
||||
// void param(const param_type& parm);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(0.25, 5.5);
|
||||
D d(0.75, 4);
|
||||
d.param(p);
|
||||
assert(d.param() == p);
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <random>
|
||||
|
||||
// template<class RealType = double>
|
||||
// class weibull_distribution
|
||||
// {
|
||||
// public:
|
||||
// // types
|
||||
// typedef RealType result_type;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::weibull_distribution<> D;
|
||||
typedef D::result_type result_type;
|
||||
static_assert((std::is_same<result_type, double>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::weibull_distribution<float> D;
|
||||
typedef D::result_type result_type;
|
||||
static_assert((std::is_same<result_type, float>::value), "");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user