9 #include <tst/Verify.h>
11 #include <utl/AugerUnits.h>
12 #include <utl/AugerException.h>
22 #include <cppunit/extensions/HelperMacros.h>
23 #include <boost/tuple/tuple.hpp>
25 #include <utl/NumericalErrorPropagation.h>
26 #include <utl/CorrelationMatrix.h>
27 #include <utl/AugerException.h>
29 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(x == y)
37 CPPUNIT_TEST(TestCorrelationMatrix);
38 CPPUNIT_TEST(TestErrorPropagation);
39 CPPUNIT_TEST_SUITE_END();
43 template<
class Stream>
50 s << c.
Get(i,j) <<
" ";
61 std::vector<double>
operator()(
const std::vector<double>& inp)
const
63 std::vector<double>
out;
64 out.push_back(
m[0][0]*inp[0]+
m[0][1]*inp[1]+
m[0][2]*inp[2]+
m[0][3]*inp[3] + 10.);
65 out.push_back(
m[1][0]*inp[0]+
m[1][1]*inp[1]+
m[1][2]*inp[2]+
m[1][3]*inp[3] + 20.);
66 out.push_back(
m[2][0]*inp[0]+
m[2][1]*inp[1]+
m[2][2]*inp[2]+
m[2][3]*inp[3] + 30.);
112 "1 0.1 0.2 0.3 0.4 0.5\n"
113 "0.1 1 -0.11 -0.21 -0.31 -0.41\n"
114 "0.2 -0.11 1 0.12 0.22 0.32\n"
115 "0.3 -0.21 0.12 1 -0.13 -0.23\n"
116 "0.4 -0.31 0.22 -0.13 1 0.111\n"
117 "0.5 -0.41 0.32 -0.23 0.111 1\n";
125 vector<Parameter> input;
132 inputCorr.
Set(0,1, 0.11);
133 inputCorr.
Set(0,2,-0.12);
134 inputCorr.
Set(0,3,-0.13);
135 inputCorr.
Set(1,2, 0.22);
136 inputCorr.
Set(1,3,-0.23);
137 inputCorr.
Set(2,3,-0.34);
158 for (
int i=0;i<3;++i)
159 for (
int j=0;j<4;++j)
162 for (
int k=0;k<4;++k)
163 tmp[i][j] += fcn.
m[i][k]*inputCorr.
Get(k,j)*input[k].error*input[j].error;
167 for (
int i=0;i<3;++i)
168 for (
int j=0;j<3;++j)
171 for (
int k=0;k<4;++k)
172 vout += tmp[i][k]*fcn.
m[j][k];
173 s1 << vout << (j<2 ?
" " :
"\n");
177 for (
int i=0;i<3;++i)
178 for (
int j=0;j<3;++j)
void OutputMatrix(Stream &s, const CorrelationMatrix &c)
const std::vector< double > & GetPropagatedErrors() const
vector< t2list > out
output of the algorithm: a list of clusters
unsigned int GetNParameter() const
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
void Set(const int iPar, const int jPar, const double corr)
void TestCorrelationMatrix()
const CorrelationMatrix & GetPropagatedCorrelations() const
double Get(const int iPar, const int jPar) const
void TestErrorPropagation()
std::vector< double > operator()(const std::vector< double > &inp) const
#define ASSERT_EQUAL(x, y)