| 1 | /*
|
|---|
| 2 | * Project: MoleCuilder
|
|---|
| 3 | * Description: creates and alters molecular systems
|
|---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
|---|
| 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 |
|
|---|
| 24 | #include "RandomNumberDistribution_Encapsulation.hpp"
|
|---|
| 25 |
|
|---|
| 26 | /* ========= manipulatedclone() ================ */
|
|---|
| 27 |
|
|---|
| 28 | template <>
|
|---|
| 29 | RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::
|
|---|
| 30 | RandomNumberDistribution_Encapsulation (const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 31 | distribution_type(_params.min, _params.max)
|
|---|
| 32 | {}
|
|---|
| 33 |
|
|---|
| 34 | template <>
|
|---|
| 35 | RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::
|
|---|
| 36 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 37 | distribution_type(_params.min, _params.max)
|
|---|
| 38 | {}
|
|---|
| 39 |
|
|---|
| 40 | template <>
|
|---|
| 41 | RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::
|
|---|
| 42 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 43 | distribution_type(_params.min, _params.max)
|
|---|
| 44 | {}
|
|---|
| 45 |
|
|---|
| 46 | template <>
|
|---|
| 47 | RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::
|
|---|
| 48 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 49 | distribution_type(_params.p)
|
|---|
| 50 | {}
|
|---|
| 51 |
|
|---|
| 52 | template <>
|
|---|
| 53 | RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::
|
|---|
| 54 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 55 | distribution_type((int)_params.t, _params.p)
|
|---|
| 56 | {}
|
|---|
| 57 |
|
|---|
| 58 | template <>
|
|---|
| 59 | RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::
|
|---|
| 60 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 61 | distribution_type(_params.median, _params.sigma)
|
|---|
| 62 | {}
|
|---|
| 63 |
|
|---|
| 64 | template <>
|
|---|
| 65 | RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::
|
|---|
| 66 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 67 | distribution_type(_params.alpha)
|
|---|
| 68 | {}
|
|---|
| 69 |
|
|---|
| 70 | template <>
|
|---|
| 71 | RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::
|
|---|
| 72 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 73 | distribution_type(_params.mean)
|
|---|
| 74 | {}
|
|---|
| 75 |
|
|---|
| 76 | template <>
|
|---|
| 77 | RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::
|
|---|
| 78 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 79 | distribution_type(_params.p)
|
|---|
| 80 | {}
|
|---|
| 81 |
|
|---|
| 82 | template <>
|
|---|
| 83 | RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::
|
|---|
| 84 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 85 | distribution_type(_params.a, _params.b, _params.c)
|
|---|
| 86 | {}
|
|---|
| 87 |
|
|---|
| 88 | template <>
|
|---|
| 89 | RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::
|
|---|
| 90 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 91 | distribution_type(_params.lambda)
|
|---|
| 92 | {}
|
|---|
| 93 |
|
|---|
| 94 | template <>
|
|---|
| 95 | RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::
|
|---|
| 96 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 97 | distribution_type(_params.mean, _params.sigma)
|
|---|
| 98 | {}
|
|---|
| 99 |
|
|---|
| 100 | template <>
|
|---|
| 101 | RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::
|
|---|
| 102 | RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
|
|---|
| 103 | distribution_type(_params.mean, _params.sigma)
|
|---|
| 104 | {}
|
|---|
| 105 |
|
|---|
| 106 | /* =============== min() ======================= */
|
|---|
| 107 |
|
|---|
| 108 | template <>
|
|---|
| 109 | double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::min() const
|
|---|
| 110 | {
|
|---|
| 111 | return distribution_type.min();
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | template <>
|
|---|
| 115 | double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::min() const
|
|---|
| 116 | {
|
|---|
| 117 | return distribution_type.min();
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | template <>
|
|---|
| 121 | double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::min() const
|
|---|
| 122 | {
|
|---|
| 123 | return distribution_type.min();
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | template <>
|
|---|
| 127 | double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::min() const
|
|---|
| 128 | {
|
|---|
| 129 | return distribution_type.min();
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 | /* =============== max() ======================= */
|
|---|
| 135 |
|
|---|
| 136 | template <>
|
|---|
| 137 | double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::max() const
|
|---|
| 138 | {
|
|---|
| 139 | return distribution_type.max();
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | template <>
|
|---|
| 143 | double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::max() const
|
|---|
| 144 | {
|
|---|
| 145 | return distribution_type.max();
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | template <>
|
|---|
| 149 | double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::max() const
|
|---|
| 150 | {
|
|---|
| 151 | return distribution_type.max();
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | template <>
|
|---|
| 155 | double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::max() const
|
|---|
| 156 | {
|
|---|
| 157 | return distribution_type.max();
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 | /* =============== p() ======================= */
|
|---|
| 162 |
|
|---|
| 163 | template <>
|
|---|
| 164 | double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::p() const
|
|---|
| 165 | {
|
|---|
| 166 | return distribution_type.p();
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | template <>
|
|---|
| 170 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::p() const
|
|---|
| 171 | {
|
|---|
| 172 | return distribution_type.p();
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | template <>
|
|---|
| 176 | double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::p() const
|
|---|
| 177 | {
|
|---|
| 178 | return distribution_type.p();
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | /* =============== t() ======================= */
|
|---|
| 183 |
|
|---|
| 184 | template <>
|
|---|
| 185 | double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::t() const
|
|---|
| 186 | {
|
|---|
| 187 | return distribution_type.t();
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | /* =============== median() ======================= */
|
|---|
| 191 |
|
|---|
| 192 | template <>
|
|---|
| 193 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::median() const
|
|---|
| 194 | {
|
|---|
| 195 | return distribution_type.median();
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | /* =============== sigma() ======================= */
|
|---|
| 199 |
|
|---|
| 200 | template <>
|
|---|
| 201 | double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::sigma() const
|
|---|
| 202 | {
|
|---|
| 203 | return distribution_type.sigma();
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | template <>
|
|---|
| 207 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::sigma() const
|
|---|
| 208 | {
|
|---|
| 209 | return distribution_type.sigma();
|
|---|
| 210 | }
|
|---|
| 211 |
|
|---|
| 212 | template <>
|
|---|
| 213 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::sigma() const
|
|---|
| 214 | {
|
|---|
| 215 | return distribution_type.sigma();
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | /* =============== alpha() ======================= */
|
|---|
| 219 |
|
|---|
| 220 | template <>
|
|---|
| 221 | double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::alpha() const
|
|---|
| 222 | {
|
|---|
| 223 | return distribution_type.alpha();
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 | /* =============== mean() ======================= */
|
|---|
| 228 |
|
|---|
| 229 | template <>
|
|---|
| 230 | double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::mean() const
|
|---|
| 231 | {
|
|---|
| 232 | return distribution_type.mean();
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | template <>
|
|---|
| 236 | double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::mean() const
|
|---|
| 237 | {
|
|---|
| 238 | return distribution_type.mean();
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | template <>
|
|---|
| 242 | double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::mean() const
|
|---|
| 243 | {
|
|---|
| 244 | return distribution_type.mean();
|
|---|
| 245 | }
|
|---|
| 246 |
|
|---|
| 247 | /* =============== a() ======================= */
|
|---|
| 248 |
|
|---|
| 249 | template <>
|
|---|
| 250 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::a() const
|
|---|
| 251 | {
|
|---|
| 252 | return distribution_type.a();
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 | /* =============== b() ======================= */
|
|---|
| 257 |
|
|---|
| 258 | template <>
|
|---|
| 259 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::b() const
|
|---|
| 260 | {
|
|---|
| 261 | return distribution_type.b();
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 | /* =============== c() ======================= */
|
|---|
| 266 |
|
|---|
| 267 | template <>
|
|---|
| 268 | double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::c() const
|
|---|
| 269 | {
|
|---|
| 270 | return distribution_type.c();
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 | /* =============== lambda() ======================= */
|
|---|
| 275 |
|
|---|
| 276 | template <>
|
|---|
| 277 | double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::lambda() const
|
|---|
| 278 | {
|
|---|
| 279 | return distribution_type.lambda();
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|