1 #ifndef VIENNACL_HANKEL_MATRIX_HPP 
    2 #define VIENNACL_HANKEL_MATRIX_HPP 
   42 template<
class NumericT, 
unsigned int AlignmentV>
 
   63     assert(rows == cols && 
bool(
"Hankel matrix must be square!"));
 
   75     elements_.
resize(sz, preserve);
 
  117     assert(row_index < 
size1() && col_index < 
size2() && 
bool(
"Invalid access"));
 
  119     return elements_(
size1() - row_index - 1, col_index);
 
  130     elements_ += that.elements();
 
  138   toeplitz_matrix<NumericT, AlignmentV> elements_;
 
  147 template<
typename NumericT, 
unsigned int AlignmentV>
 
  150   assert((gpu_mat.size1() * 2 - 1)  == cpu_vec.size() && bool(
"Size mismatch"));
 
  152   copy(cpu_vec, gpu_mat.elements());
 
  161 template<
typename NumericT, 
unsigned int AlignmentV>
 
  164   assert((gpu_mat.size1() * 2 - 1)  == cpu_vec.size() && bool(
"Size mismatch"));
 
  166   copy(gpu_mat.elements(), cpu_vec);
 
  175 template<
typename NumericT, 
unsigned int AlignmentV, 
typename MatrixT>
 
  182   std::vector<NumericT> tmp(size * 2 - 1);
 
  187       com_dst(i, j) = tmp[i + j];
 
  196 template<
typename NumericT, 
unsigned int AlignmentV, 
typename MatrixT>
 
  199   assert( (han_dst.size1() == 0 || 
viennacl::traits::size1(com_src) == han_dst.size1()) && 
bool(
"Size mismatch") );
 
  200   assert( (han_dst.size2() == 0 || 
viennacl::traits::size2(com_src) == han_dst.size2()) && 
bool(
"Size mismatch") );
 
  205   std::vector<NumericT> tmp(2*size - 1);
 
  208     tmp[i] = com_src(0, i);
 
  211     tmp[size + i - 1] = com_src(size - 1, i);
 
  225 template<
class NumericT, 
unsigned int AlignmentV>
 
  226 std::ostream & operator<<(std::ostream & s, hankel_matrix<NumericT, AlignmentV>& gpu_matrix)
 
  229   std::vector<NumericT> tmp(2*size - 1);
 
  230   copy(gpu_matrix, tmp);
 
  231   s << 
"[" << size << 
"," << size << 
"](";
 
  240       if (j < (size - 1)) s << 
",";
 
  259   template<
typename T, 
unsigned int A>
 
  260   struct op_executor<vector_base<T>, 
op_assign, vector_expression<const hankel_matrix<T, A>, const vector_base<T>, op_prod> >
 
  262     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, 
const vector_base<T>, op_prod> 
const & rhs)
 
  276   template<
typename T, 
unsigned int A>
 
  277   struct op_executor<vector_base<T>, op_inplace_add, vector_expression<const hankel_matrix<T, A>, const vector_base<T>, op_prod> >
 
  279     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, 
const vector_base<T>, op_prod> 
const & rhs)
 
  287   template<
typename T, 
unsigned int A>
 
  288   struct op_executor<vector_base<T>, op_inplace_sub, vector_expression<const hankel_matrix<T, A>, const vector_base<T>, op_prod> >
 
  290     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, 
const vector_base<T>, op_prod> 
const & rhs)
 
  300   template<
typename T, 
unsigned int A, 
typename LHS, 
typename RHS, 
typename OP>
 
  301   struct op_executor<vector_base<T>, 
op_assign, vector_expression<const hankel_matrix<T, A>, const vector_expression<const LHS, const RHS, OP>, op_prod> >
 
  303     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, 
const vector_expression<const LHS, const RHS, OP>, op_prod> 
const & rhs)
 
  311   template<
typename T, 
unsigned int A, 
typename LHS, 
typename RHS, 
typename OP>
 
  312   struct op_executor<vector_base<T>, op_inplace_add, vector_expression<const hankel_matrix<T, A>, vector_expression<const LHS, const RHS, OP>, op_prod> >
 
  314     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, vector_expression<const LHS, const RHS, OP>, op_prod> 
const & rhs)
 
  324   template<
typename T, 
unsigned int A, 
typename LHS, 
typename RHS, 
typename OP>
 
  325   struct op_executor<vector_base<T>, op_inplace_sub, vector_expression<const hankel_matrix<T, A>, const vector_expression<const LHS, const RHS, OP>, op_prod> >
 
  327     static void apply(vector_base<T> & lhs, vector_expression<
const hankel_matrix<T, A>, 
const vector_expression<const LHS, const RHS, OP>, op_prod> 
const & rhs)
 
  343 #endif // VIENNACL_HANKEL_MATRIX_HPP 
Implementations of operations using hankel_matrix. Experimental. 
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
hankel_matrix< NumericT, AlignmentV > & operator+=(hankel_matrix< NumericT, AlignmentV > &that)
+= operation for Hankel matrices 
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.) 
This file provides the forward declarations for the main types used within ViennaCL. 
vcl_size_t size2() const 
Returns the number of columns of the matrix. 
vcl_size_t internal_size() const 
Returns the internal size of matrix representtion. Usually required for launching OpenCL kernels only...
result_of::size_type< MatrixType >::type size2(MatrixType const &mat)
Generic routine for obtaining the number of columns of a matrix (ViennaCL, uBLAS, etc...
vcl_size_t internal_size() const 
Returns the internal size of matrix representtion. Usually required for launching OpenCL kernels only...
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.) 
vcl_size_t size1() const 
Returns the number of rows of the matrix. 
vcl_size_t size2() const 
Returns the number of columns of the matrix. 
hankel_matrix(vcl_size_t rows, vcl_size_t cols)
Creates the matrix with the given size. 
handle_type const & handle() const 
Returns the OpenCL handle. 
handle_type const & handle() const 
Returns the OpenCL handle. 
Implementations of the OpenCL backend, where all contexts are stored in. 
entry_proxy< NumericT > operator()(unsigned int row_index, unsigned int col_index)
Read-write access to a element of the matrix. 
vcl_size_t size1() const 
Returns the number of rows of the matrix. 
hankel_matrix()
The default constructor. Does not allocate any memory. 
scalar< typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT< NumericT >::ResultType > value_type
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
toeplitz_matrix< NumericT, AlignmentV > & elements()
Returns an internal viennacl::toeplitz_matrix, which represents a Hankel matrix elements. 
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
All routines related to the Fast Fourier Transform. Experimental. 
Main abstraction class for multiple memory domains. Represents a buffer in either main RAM...
void prod_impl(const matrix_base< NumericT > &mat, const vector_base< NumericT > &vec, vector_base< NumericT > &result)
Carries out matrix-vector multiplication. 
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version. 
void resize(vcl_size_t sz, bool preserve=true)
Resizes the matrix. Existing entries can be preserved. 
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
void resize(vcl_size_t sz, bool preserve=true)
Resizes the matrix. Existing entries can be preserved. 
Implementation of the toeplitz_matrix class for efficient manipulation of Toeplitz matrices...
toeplitz_matrix< NumericT, AlignmentV > const & elements() const 
viennacl::backend::mem_handle handle_type