source: src/RandomNumbers/RandomNumberDistribution_Encapsulation.cpp@ ac9dc8

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes
Last change on this file since ac9dc8 was 9eb71b3, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

Commented out MemDebug include and Memory::ignore.

  • MemDebug clashes with various allocation operators that use a specific placement in memory. It is so far not possible to wrap new/delete fully. Hence, we stop this effort which so far has forced us to put ever more includes (with clashes) into MemDebug and thereby bloat compilation time.
  • MemDebug does not add that much usefulness which is not also provided by valgrind.
  • Property mode set to 100644
File size: 10.8 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * \file RandomNumberDistribution_Encapsulation_impl.hpp
25 *
26 * Herein we place specializations of specific functions for specific distributions.
27 *
28 * Created on: Jan 5, 2011
29 * Author: heber
30 */
31
32// include config.h
33#ifdef HAVE_CONFIG_H
34#include <config.h>
35#endif
36
37//#include "CodePatterns/MemDebug.hpp"
38
39#include <limits>
40
41#include "RandomNumberDistribution_Encapsulation.hpp"
42
43/* ========= manipulatedclone() ================ */
44
45template <>
46RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::
47RandomNumberDistribution_Encapsulation (const RandomNumberDistribution_Parameters&_params) :
48 distribution_type(_params.min, _params.max)
49{}
50
51template <>
52RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::
53RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
54 distribution_type(_params.min, _params.max)
55{}
56
57template <>
58RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::
59RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
60 distribution_type(_params.min, _params.max)
61{}
62
63template <>
64RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::
65RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
66 distribution_type(_params.p)
67{}
68
69template <>
70RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::
71RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
72 distribution_type((int)_params.t, _params.p)
73{}
74
75template <>
76RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::
77RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
78 distribution_type(_params.median, _params.sigma)
79{}
80
81template <>
82RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::
83RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
84 distribution_type(_params.alpha)
85{}
86
87template <>
88RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::
89RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
90 distribution_type(_params.mean)
91{}
92
93template <>
94RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::
95RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
96 distribution_type(_params.p)
97{}
98
99template <>
100RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::
101RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
102 distribution_type(_params.a, _params.b, _params.c)
103{}
104
105template <>
106RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::
107RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
108 distribution_type(_params.lambda)
109{}
110
111template <>
112RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::
113RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
114 distribution_type(_params.mean, _params.sigma)
115{}
116
117template <>
118RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::
119RandomNumberDistribution_Encapsulation(const RandomNumberDistribution_Parameters&_params) :
120 distribution_type(_params.mean, _params.sigma)
121{}
122
123/* =============== min() ======================= */
124
125template <>
126double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::min() const
127{
128 return distribution_type.min();
129}
130
131template <>
132double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::min() const
133{
134 return distribution_type.min();
135}
136
137template <>
138double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::min() const
139{
140 return distribution_type.min();
141}
142
143template <>
144double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::min() const
145{
146 return distribution_type.min();
147}
148
149template <>
150double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::min() const
151{
152 return 0.;
153}
154
155template <>
156double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::min() const
157{
158 return 0.;
159}
160
161template <>
162double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::min() const
163{
164 return std::numeric_limits<double>::min();
165}
166
167template <>
168double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::min() const
169{
170 return 0.;
171}
172
173template <>
174double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::min() const
175{
176 return 0.;
177}
178
179template <>
180double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::min() const
181{
182 return 0.;
183}
184
185template <>
186double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::min() const
187{
188 return distribution_type.a();
189}
190
191template <>
192double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::min() const
193{
194 return 0.;
195}
196
197template <>
198double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::min() const
199{
200 return std::numeric_limits<double>::min();
201}
202
203template <>
204double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::min() const
205{
206 return 0.;
207}
208
209/* =============== max() ======================= */
210
211template <>
212double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::max() const
213{
214 return distribution_type.max();
215}
216
217template <>
218double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::max() const
219{
220 return distribution_type.max();
221}
222
223template <>
224double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::max() const
225{
226 return distribution_type.max();
227}
228
229template <>
230double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::max() const
231{
232 return distribution_type.max();
233}
234
235template <>
236double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::max() const
237{
238 return 1.;
239}
240
241template <>
242double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::max() const
243{
244 return distribution_type.t();
245}
246
247template <>
248double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::max() const
249{
250 return std::numeric_limits<double>::max();
251}
252
253template <>
254double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::max() const
255{
256 return std::numeric_limits<double>::max();
257}
258
259template <>
260double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::max() const
261{
262 return std::numeric_limits<double>::max();
263}
264
265template <>
266double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::max() const
267{
268 return std::numeric_limits<double>::max();
269}
270
271template <>
272double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::max() const
273{
274 return distribution_type.c();
275}
276
277template <>
278double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::max() const
279{
280 return std::numeric_limits<double>::max();
281}
282
283template <>
284double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::max() const
285{
286 return std::numeric_limits<double>::max();
287}
288
289template <>
290double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::max() const
291{
292 return std::numeric_limits<double>::max();
293}
294
295/* =============== p() ======================= */
296
297template <>
298double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::p() const
299{
300 return distribution_type.p();
301}
302
303template <>
304double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::p() const
305{
306 return distribution_type.p();
307}
308
309template <>
310double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::p() const
311{
312 return distribution_type.p();
313}
314
315
316/* =============== t() ======================= */
317
318template <>
319double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::t() const
320{
321 return distribution_type.t();
322}
323
324/* =============== median() ======================= */
325
326template <>
327double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::median() const
328{
329 return distribution_type.median();
330}
331
332/* =============== sigma() ======================= */
333
334template <>
335double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::sigma() const
336{
337 return distribution_type.sigma();
338}
339
340template <>
341double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::sigma() const
342{
343 return distribution_type.sigma();
344}
345
346template <>
347double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::sigma() const
348{
349 return distribution_type.sigma();
350}
351
352/* =============== alpha() ======================= */
353
354template <>
355double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::alpha() const
356{
357 return distribution_type.alpha();
358}
359
360
361/* =============== mean() ======================= */
362
363template <>
364double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::mean() const
365{
366 return distribution_type.mean();
367}
368
369template <>
370double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::mean() const
371{
372 return distribution_type.mean();
373}
374
375template <>
376double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::mean() const
377{
378 return distribution_type.mean();
379}
380
381/* =============== a() ======================= */
382
383template <>
384double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::a() const
385{
386 return distribution_type.a();
387}
388
389
390/* =============== b() ======================= */
391
392template <>
393double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::b() const
394{
395 return distribution_type.b();
396}
397
398
399/* =============== c() ======================= */
400
401template <>
402double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::c() const
403{
404 return distribution_type.c();
405}
406
407
408/* =============== lambda() ======================= */
409
410template <>
411double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::lambda() const
412{
413 return distribution_type.lambda();
414}
415
416
Note: See TracBrowser for help on using the repository browser.