complement.hpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // (C) Copyright John Maddock 2006.
  2. // (C) Copyright Paul A. Bristow 2006.
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_STATS_COMPLEMENT_HPP
  7. #define BOOST_STATS_COMPLEMENT_HPP
  8. //
  9. // This code really defines our own tuple type.
  10. // It would be nice to reuse boost::math::tuple
  11. // while retaining our own type safety, but it's
  12. // not clear if that's possible. In any case this
  13. // code is *very* lightweight.
  14. //
  15. namespace boost{ namespace math{
  16. template <class Dist, class RealType>
  17. struct complemented2_type
  18. {
  19. complemented2_type(
  20. const Dist& d,
  21. const RealType& p1)
  22. : dist(d),
  23. param(p1) {}
  24. const Dist& dist;
  25. const RealType& param;
  26. private:
  27. complemented2_type& operator=(const complemented2_type&);
  28. };
  29. template <class Dist, class RealType1, class RealType2>
  30. struct complemented3_type
  31. {
  32. complemented3_type(
  33. const Dist& d,
  34. const RealType1& p1,
  35. const RealType2& p2)
  36. : dist(d),
  37. param1(p1),
  38. param2(p2) {}
  39. const Dist& dist;
  40. const RealType1& param1;
  41. const RealType2& param2;
  42. private:
  43. complemented3_type& operator=(const complemented3_type&);
  44. };
  45. template <class Dist, class RealType1, class RealType2, class RealType3>
  46. struct complemented4_type
  47. {
  48. complemented4_type(
  49. const Dist& d,
  50. const RealType1& p1,
  51. const RealType2& p2,
  52. const RealType3& p3)
  53. : dist(d),
  54. param1(p1),
  55. param2(p2),
  56. param3(p3) {}
  57. const Dist& dist;
  58. const RealType1& param1;
  59. const RealType2& param2;
  60. const RealType3& param3;
  61. private:
  62. complemented4_type& operator=(const complemented4_type&);
  63. };
  64. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4>
  65. struct complemented5_type
  66. {
  67. complemented5_type(
  68. const Dist& d,
  69. const RealType1& p1,
  70. const RealType2& p2,
  71. const RealType3& p3,
  72. const RealType4& p4)
  73. : dist(d),
  74. param1(p1),
  75. param2(p2),
  76. param3(p3),
  77. param4(p4) {}
  78. const Dist& dist;
  79. const RealType1& param1;
  80. const RealType2& param2;
  81. const RealType3& param3;
  82. const RealType4& param4;
  83. private:
  84. complemented5_type& operator=(const complemented5_type&);
  85. };
  86. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5>
  87. struct complemented6_type
  88. {
  89. complemented6_type(
  90. const Dist& d,
  91. const RealType1& p1,
  92. const RealType2& p2,
  93. const RealType3& p3,
  94. const RealType4& p4,
  95. const RealType5& p5)
  96. : dist(d),
  97. param1(p1),
  98. param2(p2),
  99. param3(p3),
  100. param4(p4),
  101. param5(p5) {}
  102. const Dist& dist;
  103. const RealType1& param1;
  104. const RealType2& param2;
  105. const RealType3& param3;
  106. const RealType4& param4;
  107. const RealType5& param5;
  108. private:
  109. complemented6_type& operator=(const complemented6_type&);
  110. };
  111. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5, class RealType6>
  112. struct complemented7_type
  113. {
  114. complemented7_type(
  115. const Dist& d,
  116. const RealType1& p1,
  117. const RealType2& p2,
  118. const RealType3& p3,
  119. const RealType4& p4,
  120. const RealType5& p5,
  121. const RealType6& p6)
  122. : dist(d),
  123. param1(p1),
  124. param2(p2),
  125. param3(p3),
  126. param4(p4),
  127. param5(p5),
  128. param6(p6) {}
  129. const Dist& dist;
  130. const RealType1& param1;
  131. const RealType2& param2;
  132. const RealType3& param3;
  133. const RealType4& param4;
  134. const RealType5& param5;
  135. const RealType6& param6;
  136. private:
  137. complemented7_type& operator=(const complemented7_type&);
  138. };
  139. template <class Dist, class RealType>
  140. inline complemented2_type<Dist, RealType> complement(const Dist& d, const RealType& r)
  141. {
  142. return complemented2_type<Dist, RealType>(d, r);
  143. }
  144. template <class Dist, class RealType1, class RealType2>
  145. inline complemented3_type<Dist, RealType1, RealType2> complement(const Dist& d, const RealType1& r1, const RealType2& r2)
  146. {
  147. return complemented3_type<Dist, RealType1, RealType2>(d, r1, r2);
  148. }
  149. template <class Dist, class RealType1, class RealType2, class RealType3>
  150. inline complemented4_type<Dist, RealType1, RealType2, RealType3> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3)
  151. {
  152. return complemented4_type<Dist, RealType1, RealType2, RealType3>(d, r1, r2, r3);
  153. }
  154. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4>
  155. inline complemented5_type<Dist, RealType1, RealType2, RealType3, RealType4> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4)
  156. {
  157. return complemented5_type<Dist, RealType1, RealType2, RealType3, RealType4>(d, r1, r2, r3, r4);
  158. }
  159. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5>
  160. inline complemented6_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4, const RealType5& r5)
  161. {
  162. return complemented6_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5>(d, r1, r2, r3, r4, r5);
  163. }
  164. template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5, class RealType6>
  165. inline complemented7_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5, RealType6> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4, const RealType5& r5, const RealType6& r6)
  166. {
  167. return complemented7_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5, RealType6>(d, r1, r2, r3, r4, r5, r6);
  168. }
  169. } // namespace math
  170. } // namespace boost
  171. #endif // BOOST_STATS_COMPLEMENT_HPP