本文整理汇总了C++中nt2::digamma方法的典型用法代码示例。如果您正苦于以下问题:C++ nt2::digamma方法的具体用法?C++ nt2::digamma怎么用?C++ nt2::digamma使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nt2
的用法示例。
在下文中一共展示了nt2::digamma方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( digamma_real, NT2_SIMD_REAL_TYPES)
{
using nt2::digamma;
using nt2::tag::digamma_;
using boost::simd::native;
typedef BOOST_SIMD_DEFAULT_EXTENSION ext_t;
typedef native<T,ext_t> vT;
// specific values tests
NT2_TEST_ULP_EQUAL(digamma(nt2::One<vT>()), nt2::splat<vT>(-0.57721566490153286555), 0.5);
}
示例2: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( digamma_real, NT2_REAL_TYPES)
{
using nt2::digamma;
using nt2::tag::digamma_;
typedef typename nt2::meta::call<digamma_(T)>::type r_t;
typedef T wished_r_t;
// return type conformity test
NT2_TEST_TYPE_IS(r_t, wished_r_t);
// specific values tests
NT2_TEST_ULP_EQUAL(digamma(nt2::Zero<T>()), nt2::Inf<T>(), 0.5);
NT2_TEST_ULP_EQUAL(digamma(nt2::Mzero<T>()), nt2::Minf<T>(), 0.5);
NT2_TEST_ULP_EQUAL(digamma(nt2::One<T>()), boost::math::digamma(nt2::One<T>()), 0.5);
NT2_TEST_ULP_EQUAL(digamma(T(1.4669020846486091614)),T(boost::math::digamma(double(T(1.4669020846486091614)))), 0.5);
NT2_TEST_ULP_EQUAL(digamma(T(1.461632133e+00)), T(boost::math::digamma(double(T(1.461632133e+00)))), 7.5);
NT2_TEST_ULP_EQUAL(digamma(T(-3.5)), T(boost::math::digamma(double(T(-3.5)))), 0.5);
NT2_TEST_ULP_EQUAL(digamma(T(-3.51)), T(boost::math::digamma(double(T(-3.51)))), 0.5);
NT2_TEST_ULP_EQUAL(digamma(T(-6)), nt2::Nan<T>(), 0.5);
NT2_TEST_ULP_EQUAL(digamma(T(6)) , T(1.706117668431801e+00), 1);
// NT2_TEST_ULP_EQUAL(digamma(T(-1.221245221e-15)), T(8.188363203e+14), 0.5);
// NT2_TEST_ULP_EQUAL(digamma(T(-1.221245221e-15)), T(boost::math::digamma(double(T(-1.221245221e-15)))), 0.5);
}
示例3: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( digamma_real__1_0, NT2_SIMD_REAL_TYPES)
{
using nt2::digamma;
using nt2::tag::digamma_;
using nt2::load;
using boost::simd::native;
using nt2::meta::cardinal_of;
typedef NT2_SIMD_DEFAULT_EXTENSION ext_t;
typedef typename nt2::meta::upgrade<T>::type u_t;
typedef native<T,ext_t> n_t;
typedef n_t vT;
typedef typename nt2::meta::as_integer<T>::type iT;
typedef native<iT,ext_t> ivT;
typedef typename nt2::meta::call<digamma_(vT)>::type r_t;
typedef typename nt2::meta::call<digamma_(T)>::type sr_t;
typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
double ulpd;
ulpd=0.0;
// random verifications
static const nt2::uint32_t NR = NT2_NB_RANDOM_TEST;
{
NT2_CREATE_BUF(tab_a0,T, NR, T(1), T(2));
double ulp0, ulpd ; ulpd=ulp0=0.0;
for(nt2::uint32_t j = 0; j < NR;j+=cardinal_of<n_t>::value)
{
vT a0 = load<vT>(&tab_a0[0],j);
r_t v = digamma(a0);
for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; i++)
{
NT2_TEST_ULP_EQUAL( v[i],ssr_t(nt2::digamma (a0[i])), 2.5);
ulp0 = nt2::max(ulpd,ulp0);
}
}
std::cout << "max ulp found is: " << ulp0 << std::endl;
}
} // end of test for floating_
示例4: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( digamma_real__1_0, NT2_SIMD_REAL_TYPES)
{
using nt2::digamma;
using nt2::tag::digamma_;
using nt2::load;
using boost::simd::native;
using nt2::meta::cardinal_of;
typedef NT2_SIMD_DEFAULT_EXTENSION ext_t;
typedef typename nt2::meta::upgrade<T>::type u_t;
typedef native<T,ext_t> n_t;
typedef n_t vT;
typedef typename nt2::meta::as_integer<T>::type iT;
typedef native<iT,ext_t> ivT;
typedef typename nt2::meta::call<digamma_(vT)>::type r_t;
typedef typename nt2::meta::call<digamma_(T)>::type sr_t;
typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
double ulpd;
ulpd=0.0;
// specific values tests
NT2_TEST_ULP_EQUAL(digamma(nt2::One<vT>())[0], T(-0.57721566490153286555), 0.5);
} // end of test for floating_