Changeset 1291
- Timestamp:
- May 9, 2008, 9:42:31 PM (15 years ago)
- Location:
- branches/0.4-stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4-stable/test/averager_test.cc
r1290 r1291 209 209 delete ap2; 210 210 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 211 227 suite.out() << "testing AveragerPairWeighted" << std::endl; 212 228 AveragerPairWeighted apw; -
branches/0.4-stable/yat/statistics/AveragerPair.cc
r1275 r1291 4 4 Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson 5 5 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 8 7 9 8 This file is part of the yat library, http://trac.thep.lu.se/yat … … 45 44 } 46 45 47 void AveragerPair::add(const double x, const double y, const unsignedlong n)46 void AveragerPair::add(const double x, const double y, const long n) 48 47 { 49 48 x_.add(x,n); y_.add(y,n); xy_ += n*x*y; … … 76 75 } 77 76 78 unsignedlong AveragerPair::n(void) const77 long AveragerPair::n(void) const 79 78 { 80 79 return x_.n(); -
branches/0.4-stable/yat/statistics/AveragerPair.h
r1275 r1291 7 7 Copyright (C) 2004, 2005 Jari Häkkinen, Peter Johansson 8 8 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 11 10 12 11 This file is part of the yat library, http://trac.thep.lu.se/yat … … 69 68 /// Adding \a n pairs of data points with value \a x and \a y. 70 69 /// 71 void add(const double x, const double y, const unsignedlong n=1);70 void add(const double x, const double y, const long n=1); 72 71 73 72 /** … … 111 110 /// @return The number of pair of data points. 112 111 /// 113 unsignedlong n(void) const;112 long n(void) const; 114 113 115 114 ///
Note: See TracChangeset
for help on using the changeset viewer.