void element_op(vector_base<T> & vec1,
                      vector_expression<const vector_base<T>, const vector_base<T>, op_element_binary<OP> > const & proxy)
      {
        typedef T                                              value_type;
        typedef viennacl::linalg::detail::op_applier<op_element_binary<OP> >    OpFunctor;

        value_type       * data_vec1 = detail::extract_raw_pointer<value_type>(vec1);
        value_type const * data_vec2 = detail::extract_raw_pointer<value_type>(proxy.lhs());
        value_type const * data_vec3 = detail::extract_raw_pointer<value_type>(proxy.rhs());

        std::size_t start1 = viennacl::traits::start(vec1);
        std::size_t inc1   = viennacl::traits::stride(vec1);
        std::size_t size1  = viennacl::traits::size(vec1);

        std::size_t start2 = viennacl::traits::start(proxy.lhs());
        std::size_t inc2   = viennacl::traits::stride(proxy.lhs());

        std::size_t start3 = viennacl::traits::start(proxy.rhs());
        std::size_t inc3   = viennacl::traits::stride(proxy.rhs());

#ifdef VIENNACL_WITH_OPENMP
        #pragma omp parallel for if (size1 > VIENNACL_OPENMP_VECTOR_MIN_SIZE)
#endif
        for (std::size_t i = 0; i < size1; ++i)
          OpFunctor::apply(data_vec1[i*inc1+start1], data_vec2[i*inc2+start2], data_vec3[i*inc3+start3]);
      }
 static void apply(vector_base<T> & lhs, vector_expression<const vandermonde_matrix<T, A>, const vector_base<T>, op_prod> const & rhs)
 {
   // check for the special case x = A * x
   if (viennacl::traits::handle(lhs) == viennacl::traits::handle(rhs.rhs()))
   {
     viennacl::vector<T> temp(lhs);
     viennacl::linalg::prod_impl(rhs.lhs(), rhs.rhs(), temp);
     lhs = temp;
   }
   else
     viennacl::linalg::prod_impl(rhs.lhs(), rhs.rhs(), lhs);
 }
 static void apply(vector_base<T> & lhs, vector_expression<const vandermonde_matrix<T, A>, const vector_expression<const LHS, const RHS, OP>, op_prod> const & rhs)
 {
   viennacl::vector<T> temp(rhs.rhs());
   viennacl::vector<T> temp_result(lhs);
   viennacl::linalg::prod_impl(rhs.lhs(), temp, temp_result);
   lhs -= temp_result;
 }
 viennacl::vector<SCALARTYPE, ALIGNMENT> 
 viennacl::vector<SCALARTYPE, ALIGNMENT>::operator-(const vector_expression< const hankel_matrix<SCALARTYPE, MAT_ALIGNMENT>,
                                                                             const vector<SCALARTYPE, ALIGNMENT>,
                                                                             op_prod> & proxy) 
 {
   assert(proxy.get_lhs().size1() == size());
   vector<SCALARTYPE, ALIGNMENT> result(size());
   viennacl::linalg::prod_impl(proxy.lhs(), proxy.rhs(), result);
   result = *this - result;
   return result;
 }
Exemple #5
0
    vcl_size_t size(vector_expression<LHS, const int, op_matrix_diag> const & proxy)
    {
      int k = proxy.rhs();
      int A_size1 = static_cast<int>(size1(proxy.lhs()));
      int A_size2 = static_cast<int>(size2(proxy.lhs()));

      int row_depth = std::min(A_size1, A_size1 + k);
      int col_depth = std::min(A_size2, A_size2 - k);

      return std::min(row_depth, col_depth);
    }
Exemple #6
0
bool op_aliasing(vector_base<NumericT> const & lhs, vector_expression<const LhsT, const RhsT, OpT> const & rhs)
{
  return op_aliasing(lhs, rhs.lhs()) || op_aliasing(lhs, rhs.rhs());
}
Exemple #7
0
 vcl_size_t size(vector_expression<LHS, const vector_tuple<RHS>, op_inner_prod> const & proxy)
 {
   return proxy.rhs().const_size();
 }
 static void apply(vector_base<T> & lhs, vector_expression<const vandermonde_matrix<T, A>, const vector_base<T>, op_prod> const & rhs)
 {
   viennacl::vector<T> temp(lhs);
   viennacl::linalg::prod_impl(rhs.lhs(), rhs.rhs(), temp);
   lhs += temp;
 }