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

◆ unfold

auto eve::unfold = functor<unfold_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto unfold(eve::value auto ... xs) noexcept; // 1
constexpr auto unfold(non_empty_product_type tup) noexcept; // 2
// Semantic options
constexpr auto unfold[widen](/*any of the above overloads*/) noexcept; // 2
}
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto unfold
tuple_callable utility to convert a pack of values into a tuple of scalar values.
Definition unfold.hpp:98
EVE Main Namespace.
Definition abi.hpp:19

Parameters

  • x: value arguments.
  • xs...: values arguments.
  • tup: kumi tuple of values.

Return value

  1. return a kumi tuple of scalar values of the elements of all xs converted to the element type of the common value of the xs.
  2. same as 1., using the tuple elements.
  3. same of 1. or 2., but upgrading the elements of the result.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
constexpr auto S = eve::cardinal_v<eve::wide<float>>;
auto fill = [](auto i, auto){return i;};
auto fill2 = [](auto i, auto){return (i+S);};
auto fill3 = [](auto i, auto){return (i+2*S);};
eve::wide<float> wf(fill);
eve::wide<float> wf2(fill2);
eve::wide<float> wf3(fill3);
std::cout << kumi::cat(eve::unfold(wf), eve::unfold(wf2), eve::unfold(wf3)) << std::endl;
std::cout << eve::unfold(wf, wf2, wf3) << std::endl;
std::cout << eve::unfold[eve::widen](wf, wf2, wf3) << std::endl;
std::cout << eve::unfold[eve::widen](wf, wf2, 1.0f)<< std::endl;
std::cout << eve::unfold(wf, 1.0f, 2.0f) << std::endl;
std::cout << eve::unfold(wi, 1, 2) << std::endl;
auto t = kumi::make_tuple(wi);
std::cout << t << std::endl;
std::cout << eve::unfold(t) << std::endl;
};
Wrapper for SIMD registers.
Definition wide.hpp:94