Skip to content

Commit

Permalink
adds the ability to output the result of VecMDot to pooled vector
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikcfd committed Jan 1, 2019
1 parent f579ccd commit eb66115
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions viennacl/detail/vector_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ class vector_base

//read-write access to an element of the vector
/** @brief Read-write access to a single element of the vector */
entry_proxy<NumericT> operator()(size_type index);
entry_proxy<NumericT, OCLHandle> operator()(size_type index);
/** @brief Read-write access to a single element of the vector */
entry_proxy<NumericT> operator[](size_type index);
entry_proxy<NumericT, OCLHandle> operator[](size_type index);
/** @brief Read access to a single element of the vector */
const_entry_proxy<NumericT> operator()(size_type index) const;
const_entry_proxy<NumericT, OCLHandle> operator()(size_type index) const;
/** @brief Read access to a single element of the vector */
const_entry_proxy<NumericT> operator[](size_type index) const;
const_entry_proxy<NumericT, OCLHandle> operator[](size_type index) const;
self_type & operator += (const self_type & vec);
self_type & operator -= (const self_type & vec);

Expand Down
16 changes: 8 additions & 8 deletions viennacl/linalg/detail/op_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ namespace linalg
namespace detail
{

template<typename NumericT, typename B>
bool op_aliasing(vector_base<NumericT> const & /*lhs*/, B const & /*b*/)
template<typename NumericT, typename H, typename B>
bool op_aliasing(vector_base<NumericT, H> const & /*lhs*/, B const & /*b*/)
{
return false;
}

template<typename NumericT>
bool op_aliasing(vector_base<NumericT> const & lhs, vector_base<NumericT> const & b)
template<typename NumericT, typename H>
bool op_aliasing(vector_base<NumericT, H> const & lhs, vector_base<NumericT> const & b)
{
return lhs.handle() == b.handle();
}

template<typename NumericT, typename LhsT, typename RhsT, typename OpT>
bool op_aliasing(vector_base<NumericT> const & lhs, vector_expression<const LhsT, const RhsT, OpT> const & rhs)
template<typename NumericT, typename H, typename LhsT, typename RhsT, typename OpT>
bool op_aliasing(vector_base<NumericT, H> const & lhs, vector_expression<const LhsT, const RhsT, OpT> const & rhs)
{
return op_aliasing(lhs, rhs.lhs()) || op_aliasing(lhs, rhs.rhs());
}


template<typename NumericT, typename B>
bool op_aliasing(matrix_base<NumericT> const & /*lhs*/, B const & /*b*/)
template<typename NumericT, typename H, typename B>
bool op_aliasing(matrix_base<NumericT, H> const & /*lhs*/, B const & /*b*/)
{
return false;
}
Expand Down
22 changes: 11 additions & 11 deletions viennacl/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,39 +561,39 @@ return *this;
//read-write access to an element of the vector

template<class NumericT, typename OCLHandle, typename SizeT, typename DistanceT>
entry_proxy<NumericT> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator()(size_type index)
entry_proxy<NumericT, OCLHandle> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator()(size_type index)
{
assert( (size() > 0) && bool("Cannot apply operator() to vector of size zero!"));
assert( index < size() && bool("Index out of bounds!") );

return entry_proxy<NumericT>(start_ + stride_ * index, elements_);
return entry_proxy<NumericT, OCLHandle>(start_ + stride_ * index, elements_);
}

template<class NumericT, typename OCLHandle, typename SizeT, typename DistanceT>
entry_proxy<NumericT> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator[](size_type index)
entry_proxy<NumericT, OCLHandle> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator[](size_type index)
{
assert( (size() > 0) && bool("Cannot apply operator() to vector of size zero!"));
assert( index < size() && bool("Index out of bounds!") );

return entry_proxy<NumericT>(start_ + stride_ * index, elements_);
return entry_proxy<NumericT, OCLHandle>(start_ + stride_ * index, elements_);
}

template<class NumericT, typename OCLHandle, typename SizeT, typename DistanceT>
const_entry_proxy<NumericT> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator()(size_type index) const
const_entry_proxy<NumericT, OCLHandle> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator()(size_type index) const
{
assert( (size() > 0) && bool("Cannot apply operator() to vector of size zero!"));
assert( index < size() && bool("Index out of bounds!") );

return const_entry_proxy<NumericT>(start_ + stride_ * index, elements_);
return const_entry_proxy<NumericT, OCLHandle>(start_ + stride_ * index, elements_);
}

template<class NumericT, typename OCLHandle, typename SizeT, typename DistanceT>
const_entry_proxy<NumericT> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator[](size_type index) const
const_entry_proxy<NumericT, OCLHandle> vector_base<NumericT, OCLHandle, SizeT, DistanceT>::operator[](size_type index) const
{
assert( (size() > 0) && bool("Cannot apply operator() to vector of size zero!"));
assert( index < size() && bool("Index out of bounds!") );

return const_entry_proxy<NumericT>(start_ + stride_ * index, elements_);
return const_entry_proxy<NumericT, OCLHandle>(start_ + stride_ * index, elements_);
}

//////////////////////////// Read-write access to an element of the vector end ///////////////////
Expand Down Expand Up @@ -2058,10 +2058,10 @@ namespace detail
};

// x = inner_prod(z, {y0, y1, ...})
template<typename T>
struct op_executor<vector_base<T>, op_assign, vector_expression<const vector_base<T>, const vector_tuple<T>, op_inner_prod> >
template<typename T, typename H1, typename H2>
struct op_executor<vector_base<T, H1>, op_assign, vector_expression<const vector_base<T, H2>, const vector_tuple<T>, op_inner_prod> >
{
static void apply(vector_base<T> & lhs, vector_expression<const vector_base<T>, const vector_tuple<T>, op_inner_prod> const & rhs)
static void apply(vector_base<T, H1> & lhs, vector_expression<const vector_base<T, H2>, const vector_tuple<T>, op_inner_prod> const & rhs)
{
viennacl::linalg::inner_prod_impl(rhs.lhs(), rhs.rhs(), lhs);
}
Expand Down

0 comments on commit eb66115

Please sign in to comment.