E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ geommean

eve::geommean = functor<geommean_t>
inlineconstexpr

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide pf = {3.0, -1.0, -3.0, 10.0};
eve::wide qf = {4.0, 1.0, 1.0, 15.0};
eve::wide rf = {-1.0, 2.0, 3.0, 1.5};
kumi::tuple wt{pf, qf, rf};
std::cout << "<- pf = " << pf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "<- rf = " << rf << "\n";
std::cout << "<- wt = " << wt << "\n";
std::cout << "-> geommean(pf, qf) = " << eve::geommean(pf, qf) << "\n";
std::cout << "-> geommean(wt) = " << eve::geommean(wt) << "\n";
std::cout << "-> geommean[ignore_last(2)](pf, qf)= " << eve::geommean[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> geommean[pf > 0.0](pf, qf) = " << eve::geommean[pf > 0.0](pf, qf) << "\n";
std::cout << "-> geommean[pf > 0.0](pf, qf, rf) = " << eve::geommean(pf, qf, rf) << "\n";
auto apf = eve::abs(pf);
auto aqf = eve::abs(qf);
auto arf = eve::abs(rf);
std::cout << "-> geommean(apf, aqf, arf) = " << eve::geommean(apf, aqf, arf) << "\n";
std::cout << "-> geommean[kahan](apf, aqf, arf) = " << eve::geommean[eve::kahan](apf, aqf, arf) << "\n";
std::cout << "-> geommean[pedantic]](apf, aqf, arf) = " << eve::geommean[eve::pedantic](apf, aqf, arf) << "\n";
auto tup = kumi::tuple{apf, aqf, arf};
std::cout << "-> geommean[kahan](tup) = " << eve::geommean[eve::kahan](tup) << "\n";
}
constexpr auto abs
elementwise_callable object computing the absolute value of the parameter.
Definition abs.hpp:85
constexpr auto geommean
Callable object computing the geometric mean of the inputs. .
Definition geommean.hpp:93
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:320
Wrapper for SIMD registers.
Definition wide.hpp:94

Header file

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto geommean(floating_value auto x, floating_value auto ... xs) noexcept; // 1
constexpr auto geommean(kumi::non_empty_product_type auto const& tup) noexcept; // 2
// Lanes masking
constexpr auto geommean[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 3
constexpr auto geommean[logical_value auto m](/*any of the above overloads*/) noexcept; // 3
// Semantic options
constexpr auto geommean[kahan](/*any of the above overloads*/) noexcept; // 4
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. The geometric mean of the inputs is returned
  2. equivalent to the call on the elements of the tuple.
  3. The operation is performed conditionnaly
  4. uses kahan like compensated algorithm for better accuracy.

External references