diff --git a/include/chrono b/include/chrono index 911a95ec7..1c79c6840 100644 --- a/include/chrono +++ b/include/chrono @@ -264,7 +264,7 @@ namespace chrono template > class duration; -template +template struct __is_duration : false_type {}; template diff --git a/include/cstddef b/include/cstddef index c939f0ea9..11d07a2ec 100644 --- a/include/cstddef +++ b/include/cstddef @@ -57,13 +57,13 @@ struct nullptr_t _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;} - template + template _LIBCPP_ALWAYS_INLINE - operator T* () const {return 0;} + operator _Tp* () const {return 0;} - template + template _LIBCPP_ALWAYS_INLINE - operator T U::* () const {return 0;} + operator _Tp _Up::* () const {return 0;} friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;} diff --git a/include/random b/include/random index c1734146d..f1ae33b3b 100644 --- a/include/random +++ b/include/random @@ -1296,7 +1296,62 @@ public: }; template - class fisher_f_distribution; +class fisher_f_distribution +{ +public: + // types + typedef RealType result_type; + + class param_type + { + public: + typedef result_type distribution_type; + + explicit param_type(result_type m = 1, result_type n = 1); + + result_type m() const; + result_type n() const; + + friend bool operator==(const param_type& x, const param_type& y); + friend bool operator!=(const param_type& x, const param_type& y); + }; + + // constructor and reset functions + explicit fisher_f_distribution(result_type m = 1, result_type n = 1); + explicit fisher_f_distribution(const param_type& parm); + void reset(); + + // generating functions + template result_type operator()(URNG& g); + template result_type operator()(URNG& g, const param_type& parm); + + // property functions + result_type m() const; + result_type n() const; + + param_type param() const; + void param(const param_type& parm); + + result_type min() const; + result_type max() const; + + friend bool operator==(const fisher_f_distribution& x, + const fisher_f_distribution& y); + friend bool operator!=(const fisher_f_distribution& x, + const fisher_f_distribution& y); + + template + friend + basic_ostream& + operator<<(basic_ostream& os, + const fisher_f_distribution& x); + + template + friend + basic_istream& + operator>>(basic_istream& is, + fisher_f_distribution& x); +}; template class student_t_distribution; @@ -4921,18 +4976,6 @@ public: friend bool operator!=(const cauchy_distribution& __x, const cauchy_distribution& __y) {return !(__x == __y);} - - template - friend - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, - const cauchy_distribution<_RT>& __x); - - template - friend - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, - cauchy_distribution<_RT>& __x); }; template @@ -4977,6 +5020,109 @@ operator>>(basic_istream<_CharT, _Traits>& __is, return __is; } +// fisher_f_distribution + +template +class fisher_f_distribution +{ +public: + // types + typedef _RealType result_type; + + class param_type + { + result_type __m_; + result_type __n_; + public: + typedef fisher_f_distribution distribution_type; + + explicit param_type(result_type __m = 1, result_type __n = 1) + : __m_(__m), __n_(__n) {} + + result_type m() const {return __m_;} + result_type n() const {return __n_;} + + friend bool operator==(const param_type& __x, const param_type& __y) + {return __x.__m_ == __y.__m_ && __x.__n_ == __y.__n_;} + friend bool operator!=(const param_type& __x, const param_type& __y) + {return !(__x == __y);} + }; + +private: + param_type __p_; + +public: + // constructor and reset functions + explicit fisher_f_distribution(result_type __m = 1, result_type __n = 1) + : __p_(param_type(__m, __n)) {} + explicit fisher_f_distribution(const param_type& __p) + : __p_(__p) {} + void reset() {} + + // generating functions + template result_type operator()(_URNG& __g) + {return (*this)(__g, __p_);} + template result_type operator()(_URNG& __g, const param_type& __p); + + // property functions + result_type m() const {return __p_.m();} + result_type n() const {return __p_.n();} + + param_type param() const {return __p_;} + void param(const param_type& __p) {__p_ = __p;} + + result_type min() const {return 0;} + result_type max() const {return numeric_limits::infinity();} + + friend bool operator==(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) + {return __x.__p_ == __y.__p_;} + friend bool operator!=(const fisher_f_distribution& __x, + const fisher_f_distribution& __y) + {return !(__x == __y);} +}; + +template +template +_RealType +fisher_f_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) +{ + gamma_distribution __gdm(__p.m() * result_type(.5)); + gamma_distribution __gdn(__p.n() * result_type(.5)); + return __p.n() * __gdm(__g) / (__p.m() * __gdn(__g)); +} + +template +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, + const fisher_f_distribution<_RT>& __x) +{ + __save_flags<_CharT, _Traits> _(__os); + __os.flags(ios_base::dec | ios_base::left); + _CharT __sp = __os.widen(' '); + __os.fill(__sp); + __os << __x.m() << __sp << __x.n(); + return __os; +} + +template +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, + fisher_f_distribution<_RT>& __x) +{ + typedef fisher_f_distribution<_RT> _Eng; + typedef typename _Eng::result_type result_type; + typedef typename _Eng::param_type param_type; + __save_flags<_CharT, _Traits> _(__is); + __is.flags(ios_base::dec | ios_base::skipws); + result_type __m; + result_type __n; + __is >> __m >> __n; + if (!__is.fail()) + __x.param(param_type(__m, __n)); + return __is; +} + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_RANDOM diff --git a/include/ratio b/include/ratio index 2d217c129..ca5be9cd9 100644 --- a/include/ratio +++ b/include/ratio @@ -239,7 +239,7 @@ public: template const intmax_t ratio<_Num, _Den>::num; template const intmax_t ratio<_Num, _Den>::den; -template struct __is_ratio : false_type {}; +template struct __is_ratio : false_type {}; template struct __is_ratio > : true_type {}; typedef ratio<1LL, 1000000000000000000LL> atto; diff --git a/include/type_traits b/include/type_traits index b838b1762..37e970815 100644 --- a/include/type_traits +++ b/include/type_traits @@ -395,7 +395,7 @@ template struct add_volatile {typedef typename __add_volatile<_Tp>:: // add_cv -template struct add_cv {typedef typename add_const::type>::type type;}; +template struct add_cv {typedef typename add_const::type>::type type;}; // remove_reference @@ -1154,86 +1154,86 @@ forward(_Up&& __t) #else // _LIBCPP_MOVE -template +template class __rv { - typedef typename remove_reference::type Trr; - Trr& t_; + typedef typename remove_reference<_Tp>::type _Trr; + _Trr& t_; public: - Trr* operator->() {return &t_;} - explicit __rv(Trr& t) : t_(t) {} + _Trr* operator->() {return &t_;} + explicit __rv(_Trr& __t) : t_(__t) {} }; -template +template inline typename enable_if < - !is_convertible >::value, - T& + !is_convertible<_Tp, __rv<_Tp> >::value, + _Tp& >::type -move(T& t) +move(_Tp& __t) { - return t; + return __t; } -template +template inline typename enable_if < - is_convertible >::value, - T + is_convertible<_Tp, __rv<_Tp> >::value, + _Tp >::type -move(T& t) +move(_Tp& __t) { - return T(__rv(t)); + return _Tp(__rv<_Tp>(__t)); } -template +template inline typename enable_if < - !is_convertible >::value, - typename add_lvalue_reference::type + !is_convertible<_Tp, __rv<_Tp> >::value, + typename add_lvalue_reference<_Tp>::type >::type -forward(U& t) +forward(_Up& __t) { - return t; + return __t; } -template +template inline typename enable_if < - !is_convertible >::value, - typename add_lvalue_reference::type + !is_convertible<_Tp, __rv<_Tp> >::value, + typename add_lvalue_reference<_Tp>::type >::type -forward(const U& t) +forward(const _Up& __t) { - return t; + return __t; } -template +template inline typename enable_if < - is_convertible >::value, - T + is_convertible<_Tp, __rv<_Tp> >::value, + _Tp >::type -forward(U& t) +forward(_Up& __t) { - return T(__rv(t)); + return _Tp(__rv<_Tp>(__t)); } -template +template inline typename enable_if < - is_convertible >::value, - T + is_convertible<_Tp, __rv<_Tp> >::value, + _Tp >::type -forward(const U& t) +forward(const _Up& __t) { - return T(__rv(t)); + return _Tp(__rv<_Tp>(__t)); } #endif // _LIBCPP_MOVE diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp new file mode 100644 index 000000000..57d1270fe --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/assign.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// fisher_f_distribution& operator=(const fisher_f_distribution&); + +#include +#include + +void +test1() +{ + typedef std::fisher_f_distribution<> D; + D d1(20, 0.75); + D d2; + assert(d1 != d2); + d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp new file mode 100644 index 000000000..128325f05 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/copy.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// fisher_f_distribution(const fisher_f_distribution&); + +#include +#include + +void +test1() +{ + typedef std::fisher_f_distribution<> D; + D d1(20, 1.75); + D d2 = d1; + assert(d1 == d2); +} + +int main() +{ + test1(); +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp new file mode 100644 index 000000000..c496a886f --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_double_double.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// explicit fisher_f_distribution(result_type alpha = 0, result_type beta = 1); + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d; + assert(d.m() == 1); + assert(d.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + D d(14.5); + assert(d.m() == 14.5); + assert(d.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + D d(14.5, 5.25); + assert(d.m() == 14.5); + assert(d.n() == 5.25); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp new file mode 100644 index 000000000..c6d0a9c15 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/ctor_param.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// explicit fisher_f_distribution(const param_type& parm); + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + P p(0.25, 10); + D d(p); + assert(d.m() == 0.25); + assert(d.n() == 10); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp new file mode 100644 index 000000000..352ddbc1e --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eq.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// bool operator=(const fisher_f_distribution& x, +// const fisher_f_distribution& y); +// bool operator!(const fisher_f_distribution& x, +// const fisher_f_distribution& y); + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d1(2.5, 4); + D d2(2.5, 4); + assert(d1 == d2); + } + { + typedef std::fisher_f_distribution<> D; + D d1(2.5, 4); + D d2(2.5, 4.5); + assert(d1 != d2); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp new file mode 100644 index 000000000..4352f577a --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp @@ -0,0 +1,104 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// template result_type operator()(_URNG& g); + +#include +#include +#include +#include +#include + +double fac(double x) +{ + double r = 1; + for (; x > 1; --x) + r *= x; + return r; +} + +double +I(double x, unsigned a, unsigned b) +{ + double r = 0; + for (int j = a; j <= a+b-1; ++j) + r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * + std::pow(1-x, a+b-1-j); + return r; +} + +double +f(double x, double m, double n) +{ + return I(m * x / (m*x + n), static_cast(m/2), static_cast(n/2)); +} + +int main() +{ + // Purposefully only testing even integral values of m and n (for now) + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(2, 4); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(4, 2); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(18, 20); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], d.m(), d.n()) - double(i)/N) < .01); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp new file mode 100644 index 000000000..e9ad52f18 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp @@ -0,0 +1,107 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// template result_type operator()(_URNG& g, const param_type& parm); + +#include +#include +#include +#include +#include + +double fac(double x) +{ + double r = 1; + for (; x > 1; --x) + r *= x; + return r; +} + +double +I(double x, unsigned a, unsigned b) +{ + double r = 0; + for (int j = a; j <= a+b-1; ++j) + r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) * + std::pow(1-x, a+b-1-j); + return r; +} + +double +f(double x, double m, double n) +{ + return I(m * x / (m*x + n), static_cast(m/2), static_cast(n/2)); +} + +int main() +{ + // Purposefully only testing even integral values of m and n (for now) + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(2, 4); + P p(4, 2); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(4, 2); + P p(6, 8); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + typedef std::mt19937 G; + G g; + D d(18, 20); + P p(16, 14); + const int N = 100000; + std::vector u; + for (int i = 0; i < N; ++i) + { + D::result_type v = d(g, p); + assert(v >= 0); + u.push_back(v); + } + std::sort(u.begin(), u.end()); + for (int i = 0; i < N; ++i) + assert(std::abs(f(u[i], p.m(), p.n()) - double(i)/N) < .01); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp new file mode 100644 index 000000000..af7f70f04 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/get_param.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// param_type param() const; + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type P; + P p(.125, .5); + D d(p); + assert(d.param() == p); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp new file mode 100644 index 000000000..66d3b2740 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/io.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// template +// basic_ostream& +// operator<<(basic_ostream& os, +// const fisher_f_distribution& x); + +// template +// basic_istream& +// operator>>(basic_istream& is, +// fisher_f_distribution& x); + +#include +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d1(7, 5); + std::ostringstream os; + os << d1; + std::istringstream is(os.str()); + D d2; + is >> d2; + assert(d1 == d2); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp new file mode 100644 index 000000000..a388d15be --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/max.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// result_type max() const; + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d(5, .25); + D::result_type m = d.max(); + assert(m == INFINITY); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp new file mode 100644 index 000000000..7e7aae6b9 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/min.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution + +// result_type min() const; + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + D d(.5, .5); + assert(d.min() == 0); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp new file mode 100644 index 000000000..b335b1fbe --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_assign.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// class param_type; + +#include +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p0(.75, 6); + param_type p; + p = p0; + assert(p.m() == .75); + assert(p.n() == 6); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp new file mode 100644 index 000000000..37539b6bd --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_copy.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// class param_type; + +#include +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p0(10, .125); + param_type p = p0; + assert(p.m() == 10); + assert(p.n() == .125); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp new file mode 100644 index 000000000..90ac53730 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_ctor.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// class param_type; + +#include +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p; + assert(p.m() == 1); + assert(p.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p(10); + assert(p.m() == 10); + assert(p.n() == 1); + } + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p(10, 5); + assert(p.m() == 10); + assert(p.n() == 5); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp new file mode 100644 index 000000000..d2b16ba32 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_eq.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// class param_type; + +#include +#include +#include + +int main() +{ + { + typedef std::fisher_f_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::fisher_f_distribution<> D; + typedef D::param_type param_type; + param_type p1(0.75, .5); + param_type p2(0.5, .5); + assert(p1 != p2); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp new file mode 100644 index 000000000..3649c8fc7 --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/param_types.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// class param_type; + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::param_type param_type; + typedef param_type::distribution_type distribution_type; + static_assert((std::is_same::value), ""); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp new file mode 100644 index 000000000..a0f1be0aa --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/set_param.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution; + +// void param(const param_type& parm); + +#include +#include + +int main() +{ + { + typedef std::fisher_f_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); + } +} diff --git a/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp new file mode 100644 index 000000000..ede9ae79b --- /dev/null +++ b/test/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/types.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// class fisher_f_distribution +// { +// public: +// // types +// typedef RealType result_type; + +#include +#include + +int main() +{ + { + typedef std::fisher_f_distribution<> D; + typedef D::result_type result_type; + static_assert((std::is_same::value), ""); + } + { + typedef std::fisher_f_distribution D; + typedef D::result_type result_type; + static_assert((std::is_same::value), ""); + } +}