Belle II Software  release-05-02-19
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

class  DecorrelationMatrixTest
 Test Class. More...
 
struct  TestSpacePoint
 Helper struct for SpacePoint Tests. 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 177 of file decorrelationMatrix.cc.

178  {
179  const char* filename = "tmp_matrix_testoutput.dat";
180 
181  ofstream ofs(filename);
182  DecorrelationMatrix<3> covMatrix(m_covMatrix);
183  ofs << covMatrix.print() << std::endl;
184  ofs.close();
185 
186  ifstream ifs(filename);
187  DecorrelationMatrix<3> inMatrix{};
188  EXPECT_TRUE(inMatrix.readFromStream(ifs));
189  ifs.close();
190 
191  const TestMatrix& inMat = inMatrix.getMatrix();
192  for (auto i = 0; i < m_covMatrix.outerSize(); ++i) {
193  for (auto j = 0; j < m_covMatrix.innerSize(); ++j) {
194  EXPECT_DOUBLE_EQ(m_covMatrix(i, j), inMat(i, j));
195  }
196  }
197 
198  ASSERT_EQ(0, remove(filename)); // assert that the temporarily created file gets deleted again
199  }

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 30 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 44 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 58 of file decorrelationMatrix.cc.

Belle2::DecorrelationMatrix
Class holding a Matrix that can be used to decorrelate input data to Machine Learning classifiers.
Definition: DecorrelationMatrix.h:46
VXDTFFilterTest::TestMatrix
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > TestMatrix
typedef for less typing effort
Definition: decorrelationMatrix.cc:27
alignment.constraints_generator.filename
filename
File name.
Definition: constraints_generator.py:224