Esempio n. 1
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 vcl_size_t(std::min(row_depth, col_depth));
}
Esempio n. 2
0
viennacl::vector<SCALARTYPE, ALIGNMENT>
viennacl::vector<SCALARTYPE, ALIGNMENT>::operator-(const vector_expression< const toeplitz_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;
}
      void element_op(vector_base<T> & vec1,
                      vector_expression<const vector_base<T>, const vector_base<T>, op_element_unary<OP> > const & proxy)
      {
        typedef T        value_type;
        typedef viennacl::linalg::detail::op_applier<op_element_unary<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());

        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());

#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]);
      }
Esempio n. 4
0
 vcl_size_t size(vector_expression<LHS, const unsigned int, op_column> const & proxy)
 {
   return size1(proxy.lhs());
 }
Esempio n. 5
0
 vcl_size_t size(vector_expression<const matrix_expression<const matrix_base<NumericT, F>, const matrix_base<NumericT, F>, op_trans>,
                                   const vector_base<NumericT>,
                                   op_prod> const & proxy)  //transposed matrix-vector product
 {
   return proxy.lhs().lhs().size2();
 }
Esempio n. 6
0
 vcl_size_t size(vector_expression<const vandermonde_matrix<T, A>, const VectorType, op_prod> const & proxy) { return proxy.lhs().size1();  }
Esempio n. 7
0
 typename viennacl::enable_if< viennacl::is_any_sparse_matrix<SparseMatrixType>::value,
                               vcl_size_t >::type
 size(vector_expression<const SparseMatrixType, const VectorType, op_prod> const & proxy)
 {
   return proxy.lhs().size1();
 }
Esempio n. 8
0
 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::linalg::prod_impl(rhs.lhs(), temp, lhs);
 }
Esempio n. 9
0
vcl_size_t size(vector_expression<const matrix_base<NumericT>, const vector_expression<LhsT, RhsT, OpT>, op_prod> const & proxy)  //matrix-vector product
{
  return proxy.lhs().size1();
}
Esempio n. 10
0
vcl_size_t size(vector_expression<const matrix_expression<const LhsT, const RhsT, OpT>,
                                  const matrix_expression<const LhsT, const RhsT, OpT>,
                                  op_col_sum> const & proxy)
{
  return size2(proxy.lhs());
}
Esempio n. 11
0
vcl_size_t size(vector_expression<const matrix_base<NumericT>,
                                  const matrix_base<NumericT>,
                                  op_col_sum> const & proxy)
{
  return size2(proxy.lhs());
}
Esempio n. 12
0
vcl_size_t size(vector_expression<const matrix_expression<const LhsT1, const RhsT1, OpT1>,
                                  const vector_expression<const LhsT2, const RhsT2, OpT2>,
                                  op_prod> const & proxy)
{
  return size1(proxy.lhs());
}
Esempio n. 13
0
vcl_size_t size(vector_expression<const matrix_expression<const LhsT, const RhsT, OpT>,
                                  const vector_base<NumericT>,
                                  op_prod> const & proxy)
{
  return size1(proxy.lhs());
}
Esempio n. 14
0
vcl_size_t size(vector_expression<const matrix_expression<const LhsT, const RhsT, OpT>,
                                  VectorT,
                                  op_prod> const & proxy)
{
  return size1(proxy.lhs());
}
Esempio n. 15
0
 vcl_size_t size(vector_expression<LHS, RHS, OP> const & proxy)
 {
   return size(proxy.lhs());
 }
Esempio n. 16
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());
}
Esempio n. 17
0
vcl_size_t size(vector_expression<const SparseMatrixType, const VectorType, op_prod> const & proxy)
{
  return size1(proxy.lhs());
}