E.V.E
v2022.09.01

◆ logspace_sub

eve::logspace_sub = {}
inlineconstexpr

Callable object computing the logspace_sub operation: \(\log\left(e^{x_0}-\sum_{i = 1}^n e^{x_i}\right)\).

Defined in Header

#include <eve/module/math.hpp>

Callable Signatures

namespace eve
{
auto logspace_sub(T arg0, U arg1, Ts ... args) noexcept;
}
Definition: value.hpp:83
constexpr callable_logspace_sub_ logspace_sub
Callable object computing the logspace_sub operation: .
Definition: logspace_sub.hpp:54
Definition: all_of.hpp:22

Parameters

arg0, arg1, args, ...: values.

Return value

The call logspace_sub(arg0, arg1, args...) is semantically equivalent to log(exp(arg0) - exp(arg1) - exp(args)...).

The result type is the common compatible type of the parameters.

Example

#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
w_t pf = {3, 2, 3, 3}, qf = {4, 1, 1, ~0};
std::cout << "---- simd" << '\n'
<< " <- pf = " << pf << '\n'
<< " <- qf = " << qf << '\n'
<< " -> logspace_sub(pf, qf) = " << eve::logspace_sub(pf, qf) << '\n'
;
float xi = 3, yi = 4;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
<< " yi = " << yi << '\n'
<< " -> logspace_sub(xi, yi) = " << eve::logspace_sub(xi, yi) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65