gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Doc improvements is some files.
0 5 0
default
5 files changed with 69 insertions and 75 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -14,13 +14,13 @@
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
///\file
20
///\brief Some basic non inline function and static global data.
20
///\brief Some basic non-inline functions and static global data.
21 21

	
22 22
#include<lemon/tolerance.h>
23 23
#include<lemon/bits/invalid.h>
24 24
namespace lemon {
25 25

	
26 26
  float Tolerance<float>::def_epsilon = 1e-4;
Ignore white space 12 line context
... ...
@@ -23,12 +23,13 @@
23 23
///\brief Definition of INVALID.
24 24

	
25 25
namespace lemon {
26 26

	
27 27
  /// \brief Dummy type to make it easier to create invalid iterators.
28 28
  ///
29
  /// Dummy type to make it easier to create invalid iterators.
29 30
  /// See \ref INVALID for the usage.
30 31
  struct Invalid {
31 32
  public:
32 33
    bool operator==(Invalid) { return true;  }
33 34
    bool operator!=(Invalid) { return false; }
34 35
    bool operator< (Invalid) { return false; }
Ignore white space 6 line context
... ...
@@ -24,14 +24,13 @@
24 24

	
25 25
///\ingroup misc
26 26
///\file
27 27
///\brief A simple two dimensional vector and a bounding box implementation 
28 28
///
29 29
/// The class \ref lemon::dim2::Point "dim2::Point" implements
30
///a two dimensional vector with the usual
31
/// operations.
30
/// a two dimensional vector with the usual operations.
32 31
///
33 32
/// The class \ref lemon::dim2::BoundingBox "dim2::BoundingBox"
34 33
/// can be used to determine
35 34
/// the rectangular bounding box of a set of
36 35
/// \ref lemon::dim2::Point "dim2::Point"'s.
37 36

	
... ...
@@ -46,15 +45,13 @@
46 45
  /// \addtogroup misc
47 46
  /// @{
48 47

	
49 48
  /// A simple two dimensional vector (plainvector) implementation
50 49

	
51 50
  /// A simple two dimensional vector (plainvector) implementation
52
  ///with the usual vector
53
  /// operators.
54
  ///
51
  /// with the usual vector operations.
55 52
  template<typename T>
56 53
    class Point {
57 54

	
58 55
    public:
59 56

	
60 57
      typedef T Value;
... ...
@@ -67,13 +64,13 @@
67 64
      ///Default constructor
68 65
      Point() {}
69 66

	
70 67
      ///Construct an instance from coordinates
71 68
      Point(T a, T b) : x(a), y(b) { }
72 69

	
73
      ///The dimension of the vector.
70
      ///Returns the dimension of the vector (i.e. returns 2).
74 71

	
75 72
      ///The dimension of the vector.
76 73
      ///This function always returns 2. 
77 74
      int size() const { return 2; }
78 75

	
79 76
      ///Subscripting operator
... ...
@@ -93,20 +90,20 @@
93 90

	
94 91
      ///Give back the square of the norm of the vector
95 92
      T normSquare() const {
96 93
        return x*x+y*y;
97 94
      }
98 95
  
99
      ///Increment the left hand side by u
96
      ///Increment the left hand side by \c u
100 97
      Point<T>& operator +=(const Point<T>& u) {
101 98
        x += u.x;
102 99
        y += u.y;
103 100
        return *this;
104 101
      }
105 102
  
106
      ///Decrement the left hand side by u
103
      ///Decrement the left hand side by \c u
107 104
      Point<T>& operator -=(const Point<T>& u) {
108 105
        x -= u.x;
109 106
        y -= u.y;
110 107
        return *this;
111 108
      }
112 109

	
... ...
@@ -312,82 +309,83 @@
312 309
      
313 310
      ///Return \c true if the bounding box is empty.
314 311
      
315 312
      ///Return \c true if the bounding box is empty (i.e. return \c false
316 313
      ///if at least one point was added to the box or the coordinates of
317 314
      ///the box were set).
315
      ///
318 316
      ///The coordinates of an empty bounding box are not defined. 
319 317
      bool empty() const {
320 318
        return _empty;
321 319
      }
322 320
      
323 321
      ///Make the BoundingBox empty
324 322
      void clear() {
325 323
        _empty=1;
326 324
      }
327 325

	
328
      ///Give back the bottom left corner
326
      ///Give back the bottom left corner of the box
329 327

	
330
      ///Give back the bottom left corner.
328
      ///Give back the bottom left corner of the box.
331 329
      ///If the bounding box is empty, then the return value is not defined.
332 330
      Point<T> bottomLeft() const {
333 331
        return bottom_left;
334 332
      }
335 333

	
336
      ///Set the bottom left corner
334
      ///Set the bottom left corner of the box
337 335

	
338
      ///Set the bottom left corner.
336
      ///Set the bottom left corner of the box.
339 337
      ///It should only be used for non-empty box.
340 338
      void bottomLeft(Point<T> p) {
341 339
	bottom_left = p;
342 340
      }
343 341

	
344
      ///Give back the top right corner
342
      ///Give back the top right corner of the box
345 343

	
346
      ///Give back the top right corner.
344
      ///Give back the top right corner of the box.
347 345
      ///If the bounding box is empty, then the return value is not defined.
348 346
      Point<T> topRight() const {
349 347
        return top_right;
350 348
      }
351 349

	
352
      ///Set the top right corner
350
      ///Set the top right corner of the box
353 351

	
354
      ///Set the top right corner.
352
      ///Set the top right corner of the box.
355 353
      ///It should only be used for non-empty box.
356 354
      void topRight(Point<T> p) {
357 355
	top_right = p;
358 356
      }
359 357

	
360
      ///Give back the bottom right corner
358
      ///Give back the bottom right corner of the box
361 359

	
362
      ///Give back the bottom right corner.
360
      ///Give back the bottom right corner of the box.
363 361
      ///If the bounding box is empty, then the return value is not defined.
364 362
      Point<T> bottomRight() const {
365 363
        return Point<T>(top_right.x,bottom_left.y);
366 364
      }
367 365

	
368
      ///Set the bottom right corner
366
      ///Set the bottom right corner of the box
369 367

	
370
      ///Set the bottom right corner.
368
      ///Set the bottom right corner of the box.
371 369
      ///It should only be used for non-empty box.
372 370
      void bottomRight(Point<T> p) {
373 371
	top_right.x = p.x;
374 372
	bottom_left.y = p.y;
375 373
      }
376 374
 
377
      ///Give back the top left corner
375
      ///Give back the top left corner of the box
378 376

	
379
      ///Give back the top left corner.
377
      ///Give back the top left corner of the box.
380 378
      ///If the bounding box is empty, then the return value is not defined.
381 379
      Point<T> topLeft() const {
382 380
        return Point<T>(bottom_left.x,top_right.y);
383 381
      }
384 382

	
385
      ///Set the top left corner
383
      ///Set the top left corner of the box
386 384

	
387
      ///Set the top left corner.
385
      ///Set the top left corner of the box.
388 386
      ///It should only be used for non-empty box.
389 387
      void topLeft(Point<T> p) {
390 388
	top_right.y = p.y;
391 389
	bottom_left.x = p.x;
392 390
      }
393 391

	
... ...
@@ -530,16 +528,16 @@
530 528
        return b;
531 529
      }
532 530

	
533 531
    };//class Boundingbox
534 532

	
535 533

	
536
  ///Map of x-coordinates of a Point map
534
  ///Map of x-coordinates of a \ref Point "Point"-map
537 535

	
538 536
  ///\ingroup maps
539
  ///Map of x-coordinates of a \ref dim2::Point "Point"-map.
537
  ///Map of x-coordinates of a \ref Point "Point"-map.
540 538
  ///
541 539
  template<class M>
542 540
  class XMap 
543 541
  {
544 542
    M& _map;
545 543
  public:
... ...
@@ -567,13 +565,13 @@
567 565
  template<class M> 
568 566
  inline XMap<M> xMap(const M &m) 
569 567
  {
570 568
    return XMap<M>(m);
571 569
  }
572 570

	
573
  ///Constant (read only) version of XMap
571
  ///Constant (read only) version of \ref XMap
574 572

	
575 573
  ///\ingroup maps
576 574
  ///Constant (read only) version of \ref XMap
577 575
  ///
578 576
  template<class M>
579 577
  class ConstXMap 
... ...
@@ -597,13 +595,13 @@
597 595
  template<class M> 
598 596
  inline ConstXMap<M> xMap(const M &m) 
599 597
  {
600 598
    return ConstXMap<M>(m);
601 599
  }
602 600

	
603
  ///Map of y-coordinates of a Point map
601
  ///Map of y-coordinates of a \ref Point "Point"-map
604 602
    
605 603
  ///\ingroup maps
606 604
  ///Map of y-coordinates of a \ref Point "Point"-map.
607 605
  ///
608 606
  template<class M>
609 607
  class YMap 
... ...
@@ -634,13 +632,13 @@
634 632
  template<class M> 
635 633
  inline YMap<M> yMap(const M &m) 
636 634
  {
637 635
    return YMap<M>(m);
638 636
  }
639 637

	
640
  ///Constant (read only) version of YMap
638
  ///Constant (read only) version of \ref YMap
641 639

	
642 640
  ///\ingroup maps
643 641
  ///Constant (read only) version of \ref YMap
644 642
  ///
645 643
  template<class M>
646 644
  class ConstYMap 
... ...
@@ -665,19 +663,18 @@
665 663
  inline ConstYMap<M> yMap(const M &m) 
666 664
  {
667 665
    return ConstYMap<M>(m);
668 666
  }
669 667

	
670 668

	
671
    ///\brief Map of the normSquare()
672
    ///of a Point map
673
    ///
674
    ///Map of the \ref Point::normSquare() "normSquare()"
675
    ///of a \ref Point "Point"-map.
676
    ///\ingroup maps
677
    ///
669
  ///\brief Map of the \ref Point::normSquare() "normSquare()"
670
  ///of a \ref Point "Point"-map
671
  ///
672
  ///Map of the \ref Point::normSquare() "normSquare()"
673
  ///of a \ref Point "Point"-map.
674
  ///\ingroup maps
678 675
  template<class M>
679 676
  class NormSquareMap 
680 677
  {
681 678
    const M& _map;
682 679
  public:
683 680

	
Ignore white space 6 line context
... ...
@@ -507,13 +507,13 @@
507 507
  /// int b = rnd.uinteger<int>();          // 0 .. 2^31 - 1
508 508
  /// int c = rnd.integer<int>();           // - 2^31 .. 2^31 - 1
509 509
  /// bool g = rnd.boolean();               // P(g = true) = 0.5
510 510
  /// bool h = rnd.boolean(0.8);            // P(h = true) = 0.8
511 511
  ///\endcode
512 512
  ///
513
  /// The lemon provides a global instance of the random number
513
  /// LEMON provides a global instance of the random number
514 514
  /// generator which name is \ref lemon::rnd "rnd". Usually it is a
515 515
  /// good programming convenience to use this global generator to get
516 516
  /// random numbers.
517 517
  class Random {
518 518
  private:
519 519

	
... ...
@@ -523,27 +523,27 @@
523 523
    _random_bits::RandomCore<Word> core;
524 524
    _random_bits::BoolProducer<Word> bool_producer;
525 525
    
526 526

	
527 527
  public:
528 528

	
529
    /// \brief Constructor
529
    /// \brief Default constructor
530 530
    ///
531 531
    /// Constructor with constant seeding.
532 532
    Random() { core.initState(); }
533 533

	
534
    /// \brief Constructor
534
    /// \brief Constructor with seed
535 535
    ///
536 536
    /// Constructor with seed. The current number type will be converted
537 537
    /// to the architecture word type.
538 538
    template <typename Number>
539 539
    Random(Number seed) { 
540 540
      _random_bits::Initializer<Number, Word>::init(core, seed);
541 541
    }
542 542

	
543
    /// \brief Constructor
543
    /// \brief Constructor with array seeding
544 544
    ///
545 545
    /// Constructor with array seeding. The given range should contain
546 546
    /// any number type and the numbers will be converted to the
547 547
    /// architecture word type.
548 548
    template <typename Iterator>
549 549
    Random(Iterator begin, Iterator end) { 
... ...
@@ -574,13 +574,13 @@
574 574
      return *this;
575 575
    }
576 576

	
577 577
    /// \brief Returns a random real number from the range [0, 1)
578 578
    ///
579 579
    /// It returns a random real number from the range [0, 1). The
580
    /// default Number type is double.
580
    /// default Number type is \c double.
581 581
    template <typename Number>
582 582
    Number real() {
583 583
      return _random_bits::RealConversion<Number, Word>::convert(core);
584 584
    }
585 585

	
586 586
    double real() {
... ...
@@ -650,14 +650,14 @@
650 650
      return _random_bits::Mapping<Number, Word>::map(core, b);
651 651
    }
652 652

	
653 653
    /// \brief Returns a random non-negative integer
654 654
    ///
655 655
    /// It returns a random non-negative integer uniformly from the
656
    /// whole range of the current \c Number type.  The default result
657
    /// type of this function is unsigned int.
656
    /// whole range of the current \c Number type. The default result
657
    /// type of this function is <tt>unsigned int</tt>.
658 658
    template <typename Number>
659 659
    Number uinteger() {
660 660
      return _random_bits::IntConversion<Number, Word>::convert(core);
661 661
    }
662 662

	
663 663
    unsigned int uinteger() {
... ...
@@ -665,13 +665,13 @@
665 665
    }
666 666

	
667 667
    /// \brief Returns a random integer
668 668
    ///
669 669
    /// It returns a random integer uniformly from the whole range of
670 670
    /// the current \c Number type. The default result type of this
671
    /// function is int.
671
    /// function is \c int.
672 672
    template <typename Number>
673 673
    Number integer() {
674 674
      static const int nb = std::numeric_limits<Number>::digits + 
675 675
        (std::numeric_limits<Number>::is_signed ? 1 : 0);
676 676
      return _random_bits::IntConversion<Number, Word, nb>::convert(core);
677 677
    }
... ...
@@ -686,13 +686,13 @@
686 686
    /// random bits. Every time when it become empty the generator makes
687 687
    /// a new random word and fill the buffer up.
688 688
    bool boolean() {
689 689
      return bool_producer.convert(core);
690 690
    }
691 691

	
692
    ///\name Nonuniform distributions
692
    ///\name Non-uniform distributions
693 693
    ///
694 694
    
695 695
    ///@{
696 696
    
697 697
    /// \brief Returns a random bool
698 698
    ///
Ignore white space 6 line context
... ...
@@ -33,40 +33,36 @@
33 33
  /// @{
34 34
  
35 35
  ///\brief A class to provide a basic way to
36 36
  ///handle the comparison of numbers that are obtained
37 37
  ///as a result of a probably inexact computation.
38 38
  ///
39
  ///Tolerance is a class to provide a basic way to
39
  ///\ref Tolerance is a class to provide a basic way to
40 40
  ///handle the comparison of numbers that are obtained
41 41
  ///as a result of a probably inexact computation.
42 42
  ///
43 43
  ///This is an abstract class, it should be specialized for all numerical
44
  ///data types. These specialized classes like Tolerance<double>
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__  
52 51
  ///\sa Tolerance<long long int>
53
#endif
54 52
  ///\sa Tolerance<unsigned int>
55
#if defined __GNUC__ && !defined __STRICT_ANSI__  
56 53
  ///\sa Tolerance<unsigned long long int>
57
#endif
58 54

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

	
65 61
    ///\name Comparisons
66
    ///The concept is that these bool functions return with \c true only if
62
    ///The concept is that these bool functions return \c true only if
67 63
    ///the related comparisons hold even if some numerical error appeared
68 64
    ///during the computations.
69 65

	
70 66
    ///@{
71 67

	
72 68
    ///Returns \c true if \c a is \e surely strictly less than \c b
... ...
@@ -104,27 +100,27 @@
104 100
  public:
105 101
    ///\e
106 102
    typedef float Value;
107 103

	
108 104
    ///Constructor setting the epsilon tolerance to the default value.
109 105
    Tolerance() : _epsilon(def_epsilon) {}
110
    ///Constructor setting the epsilon tolerance.
106
    ///Constructor setting the epsilon tolerance to the given value.
111 107
    Tolerance(float e) : _epsilon(e) {}
112 108

	
113
    ///Return the epsilon value.
109
    ///Returns the epsilon value.
114 110
    Value epsilon() const {return _epsilon;}
115
    ///Set the epsilon value.
111
    ///Sets the epsilon value.
116 112
    void epsilon(Value e) {_epsilon=e;}
117 113

	
118
    ///Return the default epsilon value.
114
    ///Returns the default epsilon value.
119 115
    static Value defaultEpsilon() {return def_epsilon;}
120
    ///Set the default epsilon value.
116
    ///Sets the default epsilon value.
121 117
    static void defaultEpsilon(Value e) {def_epsilon=e;}
122 118

	
123 119
    ///\name Comparisons
124
    ///See class Tolerance for more details.
120
    ///See \ref Tolerance for more details.
125 121

	
126 122
    ///@{
127 123

	
128 124
    ///Returns \c true if \c a is \e surely strictly less than \c b
129 125
    bool less(Value a,Value b) const {return a+_epsilon<b;}
130 126
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -155,27 +151,27 @@
155 151
  public:
156 152
    ///\e
157 153
    typedef double Value;
158 154

	
159 155
    ///Constructor setting the epsilon tolerance to the default value.
160 156
    Tolerance() : _epsilon(def_epsilon) {}
161
    ///Constructor setting the epsilon tolerance.
157
    ///Constructor setting the epsilon tolerance to the given value.
162 158
    Tolerance(double e) : _epsilon(e) {}
163 159

	
164
    ///Return the epsilon value.
160
    ///Returns the epsilon value.
165 161
    Value epsilon() const {return _epsilon;}
166
    ///Set the epsilon value.
162
    ///Sets the epsilon value.
167 163
    void epsilon(Value e) {_epsilon=e;}
168 164

	
169
    ///Return the default epsilon value.
165
    ///Returns the default epsilon value.
170 166
    static Value defaultEpsilon() {return def_epsilon;}
171
    ///Set the default epsilon value.
167
    ///Sets the default epsilon value.
172 168
    static void defaultEpsilon(Value e) {def_epsilon=e;}
173 169

	
174 170
    ///\name Comparisons
175
    ///See class Tolerance for more details.
171
    ///See \ref Tolerance for more details.
176 172

	
177 173
    ///@{
178 174

	
179 175
    ///Returns \c true if \c a is \e surely strictly less than \c b
180 176
    bool less(Value a,Value b) const {return a+_epsilon<b;}
181 177
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -206,27 +202,27 @@
206 202
  public:
207 203
    ///\e
208 204
    typedef long double Value;
209 205

	
210 206
    ///Constructor setting the epsilon tolerance to the default value.
211 207
    Tolerance() : _epsilon(def_epsilon) {}
212
    ///Constructor setting the epsilon tolerance.
208
    ///Constructor setting the epsilon tolerance to the given value.
213 209
    Tolerance(long double e) : _epsilon(e) {}
214 210

	
215
    ///Return the epsilon value.
211
    ///Returns the epsilon value.
216 212
    Value epsilon() const {return _epsilon;}
217
    ///Set the epsilon value.
213
    ///Sets the epsilon value.
218 214
    void epsilon(Value e) {_epsilon=e;}
219 215

	
220
    ///Return the default epsilon value.
216
    ///Returns the default epsilon value.
221 217
    static Value defaultEpsilon() {return def_epsilon;}
222
    ///Set the default epsilon value.
218
    ///Sets the default epsilon value.
223 219
    static void defaultEpsilon(Value e) {def_epsilon=e;}
224 220

	
225 221
    ///\name Comparisons
226
    ///See class Tolerance for more details.
222
    ///See \ref Tolerance for more details.
227 223

	
228 224
    ///@{
229 225

	
230 226
    ///Returns \c true if \c a is \e surely strictly less than \c b
231 227
    bool less(Value a,Value b) const {return a+_epsilon<b;}
232 228
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -253,13 +249,13 @@
253 249
  {
254 250
  public:
255 251
    ///\e
256 252
    typedef int Value;
257 253

	
258 254
    ///\name Comparisons
259
    ///See Tolerance for more details.
255
    ///See \ref Tolerance for more details.
260 256

	
261 257
    ///@{
262 258

	
263 259
    ///Returns \c true if \c a is \e surely strictly less than \c b
264 260
    static bool less(Value a,Value b) { return a<b;}
265 261
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -286,13 +282,13 @@
286 282
  {
287 283
  public:
288 284
    ///\e
289 285
    typedef unsigned int Value;
290 286

	
291 287
    ///\name Comparisons
292
    ///See Tolerance for more details.
288
    ///See \ref Tolerance for more details.
293 289

	
294 290
    ///@{
295 291

	
296 292
    ///Returns \c true if \c a is \e surely strictly less than \c b
297 293
    static bool less(Value a,Value b) { return a<b;}
298 294
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -320,13 +316,13 @@
320 316
  {
321 317
  public:
322 318
    ///\e
323 319
    typedef long int Value;
324 320

	
325 321
    ///\name Comparisons
326
    ///See Tolerance for more details.
322
    ///See \ref Tolerance for more details.
327 323

	
328 324
    ///@{
329 325

	
330 326
    ///Returns \c true if \c a is \e surely strictly less than \c b
331 327
    static bool less(Value a,Value b) { return a<b;}
332 328
    ///Returns \c true if \c a is \e surely different from \c b
... ...
@@ -353,13 +349,13 @@
353 349
  {
354 350
  public:
355 351
    ///\e
356 352
    typedef unsigned long int Value;
357 353

	
358 354
    ///\name Comparisons
359
    ///See Tolerance for more details.
355
    ///See \ref Tolerance for more details.
360 356

	
361 357
    ///@{
362 358

	
363 359
    ///Returns \c true if \c a is \e surely strictly less than \c b
364 360
    static bool less(Value a,Value b) { return a<b;}
365 361
    ///Returns \c true if \c a is \e surely different from \c b
0 comments (0 inline)