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

◆ cumtrapz

auto eve::cumtrapz = functor<cumtrapz_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto trapz(eve::non_empty_product_type auto const& x,
eve::non_empty_product_type auto const& y) noexcept; // 1
constexpr auto trapz(floating_value auto ... ys) noexcept; // 2
constexpr auto trapz(eve::non_empty_product_type auto const& y) noexcept; // 2
constexpr auto trapz(floating_value h,
eve::non_empty_product_type auto const& y) noexcept; // 2
constexpr auto trapz(eve::invocable f, floating_value auto ... xs) noexcept; // 4
constexpr auto trapz(eve::invocable f, eve::non_empty_product_type auto const& x) noexcept; // 4
// Semantic options
constexpr auto trapz[widen](/*any of the above overloads*/) noexcept; // 4
}
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
EVE Main Namespace.
Definition abi.hpp:19

Parameters

  • xs ... : eve::floating values "real" ordered arguments in increasing order.
  • x, : eve::floating values "tuple of real" ordered arguments in increasing order.
  • y : tuple of real arguments
  • h : floating value scaling the abscissas
  • f : invocable requiring f :common_value_t<Xs...>() -> common_value_t<Xs...>. If widen is used, f must be usable with the upgraded type.

Return value

  1. return a kumi tuple of the values of the cumulated trapz of all xs converted to the element type of the common value of the xs. the xs have to be sorted in ascending order.
  2. same as 1., using the tuple elements.
  3. same of 1. or 2., but upgrading the elements of the result.
Note
Where [trapz}(eve::trapz) returns only the overall integral, cumtrapz returns a tuple of the current partialintegral values.

External references

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
kumi::tuple t{1.0, 2.0, 3.0, 4.0, 5.0};
std::cout << "t " << t << std::endl;
std::cout << "eve::cumtrapz(t) " << eve::cumtrapz(t) << std::endl;
std::cout << "eve::cumtrapz(1.0, 2.0, 3.0, 4.0, 5.0) " << eve::cumtrapz(1.0, 2.0, 3.0, 4.0, 5.0) << std::endl;
std::cout << "eve::cumtrapz(t) " << eve::cumtrapz(t) << std::endl;
std::cout << "eve::cumtrapz(0.5, t) " << eve::cumtrapz(0.5, t) << std::endl;
std::cout << "eve::cumtrapz(t, t) " << eve::cumtrapz(t, t) << std::endl;
std::cout << "eve::cumtrapz(t, kumi::map(eve::sqr, t)) " << eve::cumtrapz(t, kumi::map(eve::sqr, t)) << std::endl;
std::cout << "eve::cumtrapz(eve::sqr, t) " << eve::cumtrapz(eve::sqr, t) << std::endl;
using wf_t = eve::wide<double>;
auto e = wf_t([](auto i, auto){return eve::sqr(float(i)); });
kumi::tuple wt{wf_t(e), 12.0f, 13.0f, 100.0f};
std::cout << "wt " << wt << std::endl;
std::cout << "eve::cumtrapz(wt) " << eve::cumtrapz(wt) << std::endl;
};
constexpr auto sqr
Computes the square of the parameter.
Definition sqr.hpp:98
constexpr auto cumtrapz
callable converting a pack of values into a tuple of the cumulative trapezoidal of its values.
Definition cumtrapz.hpp:137
Wrapper for SIMD registers.
Definition wide.hpp:94