ViennaCL - The Vienna Computing Library  1.7.1
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
toeplitz_matrix_operations.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_TOEPLITZ_MATRIX_OPERATIONS_HPP_
2 #define VIENNACL_LINALG_TOEPLITZ_MATRIX_OPERATIONS_HPP_
3 
4 /* =========================================================================
5  Copyright (c) 2010-2016, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
25 #include "viennacl/forwards.h"
26 #include "viennacl/ocl/backend.hpp"
27 #include "viennacl/scalar.hpp"
28 #include "viennacl/vector.hpp"
29 #include "viennacl/tools/tools.hpp"
30 #include "viennacl/fft.hpp"
31 
32 namespace viennacl
33 {
34  namespace linalg
35  {
36 
37 
38  // A * x
39 
48  template<class SCALARTYPE, unsigned int ALIGNMENT>
52  {
53  assert(mat.size1() == result.size());
54  assert(mat.size2() == vec.size());
55 
56  viennacl::vector<SCALARTYPE> tmp(vec.size() * 4); tmp.clear();
57  viennacl::vector<SCALARTYPE> tmp2(vec.size() * 4);
58 
61 
62 
63 
64  viennacl::copy(vec.begin(), vec.end(), tmp.begin());
65  viennacl::linalg::real_to_complex(tmp, tmp2, vec.size() * 2);
66  viennacl::linalg::convolve(tep, tmp2, tmp);
67  viennacl::linalg::complex_to_real(tmp, tmp2, vec.size() * 2);
68  viennacl::copy(tmp2.begin(), tmp2.begin() + static_cast<vcl_ptrdiff_t>(vec.size()), result.begin());
69  }
70 
71  } //namespace linalg
72 
73 
74 
75 } //namespace viennacl
76 
77 
78 #endif
Various little tools used here and there in ViennaCL.
void real_to_complex(viennacl::vector_base< NumericT > const &in, viennacl::vector_base< NumericT > &out, vcl_size_t size)
Create complex vector from real vector (even elements(2*k) = real part, odd elements(2*k+1) = imagina...
void complex_to_real(viennacl::vector_base< NumericT > const &in, viennacl::vector_base< NumericT > &out, vcl_size_t size)
Create real vector from complex vector (even elements(2*k) = real part, odd elements(2*k+1) = imagina...
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 size1() const
Returns the number of rows of the matrix.
iterator begin()
Returns an iterator pointing to the beginning of the vector (STL like)
Definition: vector.hpp:841
Common base class for dense vectors, vector ranges, and vector slices.
Definition: vector_def.hpp:104
Implementations of the OpenCL backend, where all contexts are stored in.
void clear()
Resets all entries to zero. Does not change the size of the vector.
Definition: vector.hpp:875
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
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) ...
size_type size() const
Returns the length of the vector (cf. std::vector)
Definition: vector_def.hpp:118
All routines related to the Fast Fourier Transform. Experimental.
A Toeplitz matrix class.
Definition: forwards.h:415
ScalarType convolve(std::vector< ScalarType > &in1, std::vector< ScalarType > &in2, unsigned int, unsigned int, unsigned int)
Definition: fft_1d.cpp:944
void prod_impl(const matrix_base< NumericT > &mat, const vector_base< NumericT > &vec, vector_base< NumericT > &result)
Carries out matrix-vector multiplication.
iterator end()
Returns an iterator pointing to the end of the vector (STL like)
Definition: vector.hpp:848
viennacl::vector< NumericT, AlignmentV > & elements()
Returns an internal viennacl::vector, which represents a Toeplitz matrix elements.
Implementation of the ViennaCL scalar class.
std::ptrdiff_t vcl_ptrdiff_t
Definition: forwards.h:76