L
Luna Moon
Dear all,
Can C++/STL/Boost do the vectorized calculation as those in Matlab?
For example, in the following code, what I really want to do is to
send in a vector of u's.
All other parameters such as t, l1, l2, l3, etc. are scalars...
But u is a vector.
Thus, t6 becomes a vector.
t9 is an element-wise multiplication...
The following code was actually converted from Matlab.
If vectorized computation is not facilitated, then I have to call this
function millions of times.
But if vectorized computation is okay, then I can send in just a u
vector with batch elements a time.
I have many such code in Matlab need to be converted into C++ with
vectorization.
Any thoughts?
Thank you!
double t5, t6, t7, t9, t11, t13, t16, t20, t23, t27, t32, t34, t36,
t37, t38, t42,
t44, t47, t48, t51, t52, t54, t59, t60, t61, t66, t67, t69, t74,
t75, t76, t81,
t82, t84, t87, t105, t106, t110, t112;
t5 = exp(-t * l1 - t * l2 - t * l3);
t6 = t * u;
t7 = mu1 * mu1;
t9 = u * u;
t11 = kappa * kappa;
t13 = 0.1e1 / (t9 * t7 + t11);
Can C++/STL/Boost do the vectorized calculation as those in Matlab?
For example, in the following code, what I really want to do is to
send in a vector of u's.
All other parameters such as t, l1, l2, l3, etc. are scalars...
But u is a vector.
Thus, t6 becomes a vector.
t9 is an element-wise multiplication...
The following code was actually converted from Matlab.
If vectorized computation is not facilitated, then I have to call this
function millions of times.
But if vectorized computation is okay, then I can send in just a u
vector with batch elements a time.
I have many such code in Matlab need to be converted into C++ with
vectorization.
Any thoughts?
Thank you!
double t5, t6, t7, t9, t11, t13, t16, t20, t23, t27, t32, t34, t36,
t37, t38, t42,
t44, t47, t48, t51, t52, t54, t59, t60, t61, t66, t67, t69, t74,
t75, t76, t81,
t82, t84, t87, t105, t106, t110, t112;
t5 = exp(-t * l1 - t * l2 - t * l3);
t6 = t * u;
t7 = mu1 * mu1;
t9 = u * u;
t11 = kappa * kappa;
t13 = 0.1e1 / (t9 * t7 + t11);