Changeset 1291


Ignore:
Timestamp:
May 9, 2008, 9:42:31 PM (13 years ago)
Author:
Jari Häkkinen
Message:

Fixes #361

Location:
branches/0.4-stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4-stable/test/averager_test.cc

    r1290 r1291  
    209209  delete ap2;
    210210
     211  for (int i=0; i<8; i++)
     212    ap.add(static_cast<double>(i),i,-1);
     213  if (std::abs(ap.correlation()-1)>tol) {
     214    suite.add(false);
     215    suite.err() << "correlation after removal of data: " << ap.correlation()
     216                << std::endl;
     217    suite.err() << "error: correlation between identical vectors is unity"
     218                << std::endl;
     219  }
     220  ap.add(static_cast<double>(1),1,-4);
     221  if (std::abs(ap.correlation()+1)>tol || ap.n()!=-2) {
     222    suite.add(false);
     223    suite.err() << "AveragerPair error: add with negatibe n\n";
     224  }
     225
     226
    211227  suite.out() << "testing AveragerPairWeighted" << std::endl;
    212228  AveragerPairWeighted apw;
  • branches/0.4-stable/yat/statistics/AveragerPair.cc

    r1275 r1291  
    44  Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2008 Peter Johansson
     6  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    87
    98  This file is part of the yat library, http://trac.thep.lu.se/yat
     
    4544  }
    4645
    47   void AveragerPair::add(const double x, const double y, const unsigned long n)
     46  void AveragerPair::add(const double x, const double y, const long n)
    4847  {
    4948    x_.add(x,n); y_.add(y,n); xy_ += n*x*y;
     
    7675  }
    7776
    78   unsigned long AveragerPair::n(void) const
     77  long AveragerPair::n(void) const
    7978  {
    8079    return x_.n();
  • branches/0.4-stable/yat/statistics/AveragerPair.h

    r1275 r1291  
    77  Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2008 Peter Johansson
     9  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    1110
    1211  This file is part of the yat library, http://trac.thep.lu.se/yat
     
    6968    /// Adding \a n pairs of data points with value \a x and \a y.
    7069    ///
    71     void add(const double x, const double y, const unsigned long n=1);
     70    void add(const double x, const double y, const long n=1);
    7271
    7372    /**
     
    111110    /// @return The number of pair of data points.
    112111    ///
    113     unsigned long n(void) const;
     112    long n(void) const;
    114113
    115114    ///
Note: See TracChangeset for help on using the changeset viewer.