gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Better return type for cycleLength() functions (#179) in the min mean cycle algorithms. The original Value type is used instead of the LargeValue type, which is introduced for internal computations.
0 3 0
default
3 files changed with 6 insertions and 6 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -384,50 +384,50 @@
384 384
      while ((v = _gr.source(e)) != u) {
385 385
        e = _data[v][--r].pred;
386 386
        _cycle_path->addFront(e);
387 387
        _best_length += _length[e];
388 388
        ++_best_size;
389 389
      }
390 390
      return true;
391 391
    }
392 392

	
393 393
    /// @}
394 394

	
395 395
    /// \name Query Functions
396 396
    /// The results of the algorithm can be obtained using these
397 397
    /// functions.\n
398 398
    /// The algorithm should be executed before using them.
399 399

	
400 400
    /// @{
401 401

	
402 402
    /// \brief Return the total length of the found cycle.
403 403
    ///
404 404
    /// This function returns the total length of the found cycle.
405 405
    ///
406 406
    /// \pre \ref run() or \ref findMinMean() must be called before
407 407
    /// using this function.
408
    LargeValue cycleLength() const {
409
      return _best_length;
408
    Value cycleLength() const {
409
      return static_cast<Value>(_best_length);
410 410
    }
411 411

	
412 412
    /// \brief Return the number of arcs on the found cycle.
413 413
    ///
414 414
    /// This function returns the number of arcs on the found cycle.
415 415
    ///
416 416
    /// \pre \ref run() or \ref findMinMean() must be called before
417 417
    /// using this function.
418 418
    int cycleArcNum() const {
419 419
      return _best_size;
420 420
    }
421 421

	
422 422
    /// \brief Return the mean length of the found cycle.
423 423
    ///
424 424
    /// This function returns the mean length of the found cycle.
425 425
    ///
426 426
    /// \note <tt>alg.cycleMean()</tt> is just a shortcut of the
427 427
    /// following code.
428 428
    /// \code
429 429
    ///   return static_cast<double>(alg.cycleLength()) / alg.cycleArcNum();
430 430
    /// \endcode
431 431
    ///
432 432
    /// \pre \ref run() or \ref findMinMean() must be called before
433 433
    /// using this function.
Ignore white space 6 line context
... ...
@@ -363,50 +363,50 @@
363 363
      if (!_best_found) return false;
364 364
      _cycle_path->addBack(_policy[_best_node]);
365 365
      for ( Node v = _best_node;
366 366
            (v = _gr.target(_policy[v])) != _best_node; ) {
367 367
        _cycle_path->addBack(_policy[v]);
368 368
      }
369 369
      return true;
370 370
    }
371 371

	
372 372
    /// @}
373 373

	
374 374
    /// \name Query Functions
375 375
    /// The results of the algorithm can be obtained using these
376 376
    /// functions.\n
377 377
    /// The algorithm should be executed before using them.
378 378

	
379 379
    /// @{
380 380

	
381 381
    /// \brief Return the total length of the found cycle.
382 382
    ///
383 383
    /// This function returns the total length of the found cycle.
384 384
    ///
385 385
    /// \pre \ref run() or \ref findMinMean() must be called before
386 386
    /// using this function.
387
    LargeValue cycleLength() const {
388
      return _best_length;
387
    Value cycleLength() const {
388
      return static_cast<Value>(_best_length);
389 389
    }
390 390

	
391 391
    /// \brief Return the number of arcs on the found cycle.
392 392
    ///
393 393
    /// This function returns the number of arcs on the found cycle.
394 394
    ///
395 395
    /// \pre \ref run() or \ref findMinMean() must be called before
396 396
    /// using this function.
397 397
    int cycleArcNum() const {
398 398
      return _best_size;
399 399
    }
400 400

	
401 401
    /// \brief Return the mean length of the found cycle.
402 402
    ///
403 403
    /// This function returns the mean length of the found cycle.
404 404
    ///
405 405
    /// \note <tt>alg.cycleMean()</tt> is just a shortcut of the
406 406
    /// following code.
407 407
    /// \code
408 408
    ///   return static_cast<double>(alg.cycleLength()) / alg.cycleArcNum();
409 409
    /// \endcode
410 410
    ///
411 411
    /// \pre \ref run() or \ref findMinMean() must be called before
412 412
    /// using this function.
Ignore white space 6 line context
... ...
@@ -371,50 +371,50 @@
371 371
      while ((v = _gr.source(e)) != u) {
372 372
        e = _data[v][--r].pred;
373 373
        _cycle_path->addFront(e);
374 374
        _cycle_length += _length[e];
375 375
        ++_cycle_size;
376 376
      }
377 377
      return true;
378 378
    }
379 379

	
380 380
    /// @}
381 381

	
382 382
    /// \name Query Functions
383 383
    /// The results of the algorithm can be obtained using these
384 384
    /// functions.\n
385 385
    /// The algorithm should be executed before using them.
386 386

	
387 387
    /// @{
388 388

	
389 389
    /// \brief Return the total length of the found cycle.
390 390
    ///
391 391
    /// This function returns the total length of the found cycle.
392 392
    ///
393 393
    /// \pre \ref run() or \ref findMinMean() must be called before
394 394
    /// using this function.
395
    LargeValue cycleLength() const {
396
      return _cycle_length;
395
    Value cycleLength() const {
396
      return static_cast<Value>(_cycle_length);
397 397
    }
398 398

	
399 399
    /// \brief Return the number of arcs on the found cycle.
400 400
    ///
401 401
    /// This function returns the number of arcs on the found cycle.
402 402
    ///
403 403
    /// \pre \ref run() or \ref findMinMean() must be called before
404 404
    /// using this function.
405 405
    int cycleArcNum() const {
406 406
      return _cycle_size;
407 407
    }
408 408

	
409 409
    /// \brief Return the mean length of the found cycle.
410 410
    ///
411 411
    /// This function returns the mean length of the found cycle.
412 412
    ///
413 413
    /// \note <tt>alg.cycleMean()</tt> is just a shortcut of the
414 414
    /// following code.
415 415
    /// \code
416 416
    ///   return static_cast<double>(alg.cycleLength()) / alg.cycleArcNum();
417 417
    /// \endcode
418 418
    ///
419 419
    /// \pre \ref run() or \ref findMinMean() must be called before
420 420
    /// using this function.
0 comments (0 inline)