Changeset 081e5d for src/RandomNumbers
- Timestamp:
- Feb 3, 2011, 9:51:19 AM (14 years ago)
- Branches:
- 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
- Children:
- 6ff0c8
- Parents:
- 15911c
- git-author:
- Frederik Heber <heber@…> (01/05/11 17:30:01)
- git-committer:
- Frederik Heber <heber@…> (02/03/11 09:51:19)
- Location:
- src/RandomNumbers
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/RandomNumbers/RandomNumberDistribution.hpp
r15911c r081e5d 37 37 38 38 public: 39 /** Getter for smallest value the engine produces. 40 * 41 * @return smallest value 42 */ 43 virtual double min() const=0; 44 45 /** Getter for largest value the engine produces. 46 * 47 * @return largest value 48 */ 49 virtual double max() const=0; 50 51 52 /** Getter for bernoulli_distribution probability p. 53 * 54 * @return p 55 */ 56 virtual double p() const=0; 57 39 58 /** Getter for the type name of the internal distribution. 40 59 * -
src/RandomNumbers/RandomNumberDistributionFactory.def
r15911c r081e5d 7 7 #define type_seq \ 8 8 (uniform_smallint)\ 9 (uniform_int) 10 11 /* 9 (uniform_int)\ 12 10 (uniform_01)\ 13 11 (uniform_real)\ … … 21 19 (exponential_distribution)\ 22 20 (normal_distribution)\ 23 (lognormal_distribution)\ 21 (lognormal_distribution) 22 /* 24 23 (uniform_on_sphere) 25 24 */ 26 27 25 #define FactoryNAME RandomNumberDistributionFactory 28 26 #define Abstract_Interface_Class RandomNumberDistribution -
src/RandomNumbers/RandomNumberDistribution_Encapsulation.hpp
r15911c r081e5d 13 13 #include <config.h> 14 14 #endif 15 16 #include "CodePatterns/Assert.hpp" 15 17 16 18 #include <typeinfo> … … 60 62 public: 61 63 64 /** Getter for smallest value the engine produces. 65 * 66 * @return smallest value 67 */ 68 double min() const { 69 ASSERT(0, "min() not implemented for "+name()); 70 return -1.; 71 } 72 73 /** Getter for largest value the engine produces. 74 * 75 * @return largest value 76 */ 77 double max() const { 78 ASSERT(0, "max() not implemented for "+name()); 79 return -1.; 80 } 81 82 /** Getter for bernoulli_distribution's probability p. 83 * 84 * @return p 85 */ 86 double p() const { 87 ASSERT(0, "p() not implemented for "+name()); 88 return -1.; 89 } 90 91 /** Getter for binomial_distribution's parameter t. 92 * 93 * @return t 94 */ 95 double t() const { 96 ASSERT(0, "t() not implemented for "+name()); 97 return -1.; 98 } 99 100 /** Getter for cauchy_distribution parameter median. 101 * 102 * @return median 103 */ 104 double median() const { 105 ASSERT(0, "median() not implemented for "+name()); 106 return -1.; 107 } 108 109 /** Getter for cauchy_distribution parameter sigma. 110 * 111 * @return sigma 112 */ 113 double sigma() const { 114 ASSERT(0, "sigma() not implemented for "+name()); 115 return -1.; 116 } 117 118 /** Getter for gamma_distribution parameter alpha. 119 * 120 * @return alpha 121 */ 122 double alpha() const { 123 ASSERT(0, "alpha() not implemented for "+name()); 124 return -1.; 125 } 126 127 /** Getter for poisson_distribution's parameter mean. 128 * 129 * @return mean 130 */ 131 double mean() const { 132 ASSERT(0, "mean() not implemented for "+name()); 133 return -1.; 134 } 135 136 /** Getter for triangle_distribution parameter a. 137 * 138 * @return a 139 */ 140 double a() const { 141 ASSERT(0, "a() not implemented for "+name()); 142 return -1.; 143 } 144 145 /** Getter for triangle_distribution parameter b. 146 * 147 * @return b 148 */ 149 double b() const { 150 ASSERT(0, "b() not implemented for "+name()); 151 return -1.; 152 } 153 154 /** Getter for triangle_distribution parameter c. 155 * 156 * @return c 157 */ 158 double c() const { 159 ASSERT(0, "c() not implemented for "+name()); 160 return -1.; 161 } 162 163 /** Getter for exponential_distribution parameter lambda. 164 * 165 * @return lambda 166 */ 167 double lambda() const { 168 ASSERT(0, "lambda() not implemented for "+name()); 169 return -1.; 170 } 171 62 172 /** Getter for the type name of the internal distribution. 63 173 * … … 103 213 }; 104 214 215 // the following definitions prevents the compiler from instantiating the above 216 // template member functions for the desired cases. 217 218 /* =============== min() ======================= */ 219 220 template <> 221 double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::min() const; 222 template <> 223 double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::min() const; 224 template <> 225 double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::min() const; 226 template <> 227 double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::min() const; 228 229 230 /* =============== max() ======================= */ 231 232 template <> 233 double RandomNumberDistribution_Encapsulation< boost::uniform_smallint<> >::max() const; 234 template <> 235 double RandomNumberDistribution_Encapsulation< boost::uniform_int<> >::max() const; 236 template <> 237 double RandomNumberDistribution_Encapsulation< boost::uniform_01<> >::max() const; 238 template <> 239 double RandomNumberDistribution_Encapsulation< boost::uniform_real<> >::max() const; 240 241 242 /* =============== p() ======================= */ 243 244 template <> 245 double RandomNumberDistribution_Encapsulation< boost::bernoulli_distribution<> >::p() const; 246 template <> 247 double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::p() const; 248 template <> 249 double RandomNumberDistribution_Encapsulation< boost::geometric_distribution<> >::p() const; 250 251 252 /* =============== t() ======================= */ 253 254 template <> 255 double RandomNumberDistribution_Encapsulation< boost::binomial_distribution<> >::t() const; 256 257 258 /* =============== median() ======================= */ 259 260 template <> 261 double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::median() const; 262 263 264 /* =============== sigma() ======================= */ 265 266 template <> 267 double RandomNumberDistribution_Encapsulation< boost::cauchy_distribution<> >::sigma() const; 268 template <> 269 double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::sigma() const; 270 template <> 271 double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::sigma() const; 272 273 274 /* =============== alpha() ======================= */ 275 276 template <> 277 double RandomNumberDistribution_Encapsulation< boost::gamma_distribution<> >::alpha() const; 278 279 280 /* =============== mean() ======================= */ 281 282 template <> 283 double RandomNumberDistribution_Encapsulation< boost::poisson_distribution<> >::mean() const; 284 template <> 285 double RandomNumberDistribution_Encapsulation< boost::normal_distribution<> >::mean() const; 286 template <> 287 double RandomNumberDistribution_Encapsulation< boost::lognormal_distribution<> >::mean() const; 288 289 290 /* =============== a() ======================= */ 291 292 template <> 293 double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::a() const; 294 295 296 /* =============== b() ======================= */ 297 298 template <> 299 double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::b() const; 300 301 302 /* =============== c() ======================= */ 303 304 template <> 305 double RandomNumberDistribution_Encapsulation< boost::triangle_distribution<> >::c() const; 306 307 308 /* =============== lambda() ======================= */ 309 310 template <> 311 double RandomNumberDistribution_Encapsulation< boost::exponential_distribution<> >::lambda() const; 312 313 314 105 315 #endif /* RANDOMNUMBERDISTRIBUTION_ENCAPSULATION_HPP_ */ -
src/RandomNumbers/RandomNumberEngine.hpp
r15911c r081e5d 43 43 virtual void seed(unsigned int _seed)=0; 44 44 45 /** Getter for smallest value the engine produces. 46 * 47 * @return smallest value 48 */ 49 virtual double min() const=0; 50 51 /** Getter for largest value the engine produces. 52 * 53 * @return largest value 54 */ 55 virtual double max() const=0; 56 45 57 /** Getter for the type name of the internal engine. 46 58 * -
src/RandomNumbers/RandomNumberEngineFactory.def
r15911c r081e5d 6 6 */ 7 7 #define engine_seq \ 8 (minstd_rand0) 9 10 /* 8 (minstd_rand0)\ 11 9 (minstd_rand)\ 12 10 (rand48)\ … … 17 15 (mt11213b)\ 18 16 (mt19937) 19 */ 17 20 18 #define engine_seq_a \ 21 (lagged_fibonacci607) 22 23 /* 19 (lagged_fibonacci607)\ 24 20 (lagged_fibonacci1279)\ 25 21 (lagged_fibonacci2281)\ … … 38 34 (ranlux64_3_01)\ 39 35 (ranlux64_4_01) 40 */41 36 42 37 #define type_seq engine_seq engine_seq_a -
src/RandomNumbers/RandomNumberEngine_Encapsulation.hpp
r15911c r081e5d 72 72 } 73 73 74 /** Getter for smallest value the engine produces. 75 * 76 * @return smallest value 77 */ 78 double min() const { 79 return engine_type.min(); 80 } 81 82 /** Getter for largest value the engine produces. 83 * 84 * @return largest value 85 */ 86 double max() const { 87 return engine_type.max(); 88 } 89 74 90 /** Getter for the type name of the internal engine. 75 91 * -
src/RandomNumbers/RandomNumberGeneratorFactory.def
r15911c r081e5d 7 7 #define distribution_seq \ 8 8 (uniform_smallint)\ 9 (uniform_int) 10 11 /* 9 (uniform_int)\ 12 10 (uniform_01)\ 13 11 (uniform_real)\ … … 21 19 (exponential_distribution)\ 22 20 (normal_distribution)\ 23 (lognormal_distribution)\ 21 (lognormal_distribution) 22 /* 24 23 (uniform_on_sphere) 25 24 */ 26 27 25 /** BOOST_PP_SEQ of all random::boost engine types, 28 26 * see see http://www.boost.org/doc/libs/1_45_0/doc/html/boost_random/reference.html#boost_random.reference.concepts 29 27 */ 30 28 #define engine_seq \ 31 (minstd_rand0) 32 33 /* 29 (minstd_rand0)\ 34 30 (minstd_rand)\ 35 31 (rand48)\ … … 40 36 (mt11213b)\ 41 37 (mt19937) 42 */ 38 43 39 #define engine_seq_a \ 44 (lagged_fibonacci607) 45 46 /* 40 (lagged_fibonacci607)\ 47 41 (lagged_fibonacci1279)\ 48 42 (lagged_fibonacci2281)\ … … 61 55 (ranlux64_3_01)\ 62 56 (ranlux64_4_01) 63 */64 57 65 58 #endif /* RANDOMNUMBERGENERATORFACTORY_DEF_ */ -
src/RandomNumbers/unittests/Makefile.am
r15911c r081e5d 37 37 RandomNumberDistributionFactoryUnitTest.cpp \ 38 38 RandomNumberDistributionFactoryUnitTest.hpp \ 39 $(srcdir)/../RandomNumberDistribution_Encapsulation.cpp \ 40 $(srcdir)/../RandomNumberDistribution_Encapsulation.hpp \ 39 41 $(srcdir)/../RandomNumberDistributionFactory.cpp \ 40 42 $(srcdir)/../RandomNumberDistributionFactory.hpp … … 44 46 RandomNumberEngineFactoryUnitTest.cpp \ 45 47 RandomNumberEngineFactoryUnitTest.hpp \ 48 $(srcdir)/../RandomNumberEngine_Encapsulation.cpp \ 49 $(srcdir)/../RandomNumberEngine_Encapsulation.hpp \ 46 50 $(srcdir)/../RandomNumberEngineFactory.cpp \ 47 51 $(srcdir)/../RandomNumberEngineFactory.hpp … … 51 55 RandomNumberGeneratorFactoryUnitTest.cpp \ 52 56 RandomNumberGeneratorFactoryUnitTest.hpp \ 57 $(srcdir)/../RandomNumberDistribution_Encapsulation.cpp \ 58 $(srcdir)/../RandomNumberDistribution_Encapsulation.hpp \ 53 59 $(srcdir)/../RandomNumberDistributionFactory.cpp \ 54 60 $(srcdir)/../RandomNumberDistributionFactory.hpp \ 61 $(srcdir)/../RandomNumberEngine_Encapsulation.cpp \ 62 $(srcdir)/../RandomNumberEngine_Encapsulation.hpp \ 55 63 $(srcdir)/../RandomNumberEngineFactory.cpp \ 56 64 $(srcdir)/../RandomNumberEngineFactory.hpp \ … … 63 71 RandomNumberGeneratorUnitTest.cpp \ 64 72 RandomNumberGeneratorUnitTest.hpp \ 73 $(srcdir)/../RandomNumberDistribution_Encapsulation.cpp \ 74 $(srcdir)/../RandomNumberDistribution_Encapsulation.hpp \ 65 75 $(srcdir)/../RandomNumberDistributionFactory.cpp \ 66 76 $(srcdir)/../RandomNumberDistributionFactory.hpp \ 77 $(srcdir)/../RandomNumberEngine_Encapsulation.cpp \ 78 $(srcdir)/../RandomNumberEngine_Encapsulation.hpp \ 67 79 $(srcdir)/../RandomNumberEngineFactory.cpp \ 68 80 $(srcdir)/../RandomNumberEngineFactory.hpp \ -
src/RandomNumbers/unittests/RandomNumberDistributionFactoryUnitTest.cpp
r15911c r081e5d 108 108 rndA->name() 109 109 ); 110 111 // check min and max of uniform_smallint 112 CPPUNIT_ASSERT_EQUAL( 0., rndA->min() ); 113 CPPUNIT_ASSERT_EQUAL( 9., rndA->max() ); 110 114 } 111 115 -
src/RandomNumbers/unittests/RandomNumberEngineFactoryUnitTest.cpp
r15911c r081e5d 112 112 rndA->name() 113 113 ); 114 115 // range of minstd_rand0 with c=0 is [1,m) 116 CPPUNIT_ASSERT_EQUAL( 1., rndA->min() ); 114 117 } 115 118
Note:
See TracChangeset
for help on using the changeset viewer.