LCOV - code coverage report
Current view: top level - source - FBStoppingRelative.cpp (source / functions) Hit Total Coverage
Test: LibForBES Unit Tests Lines: 13 13 100.0 %
Date: 2016-04-18 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "FBStoppingRelative.h"
       2             : 
       3             : #include <cmath>
       4             : #include <iostream>
       5             : 
       6           7 : FBStoppingRelative::FBStoppingRelative(double tol) : FBStopping(tol) {
       7             : 
       8           7 : }
       9             : 
      10       54225 : int FBStoppingRelative::stop(FBCache & c) {
      11       54225 :     double normx = 0;
      12       54225 :     Matrix * x = c.get_point();
      13      309350 :     for (int i = 0; i < x->length(); i++) {
      14      255125 :         double acc = (*x)[i];
      15      255125 :         normx += acc*acc;
      16             :     }
      17       54225 :     normx = sqrt(normx);
      18       54225 :     if (c.get_norm_fpr() <= m_tol * (1 + normx)) return 1;
      19       53324 :     else return 0;
      20             : }
      21             : 
      22           7 : FBStoppingRelative::~FBStoppingRelative() {
      23             : 
      24          16 : }

Generated by: LCOV version 1.10