12 using namespace ROOT::VecOps;
14 void vo005_Combinations()
18 RVec<double> v1{1., 2., 3.};
19 RVec<double> v2{-4., -5.};
24 auto idx = Combinations(v1, v2);
27 auto c1 = Take(v1, idx[0]);
28 auto c2 = Take(v2, idx[1]);
33 std::cout <<
"Combinations of " << v1 <<
" and " << v2 <<
":" << std::endl;
34 for(
size_t i=0; i<v3.size(); i++) {
35 std::cout << c1[i] <<
" * " << c2[i] <<
" = " << v3[i] << std::endl;
37 std::cout << std::endl;
43 RVec<double> v4{1., 2., 3., 4.};
44 auto idx2 = Combinations(v4, 3);
47 auto c3 = Take(v4, idx2[0]);
48 auto c4 = Take(v4, idx2[1]);
49 auto c5 = Take(v4, idx2[2]);
51 auto v5 = c3 * c4 * c5;
53 std::cout <<
"Unique triples of " << v4 <<
":" << std::endl;
54 for(
size_t i=0; i<v4.size(); i++) {
55 std::cout << c3[i] <<
" * " << c4[i] <<
" * " << c5[i] <<
" = " << v5[i] << std::endl;
57 std::cout << std::endl;