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

◆ logspace_add

auto eve::logspace_add = functor<logspace_add_t>
inlineconstexpr

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto logspace_add(floating_value auto x, floating_value auto ... xs) noexcept; // 1
constexpr auto logspace_add(kumi::non_empty_product_type auto const& tup) noexcept; // 2
// Lanes masking
constexpr auto logspace_add[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 3
constexpr auto logspace_add[logical_value auto m](/*any of the above overloads*/) noexcept; // 3
}
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:132
constexpr auto logspace_add
tuple_callable object computing the logspace_add operation:
Definition logspace_add.hpp:89
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The call logspace_add(x, xs...) is semantically equivalent to log(exp(log(x)) + + exp(log(xs))...) without causing unnecessary overflows or throwing away too much accuracy.
  2. equivalent to the call on the elements of the tuple.
  3. The operation is performed conditionnaly

Example

// revision 1
#include <eve/module/math.hpp>
#include <iostream>
int main()
{
eve::wide pf = {0.0, 2.0, 3.0, 30.0};
eve::wide qf = {0.0, 1.0, 1.0, 29.56};
eve::wide rf = {0.0, 0.5, 10.0,25.35};
kumi::tuple wt{pf, qf};
std::cout << "<- pf = " << pf << "\n";
std::cout << "<- qf = " << qf << "\n";
std::cout << "<- rf = " << rf << "\n";
std::cout << "<- wt = " << wt << "\n";
std::cout << "-> logspace_add(pf, qf) = " << eve::logspace_add(pf, qf) << "\n";
std::cout << "-> logspace_add(wt) = " << eve::logspace_add(wt) << "\n";
std::cout << "-> logspace_add[ignore_last(2)](pf, qf)= " << eve::logspace_add[eve::ignore_last(2)](pf, qf) << "\n";
std::cout << "-> logspace_add[pf != 3.0](pf, qf) = " << eve::logspace_add[pf != 3.0](pf, qf) << "\n";
std::cout << "-> logspace_add(pf, qf, rf) = " << eve::logspace_add(pf, qf, rf) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:70