Last change
on this file since 81 was
81,
checked in by cecilia, 19 years ago
|
merge object + test program + data files
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
1 | // $Id: Merge.h 81 2004-05-26 13:30:01Z cecilia $ |
---|
2 | |
---|
3 | #ifndef _theplu_cpptools_merge_ //vad är detta? |
---|
4 | #define _theplu_cpptools_merge_ |
---|
5 | |
---|
6 | #include <iostream> |
---|
7 | #include <string.h> |
---|
8 | #include <utility> |
---|
9 | #include <vector> |
---|
10 | |
---|
11 | #include "vector.h" |
---|
12 | #include "matrix.h" |
---|
13 | |
---|
14 | namespace theplu { |
---|
15 | namespace cpptools { |
---|
16 | |
---|
17 | using namespace std; |
---|
18 | |
---|
19 | /** |
---|
20 | A merger of datapoints on annotations. |
---|
21 | Calculates weighted average (m) of all (i) data points with same annotation: |
---|
22 | m=sum(w_i*x_i)sum(w_i) |
---|
23 | and uncertainty U of new data point: |
---|
24 | U=1/(sum(1/u_i))+sum(w_i^2*(x_i-m)^2)/(sum(w_i))^2 |
---|
25 | w_i is calculated from errors u_i |
---|
26 | */ |
---|
27 | class Merge |
---|
28 | { |
---|
29 | public: |
---|
30 | |
---|
31 | /// |
---|
32 | /// The default constructor. Not implemented. |
---|
33 | /// |
---|
34 | Merge(void); |
---|
35 | |
---|
36 | /// |
---|
37 | /// Constructor, arguments: data(matrix), weights(matrix), annotations(vector), nof_assays(int) |
---|
38 | /// |
---|
39 | Merge(istream& data, istream& error, istream& annotations, int nof_assays); |
---|
40 | |
---|
41 | /// |
---|
42 | /// Calculate new weighted data values. |
---|
43 | /// |
---|
44 | // modify data_ and error_ |
---|
45 | void do_something(void); |
---|
46 | |
---|
47 | /// |
---|
48 | /// Return matrix |
---|
49 | /// |
---|
50 | /// @return Const reference to the data matrix. |
---|
51 | /// |
---|
52 | inline const gslapi::matrix& data_matrix(void) const { return data_; } |
---|
53 | inline const gslapi::matrix& error_matrix(void) const { return error_; } |
---|
54 | |
---|
55 | private: |
---|
56 | gslapi::matrix data_; |
---|
57 | gslapi::matrix error_; |
---|
58 | vector<string> annots_; |
---|
59 | u_int nof_assays_; |
---|
60 | |
---|
61 | // or gslapi::matrix& ? |
---|
62 | gslapi::matrix calculate_weights(void) const; |
---|
63 | void Merge::merging(vector<u_int>, gslapi::matrix&); |
---|
64 | }; |
---|
65 | |
---|
66 | }} // of namespace cpptools and namespace theplu |
---|
67 | |
---|
68 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.