Example #1
0
 static void exec(LHS &lhs, RHS const &rhs)
 {
     expr::evaluate(rhs);
     length_type const size = lhs.size(1, 0);
     for (index_type i=0; i<size; ++i)
         lhs.put(i, rhs.get(i));
 }
Example #2
0
    static void exec(LHS &lhs, RHS const &rhs)
    {
        expr::evaluate(rhs);

        length_type const rows = lhs.size(2, 0);
        length_type const cols = lhs.size(2, 1);
        for (index_type j=0; j<cols; ++j)
            for (index_type i=0; i<rows; ++i)
                lhs.put(i, j, rhs.get(i, j));
    }
Example #3
0
    static void exec(LHS &lhs, RHS const &rhs)
    {
        expr::evaluate(rhs);

        length_type const size0 = lhs.size(3, 0);
        length_type const size1 = lhs.size(3, 1);
        length_type const size2 = lhs.size(3, 2);

        for (index_type i=0; i<size0; ++i)
            for (index_type k=0; k<size2; ++k)
                for (index_type j=0; j<size1; ++j)
                    lhs.put(i, j, k, rhs.get(i, j, k));
    }
Example #4
0
 binary_operator<
     typename LHS::const_iterator,
     typename RHS::const_iterator,
     Op,
     NA
 > operator()(const LHS &lhs, const RHS &rhs, const Op &op) {
     return binary_operator<
         typename LHS::const_iterator,
         typename RHS::const_iterator,
         Op,
         NA
     >(lhs.begin(), lhs.end(), hooks::extract_dims(lhs), rhs.begin(),
         rhs.end(), hooks::extract_dims(rhs), op);
 }
void operator()() {
    LHS lhs;
    RHS rhs;
    auto lhs_it = lhs.begin();
    auto rhs_it = rhs.begin();
    const auto lhs_end = lhs.end();
    const auto rhs_end = rhs.end();
    for( ; lhs_it != lhs_end && rhs_it != rhs_end; ) {
        std::tuple<typename LHS::rtype,typename RHS::rtype> t(*lhs_it, *rhs_it);
        //std::cout << "lhs_it="<<(*lhs_it)<<","<<(*rhs_it)<<std::endl;
        this->yield(t);
        ++lhs_it;
        ++rhs_it;
    }
}};
Example #6
0
  static void exec(LHS &lhs, RHS const &rhs)
  {
    if (parallel::has_same_map<D>(lhs.map(), rhs))
    {
      // Maps are same, no communication required.
      typedef typename distributed_local_block<LHS>::type lhs_local_block_type;
      typedef typename distributed_local_block<RHS>::type rhs_local_block_type;
      typedef typename block_traits<lhs_local_block_type>::plain_type 
	lhs_local_storage_type;
      typedef typename block_traits<rhs_local_block_type>::plain_type 
	rhs_local_storage_type;

      lhs_local_storage_type lhs_local_block = get_local_block(lhs);
      rhs_local_storage_type rhs_local_block = get_local_block(rhs);

      Dispatcher<D, lhs_local_block_type, rhs_local_block_type>::exec(lhs_local_block,
								      rhs_local_block);
    }
    else
    {
      // Maps are different, fall out to general expression.
      lhs_view_type lhs_view(lhs);
      rhs_view_type rhs_view(const_cast<RHS&>(rhs));
      parallel::expr(lhs_view, rhs_view);
    }
  }
	boost::logic::tribool evaluate(const typed_map& map) const {
		boost::logic::tribool result = lhs.valid(map) && rhs.valid(map);
		if (!result)
			return boost::logic::indeterminate;
		OP op;
		return op(lhs(map),rhs(map));
	}
  static void exec(LHS &lhs, RHS const &rhs)
  {
    using namespace impl;
    typedef typename simd::LValue_access_traits<typename LHS::value_type> WAT;
    typedef typename simd::Proxy_factory<RHS, false>::access_traits EAT;

    length_type const vec_size =
      simd::Simd_traits<typename LHS::value_type>::vec_size;
    Ext_data<LHS, layout_type> dda(lhs, SYNC_OUT);

    simd::Proxy<WAT,true>  lp(dda.data());
    simd::Proxy<EAT,false> rp(simd::Proxy_factory<RHS,false>::create(rhs));

    length_type const size = dda.size(0);
    length_type n = size;

    // loop using proxy interface. This generates the best code
    // with gcc 3.4 (with gcc 4.1 the difference to the first case
    // above is negligible).

    while (n >= vec_size)
    {
      lp.store(rp.load());
      n -= vec_size;
      lp.increment();
      rp.increment();
    }

    // Process the remainder, using simple loop fusion.
    for (index_type i = size - n; i != size; ++i) lhs.put(i, rhs.get(i));
  }
Example #9
0
  static void exec(LHS &lhs, RHS const &rhs)
  {
    VBlock const& vblock = rhs.get_vblk();
    MBlock const& mblock = rhs.get_mblk();

    typedef typename get_block_layout<LHS>::order_type order_type;

    Matrix<lhs_value_type, LHS> m_dst(lhs);
    const_Vector<v_value_type, VBlock> v(const_cast<VBlock&>(vblock));
    const_Matrix<m_value_type, MBlock> m(const_cast<MBlock&>(mblock));

    if (is_same<order_type, row2_type>::value)
    {
      if (D == row)
      {
	for (index_type r = 0; r < lhs.size(2, 0); ++r)
	  m_dst.row(r) = v * m.row(r);
      }
      else
      {
	for (index_type r = 0; r < lhs.size(2, 0); ++r)
	  m_dst.row(r) = v.get(r) * m.row(r);
      }
    }
    else // col2_type
    {
      if (D == row)
      {
	for (index_type c = 0; c < lhs.size(2, 1); ++c)
	  m_dst.col(c) = v.get(c) * m.col(c);
      }
      else
      {
	for (index_type c = 0; c < lhs.size(2, 1); ++c)
	  m_dst.col(c) = v * m.col(c);
      }
    }
  }
Example #10
0
  static void exec(LHS &lhs, RHS const &rhs)
  {
    if (parallel::has_same_map<D>(lhs.map(), rhs))
    {
      // Maps are same, no communication required.
      typedef typename distributed_local_block<LHS>::type lhs_local_block_type;
      typedef typename distributed_local_block<RHS>::type rhs_local_block_type;
      typedef typename block_traits<lhs_local_block_type>::plain_type 
	lhs_local_storage_type;
      typedef typename block_traits<rhs_local_block_type>::plain_type
	rhs_local_storage_type;

      lhs_local_storage_type lhs_local_block = get_local_block(lhs);
      rhs_local_storage_type rhs_local_block = get_local_block(rhs);

      Dispatcher<D, lhs_local_block_type, rhs_local_block_type>::exec(lhs_local_block,
								      rhs_local_block);
    }
    else
    {
      OVXX_DO_THROW(unimplemented("Expression cannot be reorganized"));
    }
  }
Example #11
0
void checkDeleter(LHS& lhs, RHS& rhs, int LHSState, int RHSState) {
    assert(lhs.get_deleter().state() == LHSState);
    assert(rhs.get_deleter().state() == RHSState);
}
 //Standard case: size1 from lhs, size2 from rhs (fits most cases)
 static vcl_size_t size1(LHS & lhs, RHS & /*rhs*/) { return lhs.size1(); }
 //Standard case: size1 from lhs, size2 from rhs (fits most cases)
 static std::size_t size1(LHS & lhs, RHS & /*rhs*/) { return lhs.size1(); }
Example #14
0
 //Standard case: LHS is the vector type and carries the correct size
 static unsigned int size(LHS & lhs, RHS & rhs) { return lhs.size(); }
 //Standard case: size1 from lhs, size2 from rhs (fits most cases)
 static size_t size1(LHS & lhs, RHS & rhs) { return lhs.size1(); }