Belle II Software  release-08-01-10
VXDTFFilterTest Namespace Reference

helper struct for testing purposes providing the necessary coordinate accessors NOTE: this is only temporaryly stored in a separate header! More...

Classes

struct  TestSpacePoint
 Helper struct for SpacePoint Tests. More...
 
class  DecorrelationMatrixTest
 Test Class. More...
 

Typedefs

using TestMatrix = Eigen::Matrix< double, 3, 3, Eigen::RowMajor >
 typedef for less typing effort
 

Functions

 TEST_F (DecorrelationMatrixTest, TestSetUp)
 basic test of correct SetUp
 
 TEST_F (DecorrelationMatrixTest, TestConstructor)
 test if the default constructor initializes the internal matrix to the identity matrix
 
 TEST_F (DecorrelationMatrixTest, TestCalculateDecorrMatrix)
 test if the decorrelation matrix is correctly calculated from a given covariance matrix
 
 TEST_F (DecorrelationMatrixTest, TestCaluclateCovMatrix)
 test if the calculation of the covariance matrix is correct
 
 TEST_F (DecorrelationMatrixTest, TestDecorrelationMatrixIO)
 test if the IO methods work as advertised. More...
 

Variables

const std::vector< double > v1
 MATLAB generated random vector. More...
 
const std::vector< double > v2
 MATLAB generated random vector. More...
 
const std::vector< double > v3
 MATLAB generated random vector. More...
 

Detailed Description

helper struct for testing purposes providing the necessary coordinate accessors NOTE: this is only temporaryly stored in a separate header!

Function Documentation

◆ TEST_F()

VXDTFFilterTest::TEST_F ( DecorrelationMatrixTest  ,
TestDecorrelationMatrixIO   
)

test if the IO methods work as advertised.

First write to and then read in again from a temporary file and then compare the written out and read in matrix

Definition at line 175 of file decorrelationMatrix.cc.

176  {
177  const char* filename = "tmp_matrix_testoutput.dat";
178 
179  ofstream ofs(filename);
180  DecorrelationMatrix<3> covMatrix(m_covMatrix);
181  ofs << covMatrix.print() << std::endl;
182  ofs.close();
183 
184  ifstream ifs(filename);
185  DecorrelationMatrix<3> inMatrix{};
186  EXPECT_TRUE(inMatrix.readFromStream(ifs));
187  ifs.close();
188 
189  const TestMatrix& inMat = inMatrix.getMatrix();
190  for (auto i = 0; i < m_covMatrix.outerSize(); ++i) {
191  for (auto j = 0; j < m_covMatrix.innerSize(); ++j) {
192  EXPECT_DOUBLE_EQ(m_covMatrix(i, j), inMat(i, j));
193  }
194  }
195 
196  ASSERT_EQ(0, remove(filename)); // assert that the temporarily created file gets deleted again
197  }
Class holding a Matrix that can be used to decorrelate input data to Machine Learning classifiers.
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > TestMatrix
typedef for less typing effort

Variable Documentation

◆ v1

const std::vector<double> v1
Initial value:
= {
0.537667139546100,
1.833885014595086,
-2.258846861003648,
0.862173320368121,
0.318765239858981,
-1.307688296305273,
-0.433592022305684,
0.342624466538650,
3.578396939725760,
2.769437029884877
}

MATLAB generated random vector.

Definition at line 28 of file decorrelationMatrix.cc.

◆ v2

const std::vector<double> v2
Initial value:
= {
-1.349886940156521,
3.034923466331855,
0.725404224946106,
-0.063054873189656,
0.714742903826096,
-0.204966058299775,
-0.124144348216312,
1.489697607785465,
1.409034489800479,
1.417192413429614
}

MATLAB generated random vector.

Definition at line 42 of file decorrelationMatrix.cc.

◆ v3

const std::vector<double> v3
Initial value:
= {
0.671497133608080,
-1.207486922685038,
0.717238651328838,
1.630235289164729,
0.488893770311789,
1.034693009917860,
0.726885133383238,
-0.303440924786016,
0.293871467096658,
-0.787282803758638
}

MATLAB generated random vector.

Definition at line 56 of file decorrelationMatrix.cc.