source: src/RandomNumbers/RandomNumberDistribution_Encapsulation.cpp@ 30c753

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 30c753 was d103d3, checked in by Frederik Heber <heber@…>, 13 years ago

Added additional check in CodeCheck's project disclaimer for current year in copyright.

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