◆ nthroot
Callable object computing the nth root: \(x^{1/n}\). Required header: Members Functions
template< floating_real_value T,integral_value U > auto operator()( T x, U n) const noexcept;
Parameters
Return value Returns elementwise the value of \(x^{1/n}\). For negative The result type is of the compatibility type of the parameters. auto operator[]( conditional_expression auto cond ) const noexcept;
Higher-order function generating a masked version of eve::nthroot Parameters
Return value A Callable object so that the expression Supported decorators
ExampleSee it live on Compiler Explorer #include <eve/function/nthroot.hpp>
#include <eve/wide.hpp>
#include <eve/constant/inf.hpp>
#include <eve/constant/minf.hpp>
#include <eve/constant/nan.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float, eve::fixed<8>>;
using wide_nt = eve::wide<std::uint32_t, eve::fixed<8>>;
int main()
{
wide_ft pf = {2.0f, 64.0f, 4.0f, 2.0f, 2.0f,
wide_nt qn = {4, 3, 2, 1, 0, 4, 3, 2};
std::cout << "---- simd" << '\n'<< std::setprecision(20)
<< "<- pf = " << pf << '\n'
<< "<- qn = " << qn << '\n'
double xf = 64.0f;
int n = 3;
std::cout << "---- scalar" << '\n' << std::setprecision(20)
<< "<- xf = " << xf << '\n'
<< "<- n = " << n << '\n'
return 0;
}
constexpr callable_minf_ minf Callable object computing the negative infinity value. Definition: minf.hpp:55 constexpr raw_type const raw Higher-order Callable Object imbuing quick and dirty behaviour onto other Callable Objects. Definition: raw.hpp:43 constexpr callable_nthroot_ nthroot Callable object computing the nth root: . Definition: nthroot.hpp:89 |