|
||||
File indexing completed on 2025-01-18 10:10:17
0001 // @(#)root/mathmore:$Id$ 0002 // Author: L. Moneta, A. Zsenei 08/2005 0003 0004 /********************************************************************** 0005 * * 0006 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT * 0007 * * 0008 * This library is free software; you can redistribute it and/or * 0009 * modify it under the terms of the GNU General Public License * 0010 * as published by the Free Software Foundation; either version 2 * 0011 * of the License, or (at your option) any later version. * 0012 * * 0013 * This library is distributed in the hope that it will be useful, * 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0016 * General Public License for more details. * 0017 * * 0018 * You should have received a copy of the GNU General Public License * 0019 * along with this library (see file COPYING); if not, write * 0020 * to the Free Software Foundation, Inc., 59 Temple Place, Suite * 0021 * 330, Boston, MA 02111-1307 USA, or contact the author. * 0022 * * 0023 **********************************************************************/ 0024 0025 // Header file for class GSLQuasiRandom 0026 // 0027 // Created by: moneta at Sun Nov 21 16:26:03 2004 0028 // 0029 // Last update: Sun Nov 21 16:26:03 2004 0030 // 0031 #ifndef ROOT_Math_GSLQuasiRandom 0032 #define ROOT_Math_GSLQuasiRandom 0033 0034 #include <string> 0035 0036 namespace ROOT { 0037 namespace Math { 0038 0039 0040 class GSLQRngWrapper; 0041 0042 //_________________________________________________________________ 0043 /** 0044 GSLQuasiRandomEngine 0045 Base class for all GSL quasi random engines, 0046 normally user instantiate the derived classes 0047 which creates internally the generator and uses the class ROOT::Math::QuasiRandom 0048 0049 0050 @ingroup Random 0051 */ 0052 class GSLQuasiRandomEngine { 0053 0054 public: 0055 0056 /** 0057 default constructor. No creation of rng is done. 0058 If then Initialize() is called an engine is created 0059 based on default GSL type (MT) 0060 */ 0061 GSLQuasiRandomEngine(); 0062 0063 /** 0064 create from an existing rng. 0065 User manage the rng pointer which is then deleted only by calling Terminate() 0066 */ 0067 GSLQuasiRandomEngine( GSLQRngWrapper * rng); 0068 0069 /** 0070 Copy constructor : clone the contained GSL generator 0071 */ 0072 GSLQuasiRandomEngine(const GSLQuasiRandomEngine & eng); 0073 0074 /** 0075 Assignment operator : make a deep copy of the contained GSL generator 0076 */ 0077 GSLQuasiRandomEngine & operator=(const GSLQuasiRandomEngine & eng); 0078 0079 /** 0080 initialize the generator giving the dimension of the sequence 0081 If no rng is present the default one based on Mersenne and Twister is created 0082 */ 0083 void Initialize(unsigned int dimension); 0084 0085 /** 0086 delete pointer to contained rng 0087 */ 0088 void Terminate(); 0089 0090 /** 0091 call Terminate() 0092 */ 0093 virtual ~GSLQuasiRandomEngine(); 0094 0095 /** 0096 Generate a random number between ]0,1[ 0097 */ 0098 double operator() () const; 0099 0100 /** 0101 Fill array x with random numbers between ]0,1[ 0102 */ 0103 bool operator() (double * x) const; 0104 0105 /** 0106 Skip the next n random numbers 0107 */ 0108 bool Skip(unsigned int n) const; 0109 0110 /** 0111 Generate an array of quasi random numbers 0112 The iterators points to the random numbers 0113 */ 0114 bool GenerateArray(double * begin, double * end) const; 0115 0116 /** 0117 return name of generator 0118 */ 0119 std::string Name() const; 0120 0121 /** 0122 return the state size of generator 0123 */ 0124 unsigned int Size() const; 0125 0126 /** 0127 return the dimension of generator 0128 */ 0129 unsigned int NDim() const; 0130 0131 0132 0133 protected: 0134 0135 /// internal method used by the derived class to set the type of generators 0136 void SetType(GSLQRngWrapper * r) { 0137 fQRng = r; 0138 } 0139 0140 private: 0141 0142 GSLQRngWrapper * fQRng; // pointer to GSL generator wrapper (managed by the class) 0143 0144 0145 }; 0146 0147 //_____________________________________________________________________________________ 0148 /** 0149 Sobol generator 0150 gsl_qrng_sobol from 0151 <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Quasi_002drandom-number-generator-algorithms.html#Quasi_002drandom-number-generator-algorithms">here</A> 0152 0153 0154 @ingroup Random 0155 */ 0156 class GSLQRngSobol : public GSLQuasiRandomEngine { 0157 public: 0158 GSLQRngSobol(); 0159 }; 0160 0161 //_____________________________________________________________________________________ 0162 /** 0163 Niederreiter generator 0164 gsl_qrng_niederreiter_2 from 0165 <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Quasi_002drandom-number-generator-algorithms.html#Quasi_002drandom-number-generator-algorithms">here</A> 0166 0167 @ingroup Random 0168 */ 0169 class GSLQRngNiederreiter2 : public GSLQuasiRandomEngine { 0170 public: 0171 GSLQRngNiederreiter2(); 0172 }; 0173 0174 0175 0176 0177 } // namespace Math 0178 } // namespace ROOT 0179 0180 0181 #endif /* ROOT_Math_GSLQuasiRandom */ 0182
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |