[rand.dist.norm.t]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@104052 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 student_t_distribution
|
||||
|
||||
// student_t_distribution& operator=(const student_t_distribution&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d1(20.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 student_t_distribution
|
||||
|
||||
// student_t_distribution(const student_t_distribution&);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d1(21.75);
|
||||
D 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 student_t_distribution
|
||||
|
||||
// explicit student_t_distribution(result_type alpha = 0, result_type beta = 1);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d;
|
||||
assert(d.n() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d(14.5);
|
||||
assert(d.n() == 14.5);
|
||||
}
|
||||
}
|
||||
@@ -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 student_t_distribution
|
||||
|
||||
// explicit student_t_distribution(const param_type& parm);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(0.25);
|
||||
D d(p);
|
||||
assert(d.n() == 0.25);
|
||||
}
|
||||
}
|
||||
@@ -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 student_t_distribution
|
||||
|
||||
// bool operator=(const student_t_distribution& x,
|
||||
// const student_t_distribution& y);
|
||||
// bool operator!(const student_t_distribution& x,
|
||||
// const student_t_distribution& y);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d1(2.5);
|
||||
D d2(2.5);
|
||||
assert(d1 == d2);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d1(4);
|
||||
D d2(4.5);
|
||||
assert(d1 != d2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 student_t_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::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d(5.5);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = d.n() / (d.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (d.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 0.2);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d(10);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = d.n() / (d.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (d.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 0.04);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d(100);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = d.n() / (d.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (d.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 0.02);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 student_t_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::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d;
|
||||
P p(5.5);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = p.n() / (p.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (p.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 0.2);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d;
|
||||
P p(10);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = p.n() / (p.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (p.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 0.04);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
typedef std::minstd_rand G;
|
||||
G g;
|
||||
D d;
|
||||
P p(100);
|
||||
const int N = 1000000;
|
||||
std::vector<D::result_type> u;
|
||||
for (int i = 0; i < N; ++i)
|
||||
u.push_back(d(g, p));
|
||||
double mean = std::accumulate(u.begin(), u.end(), 0.0) / u.size();
|
||||
double var = 0;
|
||||
double skew = 0;
|
||||
double kurtosis = 0;
|
||||
for (int i = 0; i < u.size(); ++i)
|
||||
{
|
||||
double d = (u[i] - mean);
|
||||
double d2 = sqr(d);
|
||||
var += d2;
|
||||
skew += d * d2;
|
||||
kurtosis += d2 * d2;
|
||||
}
|
||||
var /= u.size();
|
||||
double dev = std::sqrt(var);
|
||||
skew /= u.size() * dev * var;
|
||||
kurtosis /= u.size() * var * var;
|
||||
kurtosis -= 3;
|
||||
double x_mean = 0;
|
||||
double x_var = p.n() / (p.n() - 2);
|
||||
double x_skew = 0;
|
||||
double x_kurtosis = 6 / (p.n() - 4);
|
||||
assert(std::abs(mean - x_mean) < 0.01);
|
||||
assert(std::abs(var - x_var) / x_var < 0.01);
|
||||
assert(std::abs(skew - x_skew) < 0.01);
|
||||
assert(std::abs(kurtosis - x_kurtosis) / x_kurtosis < 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 student_t_distribution
|
||||
|
||||
// param_type param() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(.125);
|
||||
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 student_t_distribution
|
||||
|
||||
// template <class CharT, class Traits, class RealType>
|
||||
// basic_ostream<CharT, Traits>&
|
||||
// operator<<(basic_ostream<CharT, Traits>& os,
|
||||
// const student_t_distribution<RealType>& x);
|
||||
|
||||
// template <class CharT, class Traits, class RealType>
|
||||
// basic_istream<CharT, Traits>&
|
||||
// operator>>(basic_istream<CharT, Traits>& is,
|
||||
// student_t_distribution<RealType>& x);
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d1(7);
|
||||
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 student_t_distribution
|
||||
|
||||
// result_type max() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d(5);
|
||||
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 student_t_distribution
|
||||
|
||||
// result_type min() const;
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
D d(.5);
|
||||
assert(d.min() == -INFINITY);
|
||||
}
|
||||
}
|
||||
@@ -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 student_t_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p0(.75);
|
||||
param_type p;
|
||||
p = p0;
|
||||
assert(p.n() == .75);
|
||||
}
|
||||
}
|
||||
@@ -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 student_t_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p0(10);
|
||||
param_type p = p0;
|
||||
assert(p.n() == 10);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 student_t_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p;
|
||||
assert(p.n() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p(10);
|
||||
assert(p.n() == 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 student_t_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p1(0.75);
|
||||
param_type p2(0.75);
|
||||
assert(p1 == p2);
|
||||
}
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type param_type;
|
||||
param_type p1(0.75);
|
||||
param_type p2(0.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 student_t_distribution
|
||||
// {
|
||||
// class param_type;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_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 student_t_distribution;
|
||||
|
||||
// void param(const param_type& parm);
|
||||
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::param_type P;
|
||||
P p(0.25);
|
||||
D d(0.75);
|
||||
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 student_t_distribution
|
||||
// {
|
||||
// public:
|
||||
// // types
|
||||
// typedef RealType result_type;
|
||||
|
||||
#include <random>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef std::student_t_distribution<> D;
|
||||
typedef D::result_type result_type;
|
||||
static_assert((std::is_same<result_type, double>::value), "");
|
||||
}
|
||||
{
|
||||
typedef std::student_t_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