6 #include <mcbooster/EvaluateArray.h> 11 Eigen::Matrix<fptype, 5, Eigen::Dynamic>
to_5param(
const Eigen::Matrix<fptype, 16, Eigen::Dynamic> &mat) {
12 mcbooster::Particles_h h_p0(mat.cols());
13 mcbooster::Particles_h h_p1(mat.cols());
14 mcbooster::Particles_h h_p2(mat.cols());
15 mcbooster::Particles_h h_p3(mat.cols());
17 for(
int i = 0; i < mat.cols(); i++) {
18 h_p0[i].set(mat(3, i), mat(0, i), mat(1, i), mat(2, i));
19 h_p1[i].set(mat(7, i), mat(4, i), mat(5, i), mat(6, i));
20 h_p2[i].set(mat(11, i), mat(8, i), mat(9, i), mat(10, i));
21 h_p3[i].set(mat(15, i), mat(12, i), mat(13, i), mat(14, i));
24 mcbooster::Particles_d d_p0(h_p0.begin(), h_p0.end());
25 mcbooster::Particles_d d_p1(h_p1.begin(), h_p1.end());
26 mcbooster::Particles_d d_p2(h_p2.begin(), h_p2.end());
27 mcbooster::Particles_d d_p3(h_p3.begin(), h_p3.end());
29 mcbooster::RealVector_d d_m12(mat.cols());
30 mcbooster::RealVector_d d_m34(mat.cols());
31 mcbooster::RealVector_d d_cos12(mat.cols());
32 mcbooster::RealVector_d d_cos34(mat.cols());
33 mcbooster::RealVector_d d_phi(mat.cols());
35 mcbooster::ParticlesSet_d particles = {&d_p0, &d_p1, &d_p2, &d_p3};
36 mcbooster::VariableSet_d variables = {&d_m12, &d_m34, &d_cos12, &d_cos34, &d_phi};
39 mcbooster::EvaluateArray<Dim5>(eval, particles, variables);
41 mcbooster::RealVector_h h_m12(d_m12.begin(), d_m12.end());
42 mcbooster::RealVector_h h_m34(d_m34.begin(), d_m34.end());
43 mcbooster::RealVector_h h_cos12(d_cos12.begin(), d_cos12.end());
44 mcbooster::RealVector_h h_cos34(d_cos34.begin(), d_cos34.end());
45 mcbooster::RealVector_h h_phi(d_phi.begin(), d_phi.end());
47 Eigen::Matrix<fptype, 5, Eigen::Dynamic> output(5, mat.cols());
49 for(
int i = 0; i < mat.cols(); i++) {
50 output(0, i) = h_m12[i];
51 output(1, i) = h_m34[i];
52 output(2, i) = h_cos12[i];
53 output(3, i) = h_cos34[i];
54 output(4, i) = h_phi[i];
Eigen::Matrix< fptype, 5, Eigen::Dynamic > to_5param(const Eigen::Matrix< fptype, 16, Eigen::Dynamic > &mat)
This is a helper to convert values. It copies back and forth, so is only to be used in scripts...