The value of the variance of the arguments is returned.
#include <eve/module/core.hpp>
#include <iostream>
#include <iomanip>
int main()
{
eve::wide wf0{0.0, 1.0, 2.0, 3.0, -1.0, -2.0, -3.0, 1.0};
std::cout << "<- wf0 = " << wf0 << "\n";
std::cout << "<- wf1 = " << wf1 << "\n";
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wi1 = " << wi1 << "\n";
std::cout << std::setprecision(15);
std::cout <<
"-> variance(wf0, wf1) = " <<
eve::variance(wf0, wf1) <<
"\n";
std::cout <<
"-> variance(wi0, wi1) = " <<
eve::variance(wi0, wi1) <<
"\n";
std::cout <<
"-> variance[wi0 != 0](wi0, wi1) = " <<
eve::variance[wi0 != 0](wi0, wi1) <<
"\n";
std::cout <<
"-> variance[raw](wi0, wi1) = " <<
eve::variance[eve::raw](wi0, wi1) <<
"\n";
std::cout <<
"-> variance(1.0f, eps_2, eps_2, eps_2) = " <<
eve::variance(1.0f, eps_2, eps_2, eps_2) <<
"\n";
std::cout <<
"-> variance[kahan](1.0f, eps_2, eps_2, eps_2) = " <<
eve::variance[eve::kahan](1.0f, eps_2, eps_2, eps_2) <<
" // float computation\n";
std::cout <<
"-> variance[raw](1.0f, eps_2, eps_2, eps_2) = " <<
eve::variance[eve::raw](1.0f, eps_2, eps_2, eps_2) <<
"\n";
auto deps_2 = double(eps_2);
std::cout <<
"-> variance(1.0, deps_2, deps_2, eps_2) = " << float(
eve::variance[eve::kahan](1.0, deps_2, deps_2, deps_2)) <<
" // double computation converted to float\n";
auto tup = kumi::tuple{1.0f, eps_2, eps_2, eps_2};
std::cout <<
"-> variance[kahan](tup) = " <<
eve::variance[eve::kahan](tup) <<
"\n";
std::cout <<
eve::variance[eve::raw](1.0f, 2.0f, 3.0f, 4.0f) <<
"\n";
std::cout <<
eve::variance[eve::unbiased](1.0f, 2.0f, 3.0f, 4.0f) <<
"\n";
std::cout <<
eve::variance[eve::unbiased][eve::raw](1.0f, 2.0f, 3.0f, 4.0f) <<
"\n";
std::cout <<
eve::variance[eve::unbiased][eve::raw][eve::widen](1.0f, 2.0f, 3.0f, 4.0f) <<
"\n";
}
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:74
constexpr auto smallestposval
Computes the smallest normal positive value.
Definition smallestposval.hpp:71
Lightweight type-wrapper.
Definition as.hpp:29
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:353
Wrapper for SIMD registers.
Definition wide.hpp:94