◆ sqr
Callable object computing the sqr operation. Required header: Members Functions
template< value T > auto operator()( T x ) const noexcept;
Parameters
Return value Computes elementwise the square of
auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::sqr Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/sqr.hpp>
#include <eve/function/saturated/sqr.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float, eve::fixed<4>>;
using wide_it = eve::wide<std::int16_t, eve::fixed<4>>;
int main()
{
wide_ft pf = {-1.0f, 2.0f, -3.0f, 182.0f};
wide_it pi = {-1, 2, -3, 182};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
float xf = -32768.0f;
std::int16_t xi = -32768;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- xi = " << xi << '\n'
return 0;
}
constexpr callable_sqr_ sqr Callable object computing the sqr operation. Definition: sqr.hpp:95 constexpr saturated_type const saturated Higher-order Callable Object imbuing saturation semantic onto other Callable Objects. Definition: saturated.hpp:68 |