13void vo002_VectorCalculations()
26 std::cout <<
"v1 = " <<
v1 <<
"\n"
27 <<
"v2 = " <<
v2 <<
"\n"
28 <<
"v1 + v2 = " << v_sum <<
"\n"
29 <<
"v1 * v2 = " << v_mul << std::endl;
32 auto v_diff_s_0 =
v1 - 2;
33 auto v_diff_s_1 = 2 -
v1;
34 auto v_div_s_0 =
v1 / 2.;
35 auto v_div_s_1 = 2. /
v1;
37 std::cout <<
v1 <<
" - 2 = " << v_diff_s_0 <<
"\n"
38 <<
"2 - " <<
v1 <<
" = " << v_diff_s_1 <<
"\n"
39 <<
v1 <<
" / 2 = " << v_div_s_0 <<
"\n"
40 <<
"2 / " <<
v1 <<
" = " << v_div_s_1 << std::endl;
48 std::cout <<
"Mean of " <<
v1 <<
" is " << v1_mean <<
"\n"
49 <<
"Dot product of " <<
v1 <<
" and " <<
v2 <<
" is " << v1_dot_v2 << std::endl;
56 std::cout <<
"exp(" <<
v1 <<
") = " << v_exp <<
"\n"
57 <<
"log(" <<
v1 <<
") = " << v_log <<
"\n"
58 <<
"sin(" <<
v1 <<
") = " << v_sin << std::endl;
67 std::cout <<
"fast_exp(" <<
v1 <<
") = " << v_fast_exp <<
"\n"
68 <<
"fast_log(" <<
v1 <<
") = " << v_fast_log <<
"\n"
69 <<
"fast_sin(" <<
v1 <<
") = " << v_fast_sin << std::endl;
73 auto v_transf =
Map(
v1, [](
double x) {
return x * 2 / 3; });
75 std::cout <<
"Applying [](double x){return x * 2 / 3;} to " <<
v1 <<
" leads to " << v_transf <<
"\n";
RVec< PromoteType< T > > log(const RVec< T > &v)
auto Map(Args &&... args)
Create new collection applying a callable to the elements of the input collection.
RVec< PromoteType< T > > exp(const RVec< T > &v)
RVec< PromoteType< T > > sin(const RVec< T > &v)
__roodevice__ double fast_exp(double x)
__roodevice__ double fast_sin(double x)
__roodevice__ double fast_log(double x)
Double_t Mean(Long64_t n, const T *a, const Double_t *w=nullptr)
Returns the weighted mean of an array a with length n.