◆ pow_abs()

IEEEValue boost::simd::pow_abs ( IEEEValue const &  x,
IEEEValue const &  y 
)

This function object computes \(|x|^y\).

Header <boost/simd/function/pow_abs.hpp>
Decorators
  • raw_ is faster but can be inaccurate.
See also
pow, abs
Example:
#include <boost/simd/exponential.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack<float, 4>;
int main() {
pack_ft pf = {3.0f, -2.0f, -3.0f, 5.0f};
pack_ft qf = {4.0f, -1.0f, -3.0f, 0.0f};
std::cout << "---- simd" << '\n'
<< " <- pf = " << pf << '\n'
<< " <- qf = " << qf << '\n'
<< " -> bs::pow_abs(pf, qf) = " << bs::pow_abs(pf, qf) << '\n';
float xf = 3.0f, yf = 4.0f;
std::cout << "---- scalar" << '\n'
<< " xf = " << xf << '\n'
<< " yf = " << yf << '\n'
<< " -> bs::pow_abs(xf, yf) = " << bs::pow_abs(xf, yf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (3, -2, -3, 5)
<- qf = (4, -1, -3, 0)
-> bs::pow_abs(pf, qf) = (81, 0.5, 0.037037, 1)
---- scalar
xf = 3
yf = 4
-> bs::pow_abs(xf, yf) = 81