gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Small fixes. Documentation fixes. Removed \author tags. Removed superfluous ; characters after function codes.
0 3 0
default
3 files changed with 19 insertions and 16 deletions:
↑ Collapse diff ↑
Ignore white space 16 line context
... ...
@@ -19,11 +19,11 @@
19 19
///\file
20 20
///\brief Instantiation of the Random class.
21 21

	
22 22
#include <lemon/random.h>
23 23

	
24 24
namespace lemon {
25 25
  /// \brief Global random number generator instance
26 26
  ///
27
  /// A global mersenne twister random number generator instance
27
  /// A global Mersenne Twister random number generator instance.
28 28
  Random rnd;
29 29
}
Ignore white space 6 line context
... ...
@@ -68,18 +68,16 @@
68 68

	
69 69
#include <ctime>
70 70
#include <cmath>
71 71

	
72 72
#include <lemon/dim2.h>
73 73
///\ingroup misc
74 74
///\file
75 75
///\brief Mersenne Twister random number generator
76
///
77
///\author Balazs Dezso
78 76

	
79 77
namespace lemon {
80 78

	
81 79
  namespace _random_bits {
82 80
    
83 81
    template <typename _Word, int _bits = std::numeric_limits<_Word>::digits>
84 82
    struct RandomTraits {};
85 83

	
... ...
@@ -511,22 +509,20 @@
511 509
  /// bool g = rnd.boolean();               // P(g = true) = 0.5
512 510
  /// bool h = rnd.boolean(0.8);            // P(h = true) = 0.8
513 511
  ///\endcode
514 512
  ///
515 513
  /// The lemon provides a global instance of the random number
516 514
  /// generator which name is \ref lemon::rnd "rnd". Usually it is a
517 515
  /// good programming convenience to use this global generator to get
518 516
  /// random numbers.
519
  ///
520
  /// \author Balazs Dezso
521 517
  class Random {
522 518
  private:
523 519

	
524
    // architecture word
520
    // Architecture word
525 521
    typedef unsigned long Word;
526 522
    
527 523
    _random_bits::RandomCore<Word> core;
528 524
    _random_bits::BoolProducer<Word> bool_producer;
529 525
    
530 526

	
531 527
  public:
532 528

	
... ...
@@ -718,18 +714,18 @@
718 714
	V1=2*real<double>()-1;
719 715
	V2=2*real<double>()-1;
720 716
	S=V1*V1+V2*V2;
721 717
      } while(S>=1);
722 718
      return std::sqrt(-2*std::log(S)/S)*V1;
723 719
    }
724 720
    /// Gauss distribution with given mean and standard deviation
725 721

	
722
    /// Gauss distribution with given mean and standard deviation
726 723
    /// \sa gauss()
727
    ///
728 724
    double gauss(double mean,double std_dev)
729 725
    {
730 726
      return gauss()*std_dev+mean;
731 727
    }
732 728

	
733 729
    /// Exponential distribution with given mean
734 730

	
735 731
    /// This function generates an exponential distribution random number
... ...
@@ -809,16 +805,19 @@
809 805
    ///@}
810 806
    
811 807
    ///\name Two dimensional distributions
812 808
    ///
813 809

	
814 810
    ///@{
815 811
    
816 812
    /// Uniform distribution on the full unit circle.
813

	
814
    /// Uniform distribution on the full unit circle.
815
    ///
817 816
    dim2::Point<double> disc() 
818 817
    {
819 818
      double V1,V2;
820 819
      do {
821 820
	V1=2*real<double>()-1;
822 821
	V2=2*real<double>()-1;
823 822
	
824 823
      } while(V1*V1+V2*V2>=1);
Ignore white space 6 line context
... ...
@@ -43,19 +43,23 @@
43 43
  ///This is an abstract class, it should be specialized for all numerical
44 44
  ///data types. These specialized classes like \ref Tolerance\<double\>
45 45
  ///may offer additional tuning parameters.
46 46
  ///
47 47
  ///\sa Tolerance<float>
48 48
  ///\sa Tolerance<double>
49 49
  ///\sa Tolerance<long double>
50 50
  ///\sa Tolerance<int>
51
#if defined __GNUC__ && !defined __STRICT_ANSI__  
51 52
  ///\sa Tolerance<long long int>
53
#endif
52 54
  ///\sa Tolerance<unsigned int>
55
#if defined __GNUC__ && !defined __STRICT_ANSI__  
53 56
  ///\sa Tolerance<unsigned long long int>
57
#endif
54 58

	
55 59
  template<class T>
56 60
  class Tolerance
57 61
  {
58 62
  public:
59 63
    typedef T Value;
60 64

	
61 65
    ///\name Comparisons
... ...
@@ -125,17 +129,17 @@
125 129
    bool less(Value a,Value b) const {return a+_epsilon<b;}
126 130
    ///Returns \c true if \c a is \e surely different from \c b
127 131
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
128 132
    ///Returns \c true if \c a is \e surely positive
129 133
    bool positive(Value a) const { return _epsilon<a; }
130 134
    ///Returns \c true if \c a is \e surely negative
131 135
    bool negative(Value a) const { return -_epsilon>a; }
132 136
    ///Returns \c true if \c a is \e surely non-zero
133
    bool nonZero(Value a) const { return positive(a)||negative(a); };
137
    bool nonZero(Value a) const { return positive(a)||negative(a); }
134 138

	
135 139
    ///@}
136 140

	
137 141
    ///Returns zero
138 142
    static Value zero() {return 0;}
139 143
  };
140 144

	
141 145
  ///Double specialization of \ref Tolerance.
... ...
@@ -176,17 +180,17 @@
176 180
    bool less(Value a,Value b) const {return a+_epsilon<b;}
177 181
    ///Returns \c true if \c a is \e surely different from \c b
178 182
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
179 183
    ///Returns \c true if \c a is \e surely positive
180 184
    bool positive(Value a) const { return _epsilon<a; }
181 185
    ///Returns \c true if \c a is \e surely negative
182 186
    bool negative(Value a) const { return -_epsilon>a; }
183 187
    ///Returns \c true if \c a is \e surely non-zero
184
    bool nonZero(Value a) const { return positive(a)||negative(a); };
188
    bool nonZero(Value a) const { return positive(a)||negative(a); }
185 189

	
186 190
    ///@}
187 191

	
188 192
    ///Returns zero
189 193
    static Value zero() {return 0;}
190 194
  };
191 195

	
192 196
  ///Long double specialization of \ref Tolerance.
... ...
@@ -227,17 +231,17 @@
227 231
    bool less(Value a,Value b) const {return a+_epsilon<b;}
228 232
    ///Returns \c true if \c a is \e surely different from \c b
229 233
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
230 234
    ///Returns \c true if \c a is \e surely positive
231 235
    bool positive(Value a) const { return _epsilon<a; }
232 236
    ///Returns \c true if \c a is \e surely negative
233 237
    bool negative(Value a) const { return -_epsilon>a; }
234 238
    ///Returns \c true if \c a is \e surely non-zero
235
    bool nonZero(Value a) const { return positive(a)||negative(a); };
239
    bool nonZero(Value a) const { return positive(a)||negative(a); }
236 240

	
237 241
    ///@}
238 242

	
239 243
    ///Returns zero
240 244
    static Value zero() {return 0;}
241 245
  };
242 246

	
243 247
  ///Integer specialization of \ref Tolerance.
... ...
@@ -260,17 +264,17 @@
260 264
    static bool less(Value a,Value b) { return a<b;}
261 265
    ///Returns \c true if \c a is \e surely different from \c b
262 266
    static bool different(Value a,Value b) { return a!=b; }
263 267
    ///Returns \c true if \c a is \e surely positive
264 268
    static bool positive(Value a) { return 0<a; }
265 269
    ///Returns \c true if \c a is \e surely negative
266 270
    static bool negative(Value a) { return 0>a; }
267 271
    ///Returns \c true if \c a is \e surely non-zero
268
    static bool nonZero(Value a) { return a!=0; };
272
    static bool nonZero(Value a) { return a!=0; }
269 273

	
270 274
    ///@}
271 275

	
272 276
    ///Returns zero
273 277
    static Value zero() {return 0;}
274 278
  };
275 279

	
276 280
  ///Unsigned integer specialization of \ref Tolerance.
... ...
@@ -293,17 +297,17 @@
293 297
    static bool less(Value a,Value b) { return a<b;}
294 298
    ///Returns \c true if \c a is \e surely different from \c b
295 299
    static bool different(Value a,Value b) { return a!=b; }
296 300
    ///Returns \c true if \c a is \e surely positive
297 301
    static bool positive(Value a) { return 0<a; }
298 302
    ///Returns \c true if \c a is \e surely negative
299 303
    static bool negative(Value) { return false; }
300 304
    ///Returns \c true if \c a is \e surely non-zero
301
    static bool nonZero(Value a) { return a!=0; };
305
    static bool nonZero(Value a) { return a!=0; }
302 306

	
303 307
    ///@}
304 308

	
305 309
    ///Returns zero
306 310
    static Value zero() {return 0;}
307 311
  };
308 312
  
309 313

	
... ...
@@ -327,17 +331,17 @@
327 331
    static bool less(Value a,Value b) { return a<b;}
328 332
    ///Returns \c true if \c a is \e surely different from \c b
329 333
    static bool different(Value a,Value b) { return a!=b; }
330 334
    ///Returns \c true if \c a is \e surely positive
331 335
    static bool positive(Value a) { return 0<a; }
332 336
    ///Returns \c true if \c a is \e surely negative
333 337
    static bool negative(Value a) { return 0>a; }
334 338
    ///Returns \c true if \c a is \e surely non-zero
335
    static bool nonZero(Value a) { return a!=0;};
339
    static bool nonZero(Value a) { return a!=0;}
336 340

	
337 341
    ///@}
338 342

	
339 343
    ///Returns zero
340 344
    static Value zero() {return 0;}
341 345
  };
342 346

	
343 347
  ///Unsigned long integer specialization of \ref Tolerance.
... ...
@@ -360,17 +364,17 @@
360 364
    static bool less(Value a,Value b) { return a<b;}
361 365
    ///Returns \c true if \c a is \e surely different from \c b
362 366
    static bool different(Value a,Value b) { return a!=b; }
363 367
    ///Returns \c true if \c a is \e surely positive
364 368
    static bool positive(Value a) { return 0<a; }
365 369
    ///Returns \c true if \c a is \e surely negative
366 370
    static bool negative(Value) { return false; }
367 371
    ///Returns \c true if \c a is \e surely non-zero
368
    static bool nonZero(Value a) { return a!=0;};
372
    static bool nonZero(Value a) { return a!=0;}
369 373

	
370 374
    ///@}
371 375

	
372 376
    ///Returns zero
373 377
    static Value zero() {return 0;}
374 378
  };
375 379

	
376 380
#if defined __GNUC__ && !defined __STRICT_ANSI__
... ...
@@ -397,17 +401,17 @@
397 401
    static bool less(Value a,Value b) { return a<b;}
398 402
    ///Returns \c true if \c a is \e surely different from \c b
399 403
    static bool different(Value a,Value b) { return a!=b; }
400 404
    ///Returns \c true if \c a is \e surely positive
401 405
    static bool positive(Value a) { return 0<a; }
402 406
    ///Returns \c true if \c a is \e surely negative
403 407
    static bool negative(Value a) { return 0>a; }
404 408
    ///Returns \c true if \c a is \e surely non-zero
405
    static bool nonZero(Value a) { return a!=0;};
409
    static bool nonZero(Value a) { return a!=0;}
406 410

	
407 411
    ///@}
408 412

	
409 413
    ///Returns zero
410 414
    static Value zero() {return 0;}
411 415
  };
412 416

	
413 417
  ///Unsigned long long integer specialization of \ref Tolerance.
... ...
@@ -432,17 +436,17 @@
432 436
    static bool less(Value a,Value b) { return a<b;}
433 437
    ///Returns \c true if \c a is \e surely different from \c b
434 438
    static bool different(Value a,Value b) { return a!=b; }
435 439
    ///Returns \c true if \c a is \e surely positive
436 440
    static bool positive(Value a) { return 0<a; }
437 441
    ///Returns \c true if \c a is \e surely negative
438 442
    static bool negative(Value) { return false; }
439 443
    ///Returns \c true if \c a is \e surely non-zero
440
    static bool nonZero(Value a) { return a!=0;};
444
    static bool nonZero(Value a) { return a!=0;}
441 445

	
442 446
    ///@}
443 447

	
444 448
    ///Returns zero
445 449
    static Value zero() {return 0;}
446 450
  };
447 451

	
448 452
#endif
0 comments (0 inline)