|
1 | 1 | #include "xsimd/xsimd.hpp"
|
2 | 2 | #include <iostream>
|
3 | 3 |
|
4 |
| -namespace xs = xsimd; |
5 |
| - |
6 |
| -#if XSIMD_VERSION_MAJOR >= 9 && (XSIMD_WITH_NEON64 || XSIMD_WITH_NEON) |
7 |
| -using number_type = float; |
8 |
| -#else |
9 |
| -using number_type = double; |
10 |
| -#endif |
11 |
| - |
12 | 4 | int main(int argc, char *argv[]) {
|
| 5 | + namespace xs = xsimd; |
13 | 6 | #if XSIMD_VERSION_MAJOR < 8
|
14 |
| - xs::batch<number_type, 4> a(1.5, 2.5, 3.5, 4.5); |
15 |
| - xs::batch<number_type, 4> b(2.5, 3.5, 4.5, 5.5); |
16 |
| -#elif XSIMD_VERSION_MAJOR < 9 |
17 |
| - xs::batch<number_type> a({1.5, 2.5, 3.5, 4.5}); |
18 |
| - xs::batch<number_type> b({2.5, 3.5, 4.5, 5.5}); |
| 7 | + xs::batch<double, 2> a(1., 1.); |
| 8 | + xs::batch<double, 2> b(2., 2.); |
19 | 9 | #else
|
20 |
| - xs::batch<number_type> a{1.5, 2.5, 3.5, 4.5}; |
21 |
| - xs::batch<number_type> b{2.5, 3.5, 4.5, 5.5}; |
| 10 | + auto a = xs::broadcast(1.); |
| 11 | + auto b = xs::broadcast(2.); |
22 | 12 | #endif
|
23 | 13 |
|
24 |
| - auto mean = (a + b) / 2; |
25 |
| - std::cout << mean << std::endl; |
| 14 | + auto mean = (a + b) / 2.; |
| 15 | + std::cout << "Mean: " << mean << std::endl; |
26 | 16 | return 0;
|
27 | 17 | }
|
0 commit comments