void prod_impl(const viennacl::toeplitz_matrix<SCALARTYPE, ALIGNMENT> & mat,
                   const viennacl::vector_base<SCALARTYPE> & vec,
                         viennacl::vector_base<SCALARTYPE> & result)
    {
      assert(mat.size1() == result.size());
      assert(mat.size2() == vec.size());

      viennacl::vector<SCALARTYPE> tmp(vec.size() * 4); tmp.clear();
      viennacl::vector<SCALARTYPE> tmp2(vec.size() * 4);

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



      viennacl::copy(vec.begin(), vec.end(), tmp.begin());
      viennacl::linalg::real_to_complex(tmp, tmp2, vec.size() * 2);
      viennacl::linalg::convolve(tep, tmp2, tmp);
      viennacl::linalg::complex_to_real(tmp, tmp2, vec.size() * 2);
      viennacl::copy(tmp2.begin(), tmp2.begin() + static_cast<vcl_ptrdiff_t>(vec.size()), result.begin());
    }
예제 #2
0
void prod_impl(const viennacl::toeplitz_matrix<SCALARTYPE, ALIGNMENT> & mat,
               const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> & vec,
               viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> & result)
{
    assert(mat.size1() == result.size());
    assert(mat.size2() == vec.size());

    viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> tmp(vec.size() * 4);
    tmp.clear();
    viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> tmp2(vec.size() * 4);

    viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> tep(mat.elements().size() * 2);
    viennacl::detail::fft::real_to_complex(mat.elements(), tep, mat.elements().size());



    copy(vec, tmp);
    viennacl::detail::fft::real_to_complex(tmp, tmp2, vec.size() * 2);
    viennacl::linalg::convolve(tep, tmp2, tmp);
    viennacl::detail::fft::complex_to_real(tmp, tmp2, vec.size() * 2);
    copy(tmp2.begin(), tmp2.begin() + vec.size(), result.begin());
}