Computes the nth element of the Fibonacci sequence \((f_i)_{i\in \mathbb{N}}\).
{
template< eve::unsigned_value N, eve::floating_real_value T, eve::floating_real_value U>
requires eve::compatible<T, U>
eve::common_compatible_t<T, U>
fibonacci(N n, T x, U y)
noexcept
}
constexpr callable_fibonacci_ fibonacci
Computes the nth element of the Fibonacci sequence .
Definition: fibonacci.hpp:61
Definition: all_of.hpp:22
#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