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 | |
7 | #ifndef BOOST_STATS_COMPLEMENT_HPP |
8 | #define BOOST_STATS_COMPLEMENT_HPP |
9 | |
10 | // |
11 | // This code really defines our own tuple type. |
12 | // It would be nice to reuse boost::math::tuple |
13 | // while retaining our own type safety, but it's |
14 | // not clear if that's possible. In any case this |
15 | // code is *very* lightweight. |
16 | // |
17 | namespace boost{ namespace math{ |
18 | |
19 | template <class Dist, class RealType> |
20 | struct complemented2_type |
21 | { |
22 | complemented2_type( |
23 | const Dist& d, |
24 | const RealType& p1) |
25 | : dist(d), |
26 | param(p1) {} |
27 | |
28 | const Dist& dist; |
29 | const RealType& param; |
30 | |
31 | private: |
32 | complemented2_type& operator=(const complemented2_type&); |
33 | }; |
34 | |
35 | template <class Dist, class RealType1, class RealType2> |
36 | struct complemented3_type |
37 | { |
38 | complemented3_type( |
39 | const Dist& d, |
40 | const RealType1& p1, |
41 | const RealType2& p2) |
42 | : dist(d), |
43 | param1(p1), |
44 | param2(p2) {} |
45 | |
46 | const Dist& dist; |
47 | const RealType1& param1; |
48 | const RealType2& param2; |
49 | private: |
50 | complemented3_type& operator=(const complemented3_type&); |
51 | }; |
52 | |
53 | template <class Dist, class RealType1, class RealType2, class RealType3> |
54 | struct complemented4_type |
55 | { |
56 | complemented4_type( |
57 | const Dist& d, |
58 | const RealType1& p1, |
59 | const RealType2& p2, |
60 | const RealType3& p3) |
61 | : dist(d), |
62 | param1(p1), |
63 | param2(p2), |
64 | param3(p3) {} |
65 | |
66 | const Dist& dist; |
67 | const RealType1& param1; |
68 | const RealType2& param2; |
69 | const RealType3& param3; |
70 | private: |
71 | complemented4_type& operator=(const complemented4_type&); |
72 | }; |
73 | |
74 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4> |
75 | struct complemented5_type |
76 | { |
77 | complemented5_type( |
78 | const Dist& d, |
79 | const RealType1& p1, |
80 | const RealType2& p2, |
81 | const RealType3& p3, |
82 | const RealType4& p4) |
83 | : dist(d), |
84 | param1(p1), |
85 | param2(p2), |
86 | param3(p3), |
87 | param4(p4) {} |
88 | |
89 | const Dist& dist; |
90 | const RealType1& param1; |
91 | const RealType2& param2; |
92 | const RealType3& param3; |
93 | const RealType4& param4; |
94 | private: |
95 | complemented5_type& operator=(const complemented5_type&); |
96 | }; |
97 | |
98 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5> |
99 | struct complemented6_type |
100 | { |
101 | complemented6_type( |
102 | const Dist& d, |
103 | const RealType1& p1, |
104 | const RealType2& p2, |
105 | const RealType3& p3, |
106 | const RealType4& p4, |
107 | const RealType5& p5) |
108 | : dist(d), |
109 | param1(p1), |
110 | param2(p2), |
111 | param3(p3), |
112 | param4(p4), |
113 | param5(p5) {} |
114 | |
115 | const Dist& dist; |
116 | const RealType1& param1; |
117 | const RealType2& param2; |
118 | const RealType3& param3; |
119 | const RealType4& param4; |
120 | const RealType5& param5; |
121 | private: |
122 | complemented6_type& operator=(const complemented6_type&); |
123 | }; |
124 | |
125 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5, class RealType6> |
126 | struct complemented7_type |
127 | { |
128 | complemented7_type( |
129 | const Dist& d, |
130 | const RealType1& p1, |
131 | const RealType2& p2, |
132 | const RealType3& p3, |
133 | const RealType4& p4, |
134 | const RealType5& p5, |
135 | const RealType6& p6) |
136 | : dist(d), |
137 | param1(p1), |
138 | param2(p2), |
139 | param3(p3), |
140 | param4(p4), |
141 | param5(p5), |
142 | param6(p6) {} |
143 | |
144 | const Dist& dist; |
145 | const RealType1& param1; |
146 | const RealType2& param2; |
147 | const RealType3& param3; |
148 | const RealType4& param4; |
149 | const RealType5& param5; |
150 | const RealType6& param6; |
151 | private: |
152 | complemented7_type& operator=(const complemented7_type&); |
153 | }; |
154 | |
155 | template <class Dist, class RealType> |
156 | inline complemented2_type<Dist, RealType> complement(const Dist& d, const RealType& r) |
157 | { |
158 | return complemented2_type<Dist, RealType>(d, r); |
159 | } |
160 | |
161 | template <class Dist, class RealType1, class RealType2> |
162 | inline complemented3_type<Dist, RealType1, RealType2> complement(const Dist& d, const RealType1& r1, const RealType2& r2) |
163 | { |
164 | return complemented3_type<Dist, RealType1, RealType2>(d, r1, r2); |
165 | } |
166 | |
167 | template <class Dist, class RealType1, class RealType2, class RealType3> |
168 | inline complemented4_type<Dist, RealType1, RealType2, RealType3> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3) |
169 | { |
170 | return complemented4_type<Dist, RealType1, RealType2, RealType3>(d, r1, r2, r3); |
171 | } |
172 | |
173 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4> |
174 | inline complemented5_type<Dist, RealType1, RealType2, RealType3, RealType4> complement(const Dist& d, const RealType1& r1, const RealType2& r2, const RealType3& r3, const RealType4& r4) |
175 | { |
176 | return complemented5_type<Dist, RealType1, RealType2, RealType3, RealType4>(d, r1, r2, r3, r4); |
177 | } |
178 | |
179 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5> |
180 | 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) |
181 | { |
182 | return complemented6_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5>(d, r1, r2, r3, r4, r5); |
183 | } |
184 | |
185 | template <class Dist, class RealType1, class RealType2, class RealType3, class RealType4, class RealType5, class RealType6> |
186 | 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) |
187 | { |
188 | return complemented7_type<Dist, RealType1, RealType2, RealType3, RealType4, RealType5, RealType6>(d, r1, r2, r3, r4, r5, r6); |
189 | } |
190 | |
191 | } // namespace math |
192 | } // namespace boost |
193 | |
194 | #endif // BOOST_STATS_COMPLEMENT_HPP |
195 | |
196 | |