E.V.E  0.1-beta

◆ zip

eve::zip = {}
inlineconstexpr

Callable object constructing a SoA value.

Required header: #include <eve/function/zip.hpp>

Members Functions

Member Effect
operator() Construct a eve::wide of a given eve::product_type from values

For scalar types returns a kumi::tuple or a product type


template<simd_value... Ws>
auto operator()(Ws... ws) const noexcept;
template<product_type Target, simd_value... Ws>
auto operator()(as<Target> t, Ws... ws) const noexcept;
Specifies that a type a SIMD type.
Definition: vectorized.hpp:32
Lightweight type-wrapper.
Definition: as.hpp:29
Parameters
tType to construct. By default, it's equal to kumi::tuple<eve::element_type<Ws>::type>` ws: Varidiac list of eve::simd_value to zip.

Return value

Construct an instance of eve::wide<Target> by aggregating each element of each values ws.


Example

See it live on Compiler Explorer

#include <eve/wide.hpp>
#include <eve/function/zip.hpp>
#include <eve/product_type.hpp>
#include <iostream>
struct data_block : eve::struct_support<data_block, float, std::int16_t,double>
{
friend std::ostream& operator<<(std::ostream& os, data_block const& d)
{
return os << "{" << get<0>(d) << " x " << get<1>(d) << " - " << get<2>(d) << "}";
}
};
int main()
{
using card_t = eve::cardinal_t<eve::wide<double>>;
eve::wide<double> wd = [](auto i, auto) { return 1.25 * (i+1); };
eve::wide<float , card_t> wf = [](auto i, auto) { return 1.f/(1+i); };
eve::wide<std::int16_t, card_t> wi = [](auto i, auto) { return i+1; };
std::cout << "---- values" << std::endl
<< "wf = " << wf << std::endl
<< "wi = " << wi << std::endl
<< "wd = " << wd << std::endl << std::endl;
std::cout << "---- zip as tuple" << std::endl
<< "-> zip(wf,wi,wd) = " << eve::zip(wf,wi,wd) << std::endl << std::endl;
std::cout << "---- zip as UDT" << std::endl
<< "-> zip(wf,wi,wd) = " << eve::zip(eve::as<data_block>(), wf,wi,wd) << std::endl;
return 0;
}
constexpr callable_zip_ zip
Callable object constructing a SoA value.
Definition: zip.hpp:57
Wrapper for SIMD registers.
Definition: wide.hpp:65