1 #ifndef VIENNACL_FORWARDS_H
2 #define VIENNACL_FORWARDS_H
52 #ifdef VIENNACL_HAVE_UBLAS
53 #define VIENNACL_WITH_UBLAS
56 #ifdef VIENNACL_HAVE_EIGEN
57 #define VIENNACL_WITH_EIGEN
60 #ifdef VIENNACL_HAVE_MTL4
61 #define VIENNACL_WITH_MTL4
125 template<
typename OP>
129 template<
typename OP>
133 template<
typename OP>
229 template<
typename LHS,
typename RHS,
typename OP>
232 template<
typename SCALARTYPE>
235 template<
typename SCALARTYPE>
238 template<
typename LHS,
typename RHS,
typename OP>
241 template<
class SCALARTYPE,
unsigned int ALIGNMENT>
244 template<
class SCALARTYPE,
unsigned int ALIGNMENT>
247 template<
typename SCALARTYPE>
250 template<
typename SCALARTYPE>
253 template<
typename SCALARTYPE>
256 template<
typename SCALARTYPE>
259 template<
typename SCALARTYPE>
262 template<
class SCALARTYPE,
typename SizeType = vcl_
size_t,
typename DistanceType = vcl_ptrdiff_t>
265 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
268 template<
typename ScalarT>
272 template<
typename SCALARTYPE,
unsigned int ALIGNMENT,
typename CPU_ITERATOR>
273 void copy(CPU_ITERATOR
const & cpu_begin,
274 CPU_ITERATOR
const & cpu_end,
277 template<
typename SCALARTYPE,
unsigned int ALIGNMENT_SRC,
unsigned int ALIGNMENT_DEST>
282 template<
typename SCALARTYPE,
unsigned int ALIGNMENT_SRC,
unsigned int ALIGNMENT_DEST>
287 template<
typename SCALARTYPE,
unsigned int ALIGNMENT,
typename CPU_ITERATOR>
290 CPU_ITERATOR cpu_begin );
292 template<
typename CPU_ITERATOR,
typename SCALARTYPE,
unsigned int ALIGNMENT>
293 void fast_copy(CPU_ITERATOR
const & cpu_begin,
294 CPU_ITERATOR
const & cpu_end,
316 return i * num_cols + j;
333 return i + j * num_rows;
337 struct row_iteration;
338 struct col_iteration;
340 template<
typename LHS,
typename RHS,
typename OP>
361 static const vcl_size_t dense_padding_size = 128;
368 template<
typename ROWCOL,
typename MATRIXTYPE>
371 template<
class SCALARTYPE,
typename SizeType = vcl_
size_t,
typename DistanceType = vcl_ptrdiff_t>
374 template<
class SCALARTYPE,
typename F = row_major,
unsigned int ALIGNMENT = 1>
377 template<
typename SCALARTYPE>
380 template<
class SCALARTYPE>
383 template<
class SCALARTYPE>
386 template<
class SCALARTYPE>
389 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
392 template<
class SCALARTYPE>
396 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 128>
399 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
402 template<
typename ScalarT,
typename IndexT =
unsigned int>
405 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
408 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
411 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
414 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
417 template<
class SCALARTYPE,
unsigned int ALIGNMENT = 1>
423 template<
typename SizeType = vcl_
size_t,
typename DistanceType = std::ptrdiff_t>
428 template<
typename SizeType = vcl_
size_t,
typename DistanceType = std::ptrdiff_t>
433 template<
typename VectorType>
436 template<
typename VectorType>
439 template<
typename MatrixType>
442 template<
typename MatrixType>
576 memory_exception(std::string message) : message_(
"ViennaCL: Internal memory error: " + message) {}
578 virtual const char*
what()
const throw() {
return message_.c_str(); }
582 std::string message_;
590 virtual const char*
what()
const throw() {
return message_.c_str(); }
594 std::string message_;
616 template<
typename ROWCOL,
typename MATRIXTYPE>
619 typedef typename MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING
ErrorIndicator;
621 static void apply(
const MATRIXTYPE & ,
unsigned int & ,
unsigned int & ) {}
627 #if !defined(_MSC_VER) || defined(__CUDACC__)
629 template<
class SCALARTYPE,
unsigned int ALIGNMENT>
649 template<
typename LHS,
typename RHS,
typename OP,
typename T>
654 template<
typename T,
typename LHS,
typename RHS,
typename OP>
659 template<
typename LHS1,
typename RHS1,
typename OP1,
660 typename LHS2,
typename RHS2,
typename OP2,
typename T>
672 template<
typename LHS,
typename RHS,
typename OP,
typename T>
677 template<
typename T,
typename LHS,
typename RHS,
typename OP>
682 template<
typename LHS1,
typename RHS1,
typename OP1,
683 typename LHS2,
typename RHS2,
typename OP2,
typename S3>
694 template<
typename LHS,
typename RHS,
typename OP,
typename T>
703 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
711 template<
typename LHS,
typename RHS,
typename OP,
typename T>
718 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
727 template<
typename LHS,
typename RHS,
typename OP,
typename T>
735 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
743 template<
typename LHS,
typename RHS,
typename OP,
typename T>
751 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
759 template<
typename LHS,
typename RHS,
typename OP,
typename T>
767 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
775 template<
typename LHS,
typename RHS,
typename OP,
typename T>
783 template<
typename LHS,
typename RHS,
typename OP,
typename S2>
799 template<
typename LHS,
typename RHS,
typename OP>
804 template<
typename NumericT>
809 template<
typename NumericT>
814 template<
typename SparseMatrixType,
class SCALARTYPE,
unsigned int ALIGNMENT>
825 template<
typename NumericT>
829 template<
typename NumericT>
851 static const char *
name() {
return "lower"; }
856 static const char *
name() {
return "upper"; }
861 static const char *
name() {
return "unit_lower"; }
866 static const char *
name() {
return "unit_upper"; }
876 template<
typename VectorType>
923 namespace FFT_DATA_ORDER {}
929 namespace device_specific
932 namespace autotune {}
938 namespace profiles {}
1006 namespace result_of {}
1025 namespace result_of {}
void norm_frobenius_cpu(matrix_base< T > const &vec, T &result)
Computes the Frobenius norm of a vector with final reduction on the CPU.
Sparse matrix class using a hybrid format composed of the ELL and CSR format for storing the nonzeros...
void row_sum_impl(const matrix_base< NumericT > &A, vector_base< NumericT > &result)
Simple enable-if variant that uses the SFINAE pattern.
void inner_prod_cpu(viennacl::vector_expression< LHS1, RHS1, OP1 > const &vec1, viennacl::vector_expression< LHS2, RHS2, OP2 > const &vec2, S3 &result)
A tag class representing multiplication by a scalar.
viennacl::vector_expression< const vector_base< T >, const vector_base< T >, op_element_binary< op_div > > element_div(vector_base< T > const &v1, vector_base< T > const &v2)
A tag class representing the cosh() function.
A tag class representing the summation of all columns of a matrix.
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated...
A tag class representing equality.
static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t, vcl_size_t num_cols)
Returns the memory offset for entry (i,j) of a dense matrix.
A tag class representing the tan() function.
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
static const char * name()
static const char * name()
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
A tag class representing the summation of a vector.
Checks for either matrix_base or implicit_matrix_base.
Exception class in case of memory errors.
Helper class for checking whether a matrix is a compressed_matrix (CSR format)
A tag class representing less-than.
Helper class for checking whether a matrix is a hyb_matrix (hybrid format: ELL plus CSR) ...
A tag class representing the summation of all rows of a matrix.
Class for representing strided submatrices of a bigger matrix A.
Helper class for checking whether the provided type is one of the sparse matrix types (compressed_mat...
Helper class for checking whether a matrix has a row-major layout.
Helper struct for checking whether a type represents a sign flip on a viennacl::scalar<> ...
A tag class representing the extraction of a matrix column to a vector.
A tag class representing a matrix given by a vector placed on a certain (off-)diagonal.
A tag class representing a lower triangular matrix.
A tag class representing subtraction.
cuda_not_available_exception()
A tag class representing assignment.
Helper class for checking whether a matrix is a Toeplitz matrix.
A tag class representing the modulus function for integers.
Expression template class for representing a tree of expressions which ultimately result in a matrix...
A tag class representing the ceil() function.
void inner_prod_impl(viennacl::vector_expression< LHS1, RHS1, OP1 > const &vec1, viennacl::vector_expression< LHS2, RHS2, OP2 > const &vec2, scalar< T > &result)
void max_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
A tag class representing division.
Represents a vector consisting of 1 at a given index and zeros otherwise. To be used as an initialize...
void norm_1_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
A proxy for scalar expressions (e.g. from inner vector products)
An expression template class that represents a binary operation that yields a vector.
A tag class representing the log() function.
memory_exception(std::string message)
zero_on_diagonal_exception(std::string const &what_arg)
A tag class representing inplace addition.
A tag class representing the tanh() function.
A tag class representing the fabs() function.
A tag class representing the maximum of a vector.
A tag class representing the atan2() function.
A Vandermonde matrix class.
A tag class representing the (off-)diagonal of a matrix.
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
A tag class representing the atan() function.
Helper class for checking whether a matrix is a sliced_ell_matrix (SELL-C- format) ...
A tag class representing the sinh() function.
void norm_frobenius_impl(matrix_base< T > const &vec, scalar< T > &result)
Computes the Frobenius norm of a matrix - dispatcher interface.
viennacl::vector< float > v1
Checks for a type being either vector_base or implicit_vector_base.
column_major_tag orientation_category
Base class for representing matrices where the individual entries are not all stored explicitly...
Helper struct for checking whether a type is a host scalar type (e.g. float, double) ...
A tag class representing the fmax() function.
Class for representing non-strided subvectors of a bigger vector x.
Helper class for checking whether a matrix is a circulant matrix.
Sparse matrix class using the ELLPACK format for storing the nonzeros.
A tag class representing the use of no preconditioner.
A tag class representing the fmod() function.
A tag class representing the exp() function.
A tag class representing greater-than-or-equal-to.
A tag class representing an upper triangular matrix.
void min_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the supremum norm of a vector with final reduction on the CPU - interface for a vector expre...
Tuple class holding pointers to multiple vectors. Mainly used as a temporary object returned from vie...
virtual const char * what() const
Helper struct for checking whether the provided type represents a scalar (either host, from ViennaCL, or a flip-sign proxy)
void sum_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
Sparse matrix class using the sliced ELLPACK with parameters C, .
A tag class representing inequality.
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
void sum_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the sum of a vector with final reduction on the CPU - interface for a vector expression...
A tag class representing less-than-or-equal-to.
A sparse square matrix in compressed sparse rows format optimized for the case that only a few rows c...
Class for representing strided subvectors of a bigger vector x.
A tag class representing addition.
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
Common base class for dense vectors, vector ranges, and vector slices.
viennacl::enable_if< viennacl::is_any_sparse_matrix< SparseMatrixType >::value, vector_expression< const SparseMatrixType, const vector< SCALARTYPE, ALIGNMENT >, op_prod > >::type prod_impl(const SparseMatrixType &mat, const vector< SCALARTYPE, ALIGNMENT > &vec)
A tag class representing the sqrt() function.
void min_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
Tag class for indicating column-major layout of a matrix. Not passed to the matrix directly...
A tag class representing matrix-matrix products.
vcl_size_t index_norm_inf(viennacl::vector_expression< LHS, RHS, OP > const &vec)
Computes the supremum norm of a vector with final reduction on the CPU - interface for a vector expre...
static const char * name()
Represents a vector consisting of zeros only. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only.
A tag class representing the minimum of a vector.
void norm_2_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the l^2-norm of a vector with final reduction on the CPU - interface for a vector expression...
void convolve_i(viennacl::vector< SCALARTYPE, ALIGNMENT > &input1, viennacl::vector< SCALARTYPE, ALIGNMENT > &input2, viennacl::vector< SCALARTYPE, ALIGNMENT > &output)
void apply(VectorType &) const
A tag class representing the sin() function.
void norm_2_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
Computes the l^2-norm of a vector - interface for a vector expression. Creates a temporary.
Helper class for checking whether a matrix is a Hankel matrix.
A tag class representing the fmin() function.
A tag class representing inplace subtraction.
Helper class for checking whether the provided type is any of the dense structured matrix types (circ...
A tag class representing the 1-norm of a vector.
A tag class representing matrix-vector products and element-wise multiplications. ...
Helper struct for checking whether a type is a viennacl::scalar<>
void norm_1_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the l^1-norm of a vector with final reduction on the CPU - interface for a vector expression...
Tag class for indicating row-major layout of a matrix. Not passed to the matrix directly, see row_major type.
Represents a vector consisting of 1 at a given index and zeros otherwise.
viennacl::vector< int > v2
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
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) ...
A tag class representing the floor() function.
A tag class representing the asin() function.
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
virtual const char * what() const
A tag class representing a lower triangular matrix with unit diagonal.
viennacl::vector_expression< const vector_base< T >, const vector_base< T >, op_element_binary< op_prod > > element_prod(vector_base< T > const &v1, vector_base< T > const &v2)
A tag class for representing the argmax() function.
A tag class representing transposed matrices.
A sparse square matrix in compressed sparse rows format.
A tag class representing the Frobenius-norm of a matrix.
A tag for column-major storage of a dense matrix.
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
A Circulant matrix class.
Class for representing non-strided submatrices of a bigger matrix A.
Helper class for checking whether a matrix is a coordinate_matrix (COO format)
static const char * name()
static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t num_rows, vcl_size_t)
Returns the memory offset for entry (i,j) of a dense matrix.
void norm_inf_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the supremum norm of a vector with final reduction on the CPU - interface for a vector expre...
Common base class for representing vectors where the entries are not all stored explicitly.
A tag class representing sign flips (for scalars only. Vectors and matrices use the standard multipli...
Helper class for checking whether a matrix is a Vandermonde matrix.
A tag class representing the acos() function.
A tag class representing the fdim() function.
A tag class representing inner products of two vectors.
A tag class representing the extraction of a matrix row to a vector.
A tag class representing the power function.
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
A tag class representing the inf-norm of a vector.
A tag class representing the log10() function.
A tag class representing element-wise unary operations (like sin()) on vectors or matrices...
void norm_inf_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
Computes the supremum norm of a vector - interface for a vector expression. Creates a temporary...
virtual ~cuda_not_available_exception()
A tag class representing the 2-norm of a vector.
Provides version information for detecting different versions of ViennaCL.
void max_cpu(viennacl::vector_expression< LHS, RHS, OP > const &vec, S2 &result)
Computes the supremum norm of a vector with final reduction on the CPU - interface for a vector expre...
A tag for row-major storage of a dense matrix.
A tag class for representing the argmin() function.
Helper class for checking whether a matrix is an ell_matrix (ELL format)
A tag class representing greater-than.
A tag class representing the cos() function.
row_major_tag orientation_category
Simple enable-if variant that uses the SFINAE pattern.
A tag class representing an upper triangular matrix with unit diagonal.
std::ptrdiff_t vcl_ptrdiff_t
unknown_norm_exception(std::string const &what_arg)
A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row an...
void column_sum_impl(const matrix_base< NumericT > &A, vector_base< NumericT > &result)
ScalarType fft(std::vector< ScalarType > &in, std::vector< ScalarType > &out, unsigned int, unsigned int, unsigned int batch_size)
virtual ~memory_exception()
A tag class representing element-wise casting operations on vectors and matrices. ...
void fast_copy(const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)