E.V.E  0.1-beta

◆ broadcast

eve::broadcast = {}
inlineconstexpr

Required header:

#include <eve/function/broadcast.hpp>


Callable object performing a broadcast shuffling.

Members Functions

Member Effect
operator() Computes the absolute value of its parameter

template<std::size_t I>
auto operator()(eve::simd_value auto const& x, eve::index_t<I> i ) const noexcept;
Specifies that a type a SIMD type.
Definition: vectorized.hpp:32

Parameters

x: An instance of an SIMD value

i: An eve::index indicating which lane of x to broadcast

Return value

If x is an instance of an SIMD value T, the call is equivalent to T{x.get(I)}.


Example

See it live on Compiler Explorer

1#include <eve/function/broadcast.hpp>
2#include <eve/wide.hpp>
3#include <iostream>
4
5using wide_ft = eve::wide<float, eve::fixed<4>>;
7
8int main()
9{
10 wide_ft pf = {1.2f,0.34f,0.056f,0.0078f};
11 wide_it pi = {-1, 2,-3, 4,-5, 6,-7, 8};
12
13 std::cout << pf << "\n"
14 << eve::broadcast(pf, eve::index<3> ) << "\n";
15
16 std::cout << "\n";
17
18 std::cout << pi << "\n"
19 << eve::broadcast(pi, eve::index<5> ) << "\n";
20}
constexpr callable_pi_ pi
Callable object computing the value.
Definition: pi.hpp:54
constexpr callable_broadcast_ broadcast
Definition: broadcast.hpp:61
Wrapper for SIMD registers.
Definition: wide.hpp:65