9 template <
unsigned int dim>
10 Eigen::Matrix<double, dim, 1> rootVectorToEigenVector(
const TVectorD& rootVector) {
11 const unsigned int rootVectorRows = rootVector.GetNrows();
12 assert(rootVectorRows == dim);
14 double eigenArray[dim];
15 const auto* rootArray = rootVector.GetMatrixArray();
18 rootArray + rootVectorRows,
19 std::begin(eigenArray));
21 return Eigen::Map<Eigen::Matrix<double, dim, 1>>(eigenArray);
24 template <
unsigned int dim>
25 TVectorD eigenVectorToRootVector(
const Eigen::Matrix<double, dim, 1>& eigenVector) {
26 const unsigned int eigenVectorRows = eigenVector.rows();
28 const double* eigenArray = eigenVector.data();
30 TVectorD rootVector(eigenVectorRows);
32 eigenArray + eigenVectorRows,
33 rootVector.GetMatrixArray());
38 template <
unsigned int dim>
39 Eigen::Matrix<double, dim, dim> rootMatrixSymToEigenMatrix(
const TMatrixDSym& rootMatrix) {
40 assert(rootMatrix.GetNrows() == dim);
41 assert(rootMatrix.GetNcols() == dim);
42 Eigen::Matrix<double, dim, dim> eigenMatrix;
44 for (
unsigned int row=0; row<dim; ++row) {
45 for (
unsigned int col=0; col<dim; ++col) {
46 eigenMatrix(row, col) = rootMatrix(row, col);
53 template <
unsigned int dim>
54 TMatrixDSym eigenMatrixToRootMatrixSym(
const Eigen::Matrix<double, dim, dim>& eigenMatrix) {
55 TMatrixDSym rootMatrix(dim);
57 for (
unsigned int row=0; row<dim; ++row) {
58 for (
unsigned int col=0; col<dim; ++col) {
59 rootMatrix(row, col) = eigenMatrix(row, col);
66 template <
unsigned int rows,
unsigned int cols>
67 Eigen::Matrix<double, rows, cols> rootMatrixToEigenMatrix(
const TMatrixD& rootMatrix) {
68 assert(rootMatrix.GetNrows() == rows);
69 assert(rootMatrix.GetNcols() == cols);
70 Eigen::Matrix<double, rows, cols> eigenMatrix;
72 for (
unsigned int row=0; row<rows; ++row) {
73 for (
unsigned int col=0; col<cols; ++col) {
74 eigenMatrix(row, col) = rootMatrix(row, col);
81 template <
unsigned int rows,
unsigned int cols>
82 TMatrixD eigenMatrixToRootMatrix(
const Eigen::Matrix<double, rows, cols>& eigenMatrix) {
83 TMatrixD rootMatrix(rows, cols);
85 for (
unsigned int row=0; row<rows; ++row) {
86 for (
unsigned int col=0; col<cols; ++col) {
87 rootMatrix(row, col) = eigenMatrix(row, col);