void prod_impl(viennacl::circulant_matrix<NumericT, AlignmentV> const & mat,
               viennacl::vector_base<NumericT> const & vec,
               viennacl::vector_base<NumericT>       & result)
{
  assert(mat.size1() == result.size() && bool("Dimension mismatch"));
  assert(mat.size2() == vec.size() && bool("Dimension mismatch"));
  //result.clear();

  //Rcpp::Rcout << "prod(circulant_matrix" << ALIGNMENT << ", vector) called with internal_nnz=" << mat.internal_nnz() << std::endl;

  viennacl::vector<NumericT> circ(mat.elements().size() * 2);
  viennacl::linalg::real_to_complex(mat.elements(), circ, mat.elements().size());

  viennacl::vector<NumericT> tmp(vec.size() * 2);
  viennacl::vector<NumericT> tmp2(vec.size() * 2);

  viennacl::linalg::real_to_complex(vec, tmp, vec.size());
  viennacl::linalg::convolve(circ, tmp, tmp2);
  viennacl::linalg::complex_to_real(tmp2, result, vec.size());

}
Esempio n. 2
0
 static size_t size(const viennacl::circulant_matrix<ScalarType, Amat> & lhs,
                    const viennacl::vector<ScalarType, A> & rhs) { return lhs.size1(); }