E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ double_factorial

eve::double_factorial = functor<double_factorial_t>
inlineconstexpr

THe double factorial is defined as \(\displaystyle (2n)!! = \prod_{i=1}^n (2i)\) and \(\displaystyle (2n+1)!! = \prod_{i=0}^n (2i+1)\)

Header file

#include <eve/module/special.hpp>

Callable Signatures

namespace eve
{
// Regular overload
template <unsigned_value T> constexpr as_wide_as_t<double,T> double_factorial(T x) noexcept; // 1
// Lanes masking
constexpr auto double_factorial[conditional_expr auto c](unsigned_value auto x) noexcept; // 2
constexpr auto double_factorial[logical_value auto m](unsigned_value auto x) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition: conditional.hpp:27
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition: value.hpp:107
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition: value.hpp:71
constexpr auto double_factorial
elementwise_callableobject computing the double factorial ofn`
Definition: double_factorial.hpp:77
EVE Main Namespace.
Definition: abi.hpp:18

Parameters

  • n: unsigned argument.
  • c: Conditional expression masking the operation.
  • m: Logical value masking the operation.

Return value

  1. The value of the double factorial of n is returned.
  2. The operation is performed conditionnaly.

External references

Example

// revision 1
#include <eve/module/special.hpp>
#include <iostream>
int main()
{
eve::wide wu = {1u, 2u, 3u, 4u, 5u, 6u, 181u, 182u};
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> double_factorial(wu) = " << eve::double_factorial(wu) << "\n";
std::cout << "-> double_factorial[ignore_last(2)](wu)= " << eve::double_factorial[eve::ignore_last(2)](wu) << "\n";
std::cout << "-> double_factorial[wu != 182u](wu) = " << eve::double_factorial[wu != 182u](wu) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition: conditional.hpp:304
Wrapper for SIMD registers.
Definition: wide.hpp:71