Computes the nth element of the Fibonacci sequence \((f_i)_{i\in \mathbb{N}}\).
{
template< eve::unsigned_value N, eve::floating_ordered_value T, eve::floating_ordered_value U>
}
constexpr callable_fibonacci_ fibonacci
Computes the nth element of the Fibonacci sequence .
Definition: fibonacci.hpp:60
typename eve::detail::common_value_impl< void, Ts... >::type common_value_t
Computes the SIMD-compatible common type between all Ts.
Definition: common_value.hpp:50
#include <eve/module/combinatorial.hpp>
#include <eve/wide.hpp>
#include <iomanip>
#include <iostream>
int
main()
{
w32_t n = {13, 25, 32, 180, 1, 2, 3, 4};
wf32_t a = {1, 2, 3, 4, 0.5, 0.33, -4.5, 0};
wf32_t b = {2, 3, 4, 0.5, 0.33, -4.5, 0, 1};
std::cout << "---- simd" << '\n'
<< " <- n = " << n << '\n'
<< " <- a = " << a << '\n'
<< " <- b = " << b << '\n'
<<
" -> fibonacci(n, 1.0f, 3.0f) = " <<
eve::fibonacci(n, 1.0f, 3.0f) <<
'\n'
<<
" -> fibonacci(n, 1.0f, b) = " <<
eve::fibonacci(n, 1.0f, b) <<
'\n';
std::uint32_t ns = 10;
float as = 1;
float bs = 1;
std::cout << "---- scalar" << '\n'
<< " ns = " << ns << '\n'
<< " as = " << as << '\n'
<< " bs = " << bs << '\n'
<<
" -> fibonacci(ns, as, bs) = " <<
eve::fibonacci(ns, as, bs) <<
'\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65