source: trunk/lib/utility/Merge.h @ 303

Last change on this file since 303 was 303, checked in by Peter, 17 years ago

docs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1// $Id: Merge.h 303 2005-04-30 16:17:35Z peter $
2
3#ifndef _theplu_utility_merge_ 
4#define _theplu_utility_merge_
5
6#include <c++_tools/gslapi/matrix.h>
7
8#include <iostream>
9#include <string.h>
10#include <utility>
11#include <vector>
12
13
14namespace theplu {
15namespace utility {
16
17  using namespace std;
18
19  ///
20  /// A merger of datapoints on annotations.  Calculates weighted
21  /// average (m) of all (i) data points with same annotation:
22  /// m=sum(w_i*x_i)sum(w_i) and uncertainty U of new data point:
23  /// U=1/(sum(1/u_i))+sum(w_i^2*(x_i-m)^2)/(sum(w_i))^2 w_i is
24  /// calculated from errors u_i Missing values have error < 0
25  ///
26
27  class Merge
28  {
29  public:
30
31    ///
32    /// The default constructor. Not implemented.
33    ///
34    Merge(void);
35
36    ///
37    /// istream Constructor, arguments: data(matrix), weights(matrix),
38    /// annotations(vector)
39    ///
40    Merge(istream& data, istream& error, istream& annotations);
41
42    ///
43    /// matrix Constructor, arguments: data(matrix), weights(matrix),
44    /// annotations(vector)
45    ///
46    Merge(gslapi::matrix& data, gslapi::matrix& error, 
47          vector<string>& annotations);
48   
49    ///
50    /// Calculate new weighted data and error values.
51    ///
52    void do_something(void);
53   
54    ///
55    /// @return Const reference to the data matrix.
56    ///
57    inline const gslapi::matrix& data_matrix(void) const { return data_; }
58
59    ///
60    /// @return Const reference to the error matrix.
61    ///
62    inline const gslapi::matrix& error_matrix(void) const { return error_; }
63
64  private:
65    gslapi::matrix data_;
66    gslapi::matrix error_;
67    vector<string> annots_;
68    u_int nof_assays_;
69
70    void calculate_weights(gslapi::matrix&);
71    void Merge::merging(vector<u_int>, gslapi::matrix&);
72  };
73
74}} // of namespace utility and namespace theplu
75
76#endif
Note: See TracBrowser for help on using the repository browser.