EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RKMatrixEigenTransformations.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RKMatrixEigenTransformations.h
1 #pragma once
2 
3 #include "EigenMatrixTypedefs.h"
4 #include "RKTools.h"
5 
6 namespace genfit {
7 
8  template <unsigned int rows, unsigned int cols>
9  Eigen::Matrix<double, rows, cols> RKMatrixToEigenMatrix(const RKMatrix<rows, cols>& rkMatrix) {
10  Eigen::Matrix<double, rows, cols> eigenMatrix;
11 
12  for (unsigned int row=0; row < rows; ++row) {
13  for (unsigned int col=0; col < cols; ++col) {
14  eigenMatrix(row, col) = rkMatrix[cols*row + col];
15  }
16  }
17 
18  return eigenMatrix;
19  }
20 
21 
22  template <unsigned int rows, unsigned int cols>
23  RKMatrix<rows, cols> eigenMatrixToRKMatrix(const Eigen::Matrix<double, rows, cols>& eigenMatrix) {
24  RKMatrix<rows, cols> rkMatrix;
25 
26  for (unsigned int row=0; row < rows; ++row) {
27  for (unsigned int col=0; col < cols; ++col) {
28  rkMatrix(row, col) = eigenMatrix(row, col);
29  }
30  }
31 
32  return rkMatrix;
33  }
34 
35 }