本文整理汇总了C++中nt2::acsc方法的典型用法代码示例。如果您正苦于以下问题:C++ nt2::acsc方法的具体用法?C++ nt2::acsc怎么用?C++ nt2::acsc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nt2
的用法示例。
在下文中一共展示了nt2::acsc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NT2_TEST_CASE_TPL
//////////////////////////////////////////////////////////////////////////////
// Test behavior of arithmetic components using NT2_TEST_CASE
//////////////////////////////////////////////////////////////////////////////
NT2_TEST_CASE_TPL(acsc, NT2_SIMD_REAL_CONVERTIBLE_TYPES )
{
using nt2::acsc;
using nt2::functors::acsc_;
using nt2::load;
using nt2::simd::native;
using nt2::meta::cardinal_of;
typedef NT2_SIMD_DEFAULT_EXTENSION ext_t;
typedef native<T,ext_t> n_t;
typedef typename nt2::meta::call<acsc_(n_t)>::type call_type;
typedef typename nt2::meta::as_real<T>::type rT;
typedef native<rT,ext_t> rn_t;
NT2_TEST( (boost::is_same<call_type, rn_t>::value) );
NT2_ALIGNED_TYPE(T) data[1*cardinal_of<n_t>::value];
double z, m = 0;
for(int num = 0; num < 10; num++)
{
for(std::size_t i=0;i<1*cardinal_of<n_t>::value;++i){
data[i] = nt2::random(1.0, 10.0); // good value here for acsc
}
n_t a0 = load<n_t>(&data[0],0);
rn_t v = acsc(a0);
for(std::size_t j=0;j<cardinal_of<n_t>::value;++j)
{
NT2_TEST_LESSER( z = nt2::ulpdist(v[j], acsc(a0[j])), 1);
if (z > m) m = z;
}
}
std::cout << "ulp max = " << m << std::endl;
}
示例2: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( acsc_real__1_0, NT2_REAL_TYPES)
{
using nt2::acsc;
using nt2::tag::acsc_;
using nt2::load;
using nt2::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<acsc_(vT)>::type r_t;
typedef typename nt2::meta::call<acsc_(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(acsc(-nt2::Two<vT>())[0], -nt2::Pi<sr_t>()/6, 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Inf<vT>())[0], nt2::Zero<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Minf<vT>())[0], nt2::Zero<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Mone<vT>())[0], -nt2::Pio_2<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Nan<vT>())[0], nt2::Nan<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::One<vT>())[0], nt2::Pio_2<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Two<vT>())[0], nt2::Pi<sr_t>()/6, 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Zero<vT>())[0], nt2::Nan<sr_t>(), 0.5);
} // end of test for real_
示例3: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( acsc_real, NT2_REAL_TYPES)
{
using nt2::acsc;
using nt2::tag::acsc_;
typedef typename nt2::meta::call<acsc_(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
#ifndef BOOST_SIMD_NO_INVALIDS
NT2_TEST_ULP_EQUAL(acsc(nt2::Inf<T>()), nt2::Zero<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Minf<T>()), nt2::Zero<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Nan<T>()), nt2::Nan<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Zero<T>()), nt2::Nan<r_t>(), 0.5);
#endif
NT2_TEST_ULP_EQUAL(acsc(-nt2::Two<T>()), -nt2::Pio_6<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Mone<T>()), -nt2::Pio_2<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::One<T>()), nt2::Pio_2<r_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Two<T>()), nt2::Pio_6<r_t>(), 0.5);
}
示例4: NT2_TEST_CASE_TPL
NT2_TEST_CASE_TPL ( acsc_int_convert__1_0, NT2_SIMD_INT_CONVERT_TYPES)
{
using nt2::acsc;
using nt2::tag::acsc_;
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<acsc_(vT)>::type r_t;
typedef typename nt2::meta::call<acsc_(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, nt2::One<T>(), nt2::Ten<T>());
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 = acsc(a0);
for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; i++)
{
NT2_TEST_ULP_EQUAL( v[i],ssr_t(nt2::acsc (a0[i])), 1.0);
ulp0 = nt2::max(ulpd,ulp0);
}
}
std::cout << "max ulp found is: " << ulp0 << std::endl;
}
} // end of test for int_convert_
示例5: NT2_TEST_ULP_EQUAL
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<acsc_(vT)>::type r_t;
typedef typename nt2::meta::call<acsc_(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(acsc(nt2::One<vT>())[0], nt2::Pio_2<sr_t>(), 0.5);
NT2_TEST_ULP_EQUAL(acsc(nt2::Zero<vT>())[0], nt2::Nan<sr_t>(), 0.5);
} // end of test for int_convert_
NT2_TEST_CASE_TPL ( acsc_uint_convert__1_0, (uint32_t)(uint64_t))
{
using nt2::acsc;
using nt2::tag::acsc_;
using nt2::load;
using nt2::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;