[081e5d] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
[0aa122] | 4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
[081e5d] | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
| 9 | * \file RandomNumberDistribution_Encapsulation_impl.hpp
|
---|
| 10 | *
|
---|
| 11 | * Herein we place specializations of specific functions for specific distributions.
|
---|
| 12 | *
|
---|
| 13 | * Created on: Jan 5, 2011
|
---|
| 14 | * Author: heber
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 | // include config.h
|
---|
| 18 | #ifdef HAVE_CONFIG_H
|
---|
| 19 | #include <config.h>
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 | #include "CodePatterns/MemDebug.hpp"
|
---|
| 23 |
|
---|
[ecb6c5] | 24 | #include <limits>
|
---|
| 25 |
|
---|
[081e5d] | 26 | #include "RandomNumberDistribution_Encapsulation.hpp"
|
---|
| 27 |
|
---|
[0275ad] | 28 | /* ========= manipulatedclone() ================ */
|
---|
| 29 |
|
---|
| 30 | template <>
|
---|
| 31 | RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::
|
---|
| 32 | RandomNumberDistribution_Encapsulation (const RandomNumberDistribution_Parameters&_params) :
|
---|
| 33 | distribution_type(_params.min, _params.max)
|
---|
| 34 | {}
|
---|
| 35 |
|
---|
| 36 | template <>
|
---|
| 37 | RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::
|
---|
| 38 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 39 | distribution_type(_params.min, _params.max)
|
---|
| 40 | {}
|
---|
| 41 |
|
---|
| 42 | template <>
|
---|
| 43 | RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::
|
---|
| 44 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 45 | distribution_type(_params.min, _params.max)
|
---|
| 46 | {}
|
---|
| 47 |
|
---|
| 48 | template <>
|
---|
| 49 | RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::
|
---|
| 50 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 51 | distribution_type(_params.p)
|
---|
| 52 | {}
|
---|
| 53 |
|
---|
| 54 | template <>
|
---|
| 55 | RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::
|
---|
| 56 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 57 | distribution_type((int)_params.t, _params.p)
|
---|
| 58 | {}
|
---|
| 59 |
|
---|
| 60 | template <>
|
---|
| 61 | RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::
|
---|
| 62 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 63 | distribution_type(_params.median, _params.sigma)
|
---|
| 64 | {}
|
---|
| 65 |
|
---|
| 66 | template <>
|
---|
| 67 | RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::
|
---|
| 68 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 69 | distribution_type(_params.alpha)
|
---|
| 70 | {}
|
---|
| 71 |
|
---|
| 72 | template <>
|
---|
| 73 | RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::
|
---|
| 74 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 75 | distribution_type(_params.mean)
|
---|
| 76 | {}
|
---|
| 77 |
|
---|
| 78 | template <>
|
---|
| 79 | RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::
|
---|
| 80 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 81 | distribution_type(_params.p)
|
---|
| 82 | {}
|
---|
| 83 |
|
---|
| 84 | template <>
|
---|
| 85 | RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::
|
---|
| 86 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 87 | distribution_type(_params.a, _params.b, _params.c)
|
---|
| 88 | {}
|
---|
| 89 |
|
---|
| 90 | template <>
|
---|
| 91 | RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::
|
---|
| 92 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 93 | distribution_type(_params.lambda)
|
---|
| 94 | {}
|
---|
| 95 |
|
---|
| 96 | template <>
|
---|
| 97 | RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::
|
---|
| 98 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 99 | distribution_type(_params.mean, _params.sigma)
|
---|
| 100 | {}
|
---|
| 101 |
|
---|
| 102 | template <>
|
---|
| 103 | RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::
|
---|
| 104 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
---|
| 105 | distribution_type(_params.mean, _params.sigma)
|
---|
| 106 | {}
|
---|
[081e5d] | 107 |
|
---|
| 108 | /* =============== min() ======================= */
|
---|
| 109 |
|
---|
| 110 | template <>
|
---|
| 111 | double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::min() const
|
---|
| 112 | {
|
---|
| 113 | return distribution_type.min();
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | template <>
|
---|
| 117 | double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::min() const
|
---|
| 118 | {
|
---|
| 119 | return distribution_type.min();
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | template <>
|
---|
| 123 | double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::min() const
|
---|
| 124 | {
|
---|
| 125 | return distribution_type.min();
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | template <>
|
---|
| 129 | double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::min() const
|
---|
| 130 | {
|
---|
| 131 | return distribution_type.min();
|
---|
| 132 | }
|
---|
| 133 |
|
---|
[ecb6c5] | 134 | template <>
|
---|
| 135 | double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::min() const
|
---|
| 136 | {
|
---|
| 137 | return 0.;
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | template <>
|
---|
| 141 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::min() const
|
---|
| 142 | {
|
---|
| 143 | return 0.;
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | template <>
|
---|
| 147 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::min() const
|
---|
| 148 | {
|
---|
| 149 | return std::numeric_limits<double>::min();
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | template <>
|
---|
| 153 | double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::min() const
|
---|
| 154 | {
|
---|
| 155 | return 0.;
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | template <>
|
---|
| 159 | double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::min() const
|
---|
| 160 | {
|
---|
| 161 | return 0.;
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | template <>
|
---|
| 165 | double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::min() const
|
---|
| 166 | {
|
---|
| 167 | return 0.;
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | template <>
|
---|
| 171 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::min() const
|
---|
| 172 | {
|
---|
| 173 | return distribution_type.a();
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | template <>
|
---|
| 177 | double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::min() const
|
---|
| 178 | {
|
---|
| 179 | return 0.;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | template <>
|
---|
| 183 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::min() const
|
---|
| 184 | {
|
---|
| 185 | return std::numeric_limits<double>::min();
|
---|
| 186 | }
|
---|
[081e5d] | 187 |
|
---|
[ecb6c5] | 188 | template <>
|
---|
| 189 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::min() const
|
---|
| 190 | {
|
---|
| 191 | return 0.;
|
---|
| 192 | }
|
---|
[081e5d] | 193 |
|
---|
| 194 | /* =============== max() ======================= */
|
---|
| 195 |
|
---|
| 196 | template <>
|
---|
| 197 | double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::max() const
|
---|
| 198 | {
|
---|
| 199 | return distribution_type.max();
|
---|
| 200 | }
|
---|
| 201 |
|
---|
| 202 | template <>
|
---|
| 203 | double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::max() const
|
---|
| 204 | {
|
---|
| 205 | return distribution_type.max();
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | template <>
|
---|
| 209 | double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::max() const
|
---|
| 210 | {
|
---|
| 211 | return distribution_type.max();
|
---|
| 212 | }
|
---|
| 213 |
|
---|
| 214 | template <>
|
---|
| 215 | double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::max() const
|
---|
| 216 | {
|
---|
| 217 | return distribution_type.max();
|
---|
| 218 | }
|
---|
| 219 |
|
---|
[ecb6c5] | 220 | template <>
|
---|
| 221 | double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::max() const
|
---|
| 222 | {
|
---|
| 223 | return 1.;
|
---|
| 224 | }
|
---|
| 225 |
|
---|
| 226 | template <>
|
---|
| 227 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::max() const
|
---|
| 228 | {
|
---|
| 229 | return distribution_type.t();
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | template <>
|
---|
| 233 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::max() const
|
---|
| 234 | {
|
---|
| 235 | return std::numeric_limits<double>::max();
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 | template <>
|
---|
| 239 | double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::max() const
|
---|
| 240 | {
|
---|
| 241 | return std::numeric_limits<double>::max();
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | template <>
|
---|
| 245 | double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::max() const
|
---|
| 246 | {
|
---|
| 247 | return std::numeric_limits<double>::max();
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | template <>
|
---|
| 251 | double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::max() const
|
---|
| 252 | {
|
---|
| 253 | return std::numeric_limits<double>::max();
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | template <>
|
---|
| 257 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::max() const
|
---|
| 258 | {
|
---|
| 259 | return distribution_type.c();
|
---|
| 260 | }
|
---|
| 261 |
|
---|
| 262 | template <>
|
---|
| 263 | double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::max() const
|
---|
| 264 | {
|
---|
| 265 | return std::numeric_limits<double>::max();
|
---|
| 266 | }
|
---|
| 267 |
|
---|
| 268 | template <>
|
---|
| 269 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::max() const
|
---|
| 270 | {
|
---|
| 271 | return std::numeric_limits<double>::max();
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | template <>
|
---|
| 275 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::max() const
|
---|
| 276 | {
|
---|
| 277 | return std::numeric_limits<double>::max();
|
---|
| 278 | }
|
---|
[081e5d] | 279 |
|
---|
| 280 | /* =============== p() ======================= */
|
---|
| 281 |
|
---|
| 282 | template <>
|
---|
| 283 | double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::p() const
|
---|
| 284 | {
|
---|
| 285 | return distribution_type.p();
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | template <>
|
---|
| 289 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::p() const
|
---|
| 290 | {
|
---|
| 291 | return distribution_type.p();
|
---|
| 292 | }
|
---|
| 293 |
|
---|
| 294 | template <>
|
---|
| 295 | double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::p() const
|
---|
| 296 | {
|
---|
| 297 | return distribution_type.p();
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 |
|
---|
| 301 | /* =============== t() ======================= */
|
---|
| 302 |
|
---|
| 303 | template <>
|
---|
| 304 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::t() const
|
---|
| 305 | {
|
---|
| 306 | return distribution_type.t();
|
---|
| 307 | }
|
---|
| 308 |
|
---|
| 309 | /* =============== median() ======================= */
|
---|
| 310 |
|
---|
| 311 | template <>
|
---|
| 312 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::median() const
|
---|
| 313 | {
|
---|
| 314 | return distribution_type.median();
|
---|
| 315 | }
|
---|
| 316 |
|
---|
| 317 | /* =============== sigma() ======================= */
|
---|
| 318 |
|
---|
| 319 | template <>
|
---|
| 320 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::sigma() const
|
---|
| 321 | {
|
---|
| 322 | return distribution_type.sigma();
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | template <>
|
---|
| 326 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::sigma() const
|
---|
| 327 | {
|
---|
| 328 | return distribution_type.sigma();
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | template <>
|
---|
| 332 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::sigma() const
|
---|
| 333 | {
|
---|
| 334 | return distribution_type.sigma();
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 | /* =============== alpha() ======================= */
|
---|
| 338 |
|
---|
| 339 | template <>
|
---|
| 340 | double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::alpha() const
|
---|
| 341 | {
|
---|
| 342 | return distribution_type.alpha();
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 |
|
---|
| 346 | /* =============== mean() ======================= */
|
---|
| 347 |
|
---|
| 348 | template <>
|
---|
| 349 | double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::mean() const
|
---|
| 350 | {
|
---|
| 351 | return distribution_type.mean();
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 | template <>
|
---|
| 355 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::mean() const
|
---|
| 356 | {
|
---|
| 357 | return distribution_type.mean();
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | template <>
|
---|
| 361 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::mean() const
|
---|
| 362 | {
|
---|
| 363 | return distribution_type.mean();
|
---|
| 364 | }
|
---|
| 365 |
|
---|
| 366 | /* =============== a() ======================= */
|
---|
| 367 |
|
---|
| 368 | template <>
|
---|
| 369 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::a() const
|
---|
| 370 | {
|
---|
| 371 | return distribution_type.a();
|
---|
| 372 | }
|
---|
| 373 |
|
---|
| 374 |
|
---|
| 375 | /* =============== b() ======================= */
|
---|
| 376 |
|
---|
| 377 | template <>
|
---|
| 378 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::b() const
|
---|
| 379 | {
|
---|
| 380 | return distribution_type.b();
|
---|
| 381 | }
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | /* =============== c() ======================= */
|
---|
| 385 |
|
---|
| 386 | template <>
|
---|
| 387 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::c() const
|
---|
| 388 | {
|
---|
| 389 | return distribution_type.c();
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 |
|
---|
| 393 | /* =============== lambda() ======================= */
|
---|
| 394 |
|
---|
| 395 | template <>
|
---|
| 396 | double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::lambda() const
|
---|
| 397 | {
|
---|
| 398 | return distribution_type.lambda();
|
---|
| 399 | }
|
---|
| 400 |
|
---|
| 401 |
|
---|