All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
toeplitz_matrix_operations.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_TOEPLITZ_MATRIX_OPERATIONS_HPP_
#define VIENNACL_LINALG_TOEPLITZ_MATRIX_OPERATIONS_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include "viennacl/forwards.h"
#include "viennacl/ocl/backend.hpp"
#include "viennacl/scalar.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/fft.hpp"
namespace viennacl
{
namespace linalg
{
// A * x
template<class SCALARTYPE, unsigned int ALIGNMENT>
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());
}
} //namespace linalg
} //namespace viennacl
#endif
tools.hpp
Various little tools used here and there in ViennaCL.
viennacl::linalg::real_to_complex
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...
Definition: fft_operations.hpp:390
viennacl::linalg::complex_to_real
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...
Definition: fft_operations.hpp:421
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::toeplitz_matrix::size2
vcl_size_t size2() const
Returns the number of columns of the matrix.
Definition: toeplitz_matrix.hpp:100
viennacl::toeplitz_matrix::size1
vcl_size_t size1() const
Returns the number of rows of the matrix.
Definition: toeplitz_matrix.hpp:95
viennacl::vector_base::begin
iterator begin()
Returns an iterator pointing to the beginning of the vector (STL like)
Definition: vector.hpp:841
viennacl::vector_base
Common base class for dense vectors, vector ranges, and vector slices.
Definition: vector_def.hpp:104
viennacl::vector
Definition: forwards.h:266
backend.hpp
Implementations of the OpenCL backend, where all contexts are stored in.
viennacl::vector_base::clear
void clear()
Resets all entries to zero. Does not change the size of the vector.
Definition: vector.hpp:875
vector.hpp
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
viennacl::copy
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) ...
Definition: circulant_matrix.hpp:150
viennacl::vector_base::size
size_type size() const
Returns the length of the vector (cf. std::vector)
Definition: vector_def.hpp:118
fft.hpp
All routines related to the Fast Fourier Transform. Experimental.
viennacl::toeplitz_matrix
A Toeplitz matrix class.
Definition: forwards.h:415
convolve
ScalarType convolve(std::vector< ScalarType > &in1, std::vector< ScalarType > &in2, unsigned int, unsigned int, unsigned int)
Definition: fft_1d.cpp:944
viennacl::linalg::prod_impl
void prod_impl(const matrix_base< NumericT > &mat, const vector_base< NumericT > &vec, vector_base< NumericT > &result)
Carries out matrix-vector multiplication.
Definition: matrix_operations.hpp:438
viennacl::vector_base::end
iterator end()
Returns an iterator pointing to the end of the vector (STL like)
Definition: vector.hpp:848
viennacl::toeplitz_matrix::elements
viennacl::vector< NumericT, AlignmentV > & elements()
Returns an internal viennacl::vector, which represents a Toeplitz matrix elements.
Definition: toeplitz_matrix.hpp:88
scalar.hpp
Implementation of the ViennaCL scalar class.
viennacl::vcl_ptrdiff_t
std::ptrdiff_t vcl_ptrdiff_t
Definition: forwards.h:76