Changeset ecb6c5 for src


Ignore:
Timestamp:
Feb 3, 2011, 9:59:58 AM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
5347cd
Parents:
9964ff
git-author:
Frederik Heber <heber@…> (01/07/11 15:36:14)
git-committer:
Frederik Heber <heber@…> (02/03/11 09:59:58)
Message:

min(), max() now implemented for all remaining random number distributions.

  • min and max are essential to re-adjust the range. Have been hard-coded from the properties of the distribution if not min(), max() not available.
Location:
src/RandomNumbers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/RandomNumbers/RandomNumberDistribution_Encapsulation.cpp

    r9964ff recb6c5  
    2222#include "CodePatterns/MemDebug.hpp"
    2323
     24#include <limits>
     25
    2426#include "RandomNumberDistribution_Encapsulation.hpp"
    2527
     
    130132}
    131133
    132 
     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}
    133193
    134194/* ===============  max() ======================= */
     
    158218}
    159219
     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}
    160279
    161280/* ===============  p() ======================= */
  • src/RandomNumbers/RandomNumberGenerator.hpp

    r9964ff recb6c5  
    3939  virtual void seed(unsigned int _seed)=0;
    4040
     41  /** Getter for smallest possible random number
     42   *
     43   * @return smallest possible random number
     44   */
     45  virtual double min() const=0;
     46
     47  /** Getter for largest possible random number
     48   *
     49   * @return largest possible random number
     50   */
     51  virtual double max() const=0;
     52
    4153  /** Getter for the type name of the internal engine.
    4254   *
  • src/RandomNumbers/RandomNumberGenerator_Encapsulation.hpp

    r9964ff recb6c5  
    9898  }
    9999
     100  /** Getter for smallest possible random number
     101   *
     102   * @return smallest possible random number
     103   */
     104  double min() const {
     105    return distribution_type->min();
     106  }
     107
     108  /** Getter for largest possible random number
     109   *
     110   * @return largest possible random number
     111   */
     112  double max() const {
     113    return distribution_type->max();
     114  }
     115
    100116  /** Getter for the type name of the internal engine.
    101117   *
Note: See TracChangeset for help on using the changeset viewer.