Exemplo n.º 1
0
NT2_TEST_CASE_TPL ( acospi_real__1_0,  NT2_SIMD_REAL_TYPES)
{
  using nt2::acospi;
  using nt2::tag::acospi_;
  using boost::simd::native;
  using nt2::meta::cardinal_of;
  using nt2::aligned_load;
  typedef BOOST_SIMD_DEFAULT_EXTENSION  ext_t;
  typedef native<T,ext_t>                  vT;

  static const nt2::uint32_t NR = NT2_NB_RANDOM_TEST;
  {
    NT2_CREATE_BUF(tab_a0,T, NR, nt2::Zero<T>(), nt2::One<T>());
    for(nt2::uint32_t j = 0; j < NR;j+=cardinal_of<vT>::value)
      {
        vT a0 = aligned_load<vT>(&tab_a0[0],j);
        vT v = acospi(a0);
        for(nt2::uint32_t i = 0; i< cardinal_of<vT>::value; i++)
        {

          NT2_TEST_ULP_EQUAL( v[i],T(nt2::acospi (a0[i])), 1.0);
        }
      }
  }
} // end of test for floating_
Exemplo n.º 2
0
NT2_TEST_CASE_TPL ( acospi_unsigned_int__1_0,  NT2_UNSIGNED_TYPES)
{

  using nt2::acospi;
  using nt2::tag::acospi_;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef typename nt2::meta::call<acospi_(T)>::type r_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  typedef typename nt2::meta::upgrade<T>::type u_t;
  typedef typename boost::dispatch::meta::as_floating<T>::type wished_r_t;


  // return type conformity test
  NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) );
  std::cout << std::endl;

  // specific values tests
  NT2_TEST_ULP_EQUAL(acospi(nt2::One<T>()), 0, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Zero<T>()), 0.5, 0.5);
} // end of test for unsigned_int_
Exemplo n.º 3
0
NT2_TEST_CASE_TPL ( acospi_real__1_0,  NT2_SIMD_REAL_TYPES)
{
  using nt2::acospi;
  using nt2::tag::acospi_;
  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<acospi_(vT)>::type r_t;
  typedef typename nt2::meta::call<acospi_(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(acospi(nt2::Half<vT>())[0], T(1)/3, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Mhalf<vT>())[0], T(2)/3, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Mone<vT>())[0], 1, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Nan<vT>())[0], nt2::Nan<sr_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::One<vT>())[0], 0, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Zero<vT>())[0], 0.5, 0.5);
} // end of test for real_
Exemplo n.º 4
0
NT2_TEST_CASE_TPL ( acospi_real__1_0,  NT2_SIMD_REAL_TYPES)
{
  using nt2::acospi;
  using nt2::tag::acospi_;
  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<acospi_(vT)>::type r_t;
  typedef typename nt2::meta::call<acospi_(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::Zero<T>(), nt2::One<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 = acospi(a0);
        for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; i++)
        {
          
          NT2_TEST_ULP_EQUAL( v[i],ssr_t(nt2::acospi (a0[i])), 1.0);
          ulp0 = nt2::max(ulpd,ulp0);
        }
      }
    std::cout << "max ulp found is: " << ulp0 << std::endl;
  }
} // end of test for floating_
Exemplo n.º 5
0
NT2_TEST_CASE_TPL ( acospi_real,  NT2_REAL_TYPES)
{
  using nt2::acospi;
  using nt2::tag::acospi_;

  typedef typename nt2::meta::call<acospi_(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(acospi(nt2::Nan<T>()), nt2::Nan<r_t>(), 0.5);
#endif
  NT2_TEST_ULP_EQUAL(acospi(nt2::Half<T>()), T(1)/3, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Mhalf<T>()), T(2)/3, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Mone<T>()), 1, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::One<T>()), 0, 0.5);
  NT2_TEST_ULP_EQUAL(acospi(nt2::Zero<T>()), 0.5, 0.5);
}