◆ gamma()

IEEEValue boost::simd::gamma ( IEEEValue const &  x)

This function object computes the gamma function: \(\displaystyle \int_0^{\infty} t^{x-1}e^{-t}\mbox{d}t\).

Header <boost/simd/function/gamma.hpp>
Decorators
  • std_ calls std::tgamma
See also
gammaln
Example:
#include <boost/simd/eulerian.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack <float, 4>;
int main() {
pack_ft pf = {1.0f, 2.0f, -1.5f, 0.5f};
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::gamma(pf) = " << bs::gamma(pf) << '\n';
float xf = 2.0f;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::gamma(xf) = " << bs::gamma(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1.5, 0.5)
-> bs::gamma(pf) = (1, 1, 2.36327, 1.77245)
---- scalar
<- xf = 2
-> bs::gamma(xf) = 1