Esempio n. 1
0
NT2_TEST_CASE_TPL ( definitely_greater_signed_int__3_0,  NT2_INTEGRAL_SIGNED_TYPES)
{
  
  using nt2::definitely_greater;
  using nt2::tag::definitely_greater_;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef typename nt2::meta::call<definitely_greater_(T,T,iT)>::type r_t;
  typedef typename nt2::meta::upgrade<T>::type u_t;
  typedef typename nt2::meta::logical<T>::type wished_r_t;


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


  // specific values tests
  NT2_TEST_EQUAL(definitely_greater(0,0,1), nt2::False<r_t>());
  NT2_TEST_EQUAL(definitely_greater(0,1,1), nt2::False<r_t>());
  // random verifications
  static const uint32_t NR = NT2_NB_RANDOM_TEST;
  {
    NT2_CREATE_BUF(tab_a0,T, NR, T(-10), T(10));
    NT2_CREATE_BUF(tab_a1,T, NR, T(-10), T(10));
    NT2_CREATE_BUF(tab_a2,iT, NR, T(-10), T(10));
    double ulp0, ulpd ; ulpd=ulp0=0.0;
    T a0;
    T a1;
    iT a2;
    for (uint32_t j =0; j < NR; ++j )
      {
        std::cout << "for params "
                  << "  a0 = "<< u_t(a0 = tab_a0[j])
                  << ", a1 = "<< u_t(a1 = tab_a1[j])
                  << ", a2 = "<< u_t(a2 = tab_a2[j])
                  << std::endl;
        NT2_TEST_EQUAL( nt2::definitely_greater(a0,a1,a2),nt2::definitely_greater(a0,a1,a2));
     }
     
   }
} // end of test for signed_int_
Esempio n. 2
0
NT2_TEST_CASE_TPL ( definitely_greater_real_3,  NT2_SIMD_REAL_TYPES)
{
  using nt2::definitely_greater;
  using nt2::tag::definitely_greater_;
  using boost::simd::native;
  typedef BOOST_SIMD_DEFAULT_EXTENSION  ext_t;
  typedef native<T,ext_t>                  vT;
  typedef typename nt2::meta::as_integer<vT>::type          ivT;
  typedef typename nt2::meta::call<definitely_greater_(vT,vT,ivT)>::type r_t;
  typedef typename nt2::meta::as_logical<vT>::type wished_r_t;

  // return type conformity test
  NT2_TEST_TYPE_IS(r_t, wished_r_t);


  // specific values tests
  NT2_TEST_EQUAL(definitely_greater(nt2::splat<vT>(0),nt2::splat<vT>(0),nt2::splat<ivT>(1)), nt2::False<r_t>());
  NT2_TEST_EQUAL(definitely_greater(nt2::splat<vT>(0),nt2::splat<vT>(1),nt2::splat<ivT>(1)), nt2::False<r_t>());
  NT2_TEST_EQUAL(definitely_greater(nt2::splat<vT>(1),nt2::splat<vT>(0),nt2::splat<ivT>(1)), nt2::True<r_t>());
}
Esempio n. 3
0
NT2_TEST_CASE_TPL ( definitely_greater_unsigned_int__3_0,  NT2_UNSIGNED_TYPES)
{
  
  using nt2::definitely_greater;
  using nt2::tag::definitely_greater_;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef typename nt2::meta::call<definitely_greater_(T,T,iT)>::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 nt2::meta::logical<T>::type wished_r_t;


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


  // specific values tests
  NT2_TEST_EQUAL(definitely_greater(T(0),T(0),iT(1)), nt2::False<r_t>());
  NT2_TEST_EQUAL(definitely_greater(T(0),T(1),iT(1)), nt2::False<r_t>());
} // end of test for unsigned_int_
Esempio n. 4
0
NT2_TEST_CASE_TPL ( definitely_greater_unsigned_int__3_0,  NT2_SIMD_UNSIGNED_TYPES)
{
  using nt2::definitely_greater;
  using nt2::tag::definitely_greater_;
  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<definitely_greater_(vT,vT,ivT)>::type r_t;
  typedef typename nt2::meta::call<definitely_greater_(T,T,iT)>::type sr_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  double ulpd;
  ulpd=0.0;


  // specific values tests
  NT2_TEST_EQUAL(definitely_greater(nt2::splat<vT>(0),nt2::splat<vT>(0),nt2::splat<ivT>(1))[0]!=0, nt2::False<sr_t>());
  NT2_TEST_EQUAL(definitely_greater(nt2::splat<vT>(0),nt2::splat<vT>(1),nt2::splat<ivT>(1))[0]!=0, nt2::False<sr_t>());
} // end of test for unsigned_int_
Esempio n. 5
0
NT2_TEST_CASE_TPL ( definitely_greater_signed_int__3_0,  NT2_SIMD_INTEGRAL_SIGNED_TYPES)
{
  using nt2::definitely_greater;
  using nt2::tag::definitely_greater_;
  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<definitely_greater_(vT,vT,ivT)>::type r_t;
  typedef typename nt2::meta::call<definitely_greater_(T,T,iT)>::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(-10), T(10));
    NT2_CREATE_BUF(tab_a1,T, NR, T(-10), T(10));
    NT2_CREATE_BUF(tab_a2,iT, NR, iT(-10), iT(10));
    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);
        vT a1 = load<vT>(&tab_a1[0],j);
        ivT a2 = load<ivT>(&tab_a2[0],j);
        r_t v = definitely_greater(a0,a1,a2);
        for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; i++)
        {

          NT2_TEST_EQUAL( v[i]!= 0,ssr_t(nt2::definitely_greater (a0[i],a1[i],a2[i])));
        }
      }

  }
} // end of test for signed_int_