ViennaCL - The Vienna Computing Library  1.5.1
forwards.h
Go to the documentation of this file.
1 #ifndef VIENNACL_FORWARDS_H
2 #define VIENNACL_FORWARDS_H
3 
4 /* =========================================================================
5  Copyright (c) 2010-2014, 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 PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
21 
36 //compatibility defines:
37 #ifdef VIENNACL_HAVE_UBLAS
38  #define VIENNACL_WITH_UBLAS
39 #endif
40 
41 #ifdef VIENNACL_HAVE_EIGEN
42  #define VIENNACL_WITH_EIGEN
43 #endif
44 
45 #ifdef VIENNACL_HAVE_MTL4
46  #define VIENNACL_WITH_MTL4
47 #endif
48 
49 #include <cstddef>
50 #include <cassert>
51 #include <string>
52 
54 
56 namespace viennacl
57 {
58  typedef std::size_t vcl_size_t;
59  typedef std::ptrdiff_t vcl_ptrdiff_t;
60 
61 
63  struct op_assign {};
65  struct op_inplace_add {};
67  struct op_inplace_sub {};
68 
70  struct op_add {};
72  struct op_sub {};
74  struct op_mult {};
76  struct op_prod {};
78  struct op_mat_mat_prod {};
80  struct op_div {};
82  struct op_pow {};
83 
85  template <typename OP>
86  struct op_element_binary {};
87 
89  template <typename OP>
90  struct op_element_unary {};
91 
93  struct op_abs {};
95  struct op_acos {};
97  struct op_asin {};
99  struct op_atan {};
101  struct op_atan2 {};
103  struct op_ceil {};
105  struct op_cos {};
107  struct op_cosh {};
109  struct op_exp {};
111  struct op_fabs {};
113  struct op_fdim {};
115  struct op_floor {};
117  struct op_fmax {};
119  struct op_fmin {};
121  struct op_fmod {};
123  struct op_log {};
125  struct op_log10 {};
127  struct op_sin {};
129  struct op_sinh {};
131  struct op_sqrt {};
133  struct op_tan {};
135  struct op_tanh {};
136 
138  struct op_matrix_diag {};
139 
141  struct op_vector_diag {};
142 
144  struct op_row {};
145 
147  struct op_column {};
148 
150  struct op_inner_prod {};
151 
153  struct op_norm_1 {};
154 
156  struct op_norm_2 {};
157 
159  struct op_norm_inf {};
160 
162  struct op_norm_frobenius {};
163 
165  struct op_trans {};
166 
168  struct op_flip_sign {};
169 
170  //forward declaration of basic types:
171  template<class TYPE>
172  class scalar;
173 
174  template <typename LHS, typename RHS, typename OP>
176 
177  template <typename SCALARTYPE>
178  class entry_proxy;
179 
180  template <typename LHS, typename RHS, typename OP>
182 
183  template<class SCALARTYPE, unsigned int ALIGNMENT>
185 
186  template<class SCALARTYPE, unsigned int ALIGNMENT>
188 
189  template<typename SCALARTYPE>
191 
192  template <typename SCALARTYPE>
193  class zero_vector;
194 
195  template <typename SCALARTYPE>
196  class unit_vector;
197 
198  template <typename SCALARTYPE>
199  class one_vector;
200 
201  template <typename SCALARTYPE>
203 
204  template<class SCALARTYPE, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
205  class vector_base;
206 
207  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
208  class vector;
209 
210  template <typename ScalarT>
212 
213  //the following forwards are needed for GMRES
214  template <typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
215  void copy(CPU_ITERATOR const & cpu_begin,
216  CPU_ITERATOR const & cpu_end,
218 
219  template <typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
220  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
223 
224  template <typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
225  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
228 
229  template <typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
232  CPU_ITERATOR cpu_begin );
233 
234  template <typename CPU_ITERATOR, typename SCALARTYPE, unsigned int ALIGNMENT>
235  void fast_copy(CPU_ITERATOR const & cpu_begin,
236  CPU_ITERATOR const & cpu_end,
238 
239 
241  struct row_major_tag {};
243  struct column_major_tag {};
244 
246  struct row_major
247  {
249 
256  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t /* num_rows */, vcl_size_t num_cols)
257  {
258  return i * num_cols + j;
259  }
260  };
261 
264  {
266 
273  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t num_rows, vcl_size_t /* num_cols */)
274  {
275  return i + j * num_rows;
276  }
277  };
278 
279  struct row_iteration;
280  struct col_iteration;
281 
282  template <typename LHS, typename RHS, typename OP>
284 
285  //
286  // Matrix types:
287  //
288 
289  template<class SCALARTYPE, typename F = row_major, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
290  class matrix_base;
291 
292  template <class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
293  class matrix;
294 
295  template<typename SCALARTYPE>
297 
298  template <class SCALARTYPE>
300 
301  template <class SCALARTYPE>
302  class zero_matrix;
303 
304  template <class SCALARTYPE>
306 
307  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
308  class compressed_matrix;
309 
310  template<class SCALARTYPE>
312 
313 
314  template<class SCALARTYPE, unsigned int ALIGNMENT = 128>
315  class coordinate_matrix;
316 
317  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
318  class ell_matrix;
319 
320  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
321  class hyb_matrix;
322 
323  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
324  class circulant_matrix;
325 
326  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
328 
329  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
331 
332  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
334 
335  //
336  // Proxies:
337  //
338  template <typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
339  class basic_range;
340 
341  typedef basic_range<> range;
342 
343  template <typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
344  class basic_slice;
345 
346  typedef basic_slice<> slice;
347 
348  template <typename VectorType>
350 
351  template <typename VectorType>
353 
354  template <typename MatrixType>
356 
357  template <typename MatrixType>
359 
360 
362  template <typename T>
364  {
365  enum { value = false };
366  };
367 
369  template <typename T>
370  struct is_scalar
371  {
372  enum { value = false };
373  };
374 
376  template <typename T>
378  {
379  enum { value = false };
380  };
381 
383  template <typename T>
385  {
387  };
388 
390  template<typename T>
391  struct is_any_vector { enum { value = 0 }; };
392 
394  template<typename T>
395  struct is_any_dense_matrix { enum { value = 0 }; };
396 
398  template <typename T>
400  {
401  enum { value = false };
402  };
403 
405  template <typename T>
407  {
408  enum { value = false };
409  };
410 
412  template <typename T>
414  {
415  enum { value = false };
416  };
417 
419  template <typename T>
421  {
422  enum { value = false };
423  };
424 
426  template <typename T>
428  {
429  enum { value = false };
430  };
431 
433  template <typename T>
435  {
436  enum { value = false };
437  };
438 
439 
441  template <typename T>
443  {
444  enum { value = false };
445  };
446 
448  template <typename T>
450  {
451  enum { value = false };
452  };
453 
455  template <typename T>
457  {
458  enum { value = false };
459  };
460 
462  template <typename T>
464  {
465  enum { value = false };
466  };
467 
469  template <typename T>
471  {
473  };
474 
475 
477  {
482  };
483 
485  class memory_exception : public std::exception
486  {
487  public:
488  memory_exception() : message_() {}
489  memory_exception(std::string message) : message_("ViennaCL: Internal memory error: " + message) {}
490 
491  virtual const char* what() const throw() { return message_.c_str(); }
492 
493  virtual ~memory_exception() throw() {}
494  private:
495  std::string message_;
496  };
497 
498  class cuda_not_available_exception : public std::exception
499  {
500  public:
501  cuda_not_available_exception() : message_("ViennaCL was compiled without CUDA support, but CUDA functionality required for this operation.") {}
502 
503  virtual const char* what() const throw() { return message_.c_str(); }
504 
505  virtual ~cuda_not_available_exception() throw() {}
506  private:
507  std::string message_;
508  };
509 
510 
511  class context;
512 
513  namespace tools
514  {
515  //helper for matrix row/col iterators
516  //must be specialized for every viennacl matrix type
518  template <typename ROWCOL, typename MATRIXTYPE>
520  {
521  typedef typename MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator;
522 
523  static void apply(const MATRIXTYPE & /*mat*/, unsigned int & /*row*/, unsigned int & /*col*/) {}
524  };
525  }
526 
527  namespace linalg
528  {
529 #if !defined(_MSC_VER) || defined(__CUDACC__)
530 
531  template<class SCALARTYPE, unsigned int ALIGNMENT>
535 
536  template <typename T>
538  element_prod(vector_base<T> const & v1, vector_base<T> const & v2);
539 
540  template <typename T>
542  element_div(vector_base<T> const & v1, vector_base<T> const & v2);
543 
544 
545 
546  template <typename T>
547  void inner_prod_impl(vector_base<T> const & vec1,
548  vector_base<T> const & vec2,
549  scalar<T> & result);
550 
551  template <typename LHS, typename RHS, typename OP, typename T>
553  vector_base<T> const & vec2,
554  scalar<T> & result);
555 
556  template <typename T, typename LHS, typename RHS, typename OP>
557  void inner_prod_impl(vector_base<T> const & vec1,
559  scalar<T> & result);
560 
561  template <typename LHS1, typename RHS1, typename OP1,
562  typename LHS2, typename RHS2, typename OP2, typename T>
565  scalar<T> & result);
566 
568 
569  template <typename T>
570  void inner_prod_cpu(vector_base<T> const & vec1,
571  vector_base<T> const & vec2,
572  T & result);
573 
574  template <typename LHS, typename RHS, typename OP, typename T>
576  vector_base<T> const & vec2,
577  T & result);
578 
579  template <typename T, typename LHS, typename RHS, typename OP>
580  void inner_prod_cpu(vector_base<T> const & vec1,
582  T & result);
583 
584  template <typename LHS1, typename RHS1, typename OP1,
585  typename LHS2, typename RHS2, typename OP2, typename S3>
588  S3 & result);
589 
590 
591 
592  //forward definition of norm_1_impl function
593  template <typename T>
594  void norm_1_impl(vector_base<T> const & vec, scalar<T> & result);
595 
596  //template <typename T, typename F>
597  //void norm_1_impl(matrix_base<T, F> const & A, scalar<T> & result);
598 
599  template <typename LHS, typename RHS, typename OP, typename T>
601  scalar<T> & result);
602 
603 
604  template <typename T>
605  void norm_1_cpu(vector_base<T> const & vec,
606  T & result);
607 
608  //template <typename T, typename F>
609  //void norm_1_cpu(matrix_base<T, F> const & vec,
610  // T & result);
611 
612  template <typename LHS, typename RHS, typename OP, typename S2>
614  S2 & result);
615 
616  //forward definition of norm_2_impl function
617  template <typename T>
618  void norm_2_impl(vector_base<T> const & vec, scalar<T> & result);
619 
620  template <typename LHS, typename RHS, typename OP, typename T>
622  scalar<T> & result);
623 
624  template <typename T>
625  void norm_2_cpu(vector_base<T> const & vec, T & result);
626 
627  template <typename LHS, typename RHS, typename OP, typename S2>
629  S2 & result);
630 
631 
632  //forward definition of norm_inf_impl function
633  template <typename T>
634  void norm_inf_impl(vector_base<T> const & vec, scalar<T> & result);
635 
636  //template <typename T, typename F>
637  //void norm_inf_impl(matrix_base<T, F> const & vec, scalar<T> & result);
638 
639  template <typename LHS, typename RHS, typename OP, typename T>
641  scalar<T> & result);
642 
643 
644  template <typename T>
645  void norm_inf_cpu(vector_base<T> const & vec, T & result);
646 
647  //template <typename T, typename F>
648  //void norm_inf_cpu(matrix_base<T, F> const & vec, T & result);
649 
650  template <typename LHS, typename RHS, typename OP, typename S2>
652  S2 & result);
653 
654  template <typename T, typename F>
655  void norm_frobenius_impl(matrix_base<T, F> const & vec, scalar<T> & result);
656 
657  template <typename T, typename F>
658  void norm_frobenius_cpu(matrix_base<T, F> const & vec, T & result);
659 
660 
661  template <typename T>
663 
664  template <typename LHS, typename RHS, typename OP>
666 
667  //forward definition of prod_impl functions
668 
669  template <typename NumericT, typename F>
670  void prod_impl(const matrix_base<NumericT, F> & mat,
671  const vector_base<NumericT> & vec,
672  vector_base<NumericT> & result);
673 
674  template <typename NumericT, typename F>
676  const vector_base<NumericT> & vec,
677  vector_base<NumericT> & result);
678 
679  template<typename SparseMatrixType, class SCALARTYPE, unsigned int ALIGNMENT>
681  vector_expression<const SparseMatrixType,
683  op_prod >
684  >::type
685  prod_impl(const SparseMatrixType & mat,
686  const vector<SCALARTYPE, ALIGNMENT> & vec);
687 #endif
688 
689  namespace detail
690  {
692  {
697  };
698 
699  }
700 
701 
703  struct lower_tag
704  {
705  static const char * name() { return "lower"; }
706  }; //lower triangular matrix
708  struct upper_tag
709  {
710  static const char * name() { return "upper"; }
711  }; //upper triangular matrix
714  {
715  static const char * name() { return "unit_lower"; }
716  }; //unit lower triangular matrix
719  {
720  static const char * name() { return "unit_upper"; }
721  }; //unit upper triangular matrix
722 
723  //preconditioner tags
724  class ilut_tag;
725 
728  {
729  public:
730  template <typename VectorType>
731  void apply(VectorType &) const {}
732  };
733 
734 
735  } //namespace linalg
736 
737  //
738  // More namespace comments to follow:
739  //
740 
742  namespace backend
743  {
745  namespace cpu_ram
746  {
748  namespace detail {}
749  }
750 
752  namespace cuda
753  {
755  namespace detail {}
756  }
757 
759  namespace detail {}
760 
762  namespace opencl
763  {
765  namespace detail {}
766  }
767  }
768 
769 
771  namespace detail
772  {
774  namespace fft
775  {
777  namespace FFT_DATA_ORDER {}
778  }
779  }
780 
781 
783  namespace generator
784  {
786  namespace autotune {}
787 
789  namespace detail {}
790 
792  namespace profiles {}
793 
795  namespace utils {}
796  }
797 
799  namespace io
800  {
802  namespace detail {}
803 
805  namespace tag {}
806 
808  namespace val {}
809  }
810 
812  namespace linalg
813  {
815  namespace cuda
816  {
818  namespace detail {}
819  }
820 
822  namespace detail
823  {
825  namespace amg {}
826 
828  namespace spai {}
829  }
830 
832  namespace host_based
833  {
835  namespace detail {}
836  }
837 
839  namespace kernels {}
840 
842  namespace opencl
843  {
845  namespace detail {}
846 
848  namespace kernels
849  {
851  namespace detail {}
852  }
853  }
854  }
855 
857  namespace ocl {}
858 
860  namespace result_of {}
861 
863  namespace tools
864  {
866  namespace detail {}
867  }
868 
870  namespace traits {}
871 
873  namespace scheduler
874  {
876  namespace detail {}
877 
879  namespace result_of {}
880  }
881 
882 } //namespace viennacl
883 
884 #endif
885 
virtual const char * what() const
Definition: forwards.h:491
Sparse matrix class using a hybrid format composed of the ELL and CSR format for storing the nonzeros...
Definition: forwards.h:321
Simple enable-if variant that uses the SFINAE pattern.
Definition: enable_if.hpp:29
Represents a vector consisting of zeros only.
Definition: forwards.h:193
A tag class representing multiplication by a scalar.
Definition: forwards.h:74
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.
Definition: forwards.h:107
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated...
Definition: forwards.h:187
std::size_t vcl_size_t
Definition: forwards.h:58
Definition: forwards.h:498
basic_slice slice
Definition: forwards.h:344
A tag class representing the tan() function.
Definition: forwards.h:133
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
Definition: forwards.h:172
Definition: forwards.h:478
virtual const char * what() const
Definition: forwards.h:503
Checks for either matrix_base or implicit_matrix_base.
Definition: forwards.h:395
Exception class in case of memory errors.
Definition: forwards.h:485
Helper class for checking whether a matrix is a compressed_matrix (CSR format)
Definition: forwards.h:406
Helper class for checking whether a matrix is a hyb_matrix (hybrid format: ELL plus CSR) ...
Definition: forwards.h:427
Class for representing strided submatrices of a bigger matrix A.
Definition: forwards.h:358
Helper class for checking whether the provided type is one of the sparse matrix types (compressed_mat...
Definition: forwards.h:434
Helper class for checking whether a matrix has a row-major layout.
Definition: forwards.h:399
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.
Definition: forwards.h:256
Helper struct for checking whether a type represents a sign flip on a viennacl::scalar<> ...
Definition: forwards.h:377
Represents a vector consisting of 1 at a given index and zeros otherwise.
Definition: forwards.h:196
A tag class representing the extraction of a matrix column to a vector.
Definition: forwards.h:147
A tag class representing a matrix given by a vector placed on a certain (off-)diagonal.
Definition: forwards.h:141
A tag class representing a lower triangular matrix.
Definition: forwards.h:703
void apply(VectorType &) const
Definition: forwards.h:731
A tag class representing subtraction.
Definition: forwards.h:72
A tag class representing assignment.
Definition: forwards.h:63
Helper class for checking whether a matrix is a Toeplitz matrix.
Definition: forwards.h:456
A dense matrix class.
Definition: forwards.h:290
A tag class representing the modulus function for integers.
Definition: forwards.h:93
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:283
A tag class representing the ceil() function.
Definition: forwards.h:103
A Hankel matrix class.
Definition: forwards.h:327
A dense matrix class.
Definition: forwards.h:293
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...
Definition: vector_operations.hpp:835
A tag class representing division.
Definition: forwards.h:80
Represents a vector consisting of 1 at a given index and zeros otherwise. To be used as an initialize...
Definition: forwards.h:299
void norm_1_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator
Definition: forwards.h:521
A proxy for scalar expressions (e.g. from inner vector products)
Definition: forwards.h:175
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:181
memory_exception()
Definition: forwards.h:488
A tag class representing the log() function.
Definition: forwards.h:123
row_major_tag orientation_category
Definition: forwards.h:248
A tag class representing inplace addition.
Definition: forwards.h:65
Definition: forwards.h:481
memory_types
Definition: forwards.h:476
A tag class representing the tanh() function.
Definition: forwards.h:135
A tag class representing the fabs() function.
Definition: forwards.h:111
A tag class representing the atan2() function.
Definition: forwards.h:101
Definition: forwards.h:365
A Vandermonde matrix class.
Definition: forwards.h:333
A tag class representing the (off-)diagonal of a matrix.
Definition: forwards.h:138
A tag class representing the atan() function.
Definition: forwards.h:99
A tag class representing the sinh() function.
Definition: forwards.h:129
virtual ~cuda_not_available_exception()
Definition: forwards.h:505
Checks for a type being either vector_base or implicit_vector_base.
Definition: forwards.h:391
Base class for representing matrices where the individual entries are not all stored explicitly...
Definition: forwards.h:296
static const char * name()
Definition: forwards.h:710
Definition: forwards.h:480
Helper struct for checking whether a type is a host scalar type (e.g. float, double) ...
Definition: forwards.h:363
A tag class representing the fmax() function.
Definition: forwards.h:117
Class for representing non-strided subvectors of a bigger vector x.
Definition: forwards.h:349
Helper class for checking whether a matrix is a circulant matrix.
Definition: forwards.h:442
Sparse matrix class using the ELLPACK format for storing the nonzeros.
Definition: ell_matrix.hpp:53
A tag class representing the use of no preconditioner.
Definition: forwards.h:727
A tag class representing the fmod() function.
Definition: forwards.h:121
Definition: forwards.h:379
A tag class representing the exp() function.
Definition: forwards.h:109
A tag class representing an upper triangular matrix.
Definition: forwards.h:708
void norm_frobenius_cpu(matrix_base< T, F > const &vec, T &result)
Computes the Frobenius norm of a vector with final reduction on the CPU.
Definition: matrix_operations.hpp:325
Tuple class holding pointers to multiple vectors. Mainly used as a temporary object returned from vie...
Definition: forwards.h:211
Helper struct for checking whether the provided type represents a scalar (either host, from ViennaCL, or a flip-sign proxy)
Definition: forwards.h:384
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
Definition: forwards.h:184
A sparse square matrix in compressed sparse rows format optimized for the case that only a few rows c...
Definition: compressed_compressed_matrix.hpp:263
static const char * name()
Definition: forwards.h:705
Class for representing strided subvectors of a bigger vector x.
Definition: forwards.h:352
A tag class representing addition.
Definition: forwards.h:70
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.
Definition: forwards.h:273
void copy(std::vector< SCALARTYPE > &cpu_vec, circulant_matrix< SCALARTYPE, ALIGNMENT > &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
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
Definition: forwards.h:305
Common base class for dense vectors, vector ranges, and vector slices.
Definition: forwards.h:205
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.
Definition: forwards.h:131
column_major_tag orientation_category
Definition: forwards.h:265
Tag class for indicating column-major layout of a matrix. Not passed to the matrix directly...
Definition: forwards.h:243
void inner_prod_impl(viennacl::vector_expression< LHS1, RHS1, OP1 > const &vec1, viennacl::vector_expression< LHS2, RHS2, OP2 > const &vec2, scalar< T > &result)
Definition: vector_operations.hpp:404
A tag class representing matrix-matrix products.
Definition: forwards.h:78
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::v...
Definition: forwards.h:208
static const char * name()
Definition: forwards.h:720
Represents a vector consisting of zeros only. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only.
Definition: forwards.h:302
void convolve_i(viennacl::vector< SCALARTYPE, ALIGNMENT > &input1, viennacl::vector< SCALARTYPE, ALIGNMENT > &input2, viennacl::vector< SCALARTYPE, ALIGNMENT > &output)
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...
Definition: vector_operations.hpp:747
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.
Definition: vector_operations.hpp:655
Definition: forwards.h:372
A tag class representing the sin() function.
Definition: forwards.h:127
memory_exception(std::string message)
Definition: forwards.h:489
Helper class for checking whether a matrix is a Hankel matrix.
Definition: forwards.h:449
A tag class representing the fmin() function.
Definition: forwards.h:119
A tag class representing inplace subtraction.
Definition: forwards.h:67
cuda_not_available_exception()
Definition: forwards.h:501
Helper class for checking whether the provided type is any of the dense structured matrix types (circ...
Definition: forwards.h:470
A tag class representing the 1-norm of a vector.
Definition: forwards.h:153
A tag class representing matrix-vector products and element-wise multiplications. ...
Definition: forwards.h:76
Helper struct for checking whether a type is a viennacl::scalar<>
Definition: forwards.h:370
static const char * name()
Definition: forwards.h:715
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:41
Tag class for indicating row-major layout of a matrix. Not passed to the matrix directly, see row_major type.
Definition: forwards.h:241
row_info_types
Definition: forwards.h:691
A tag class representing the floor() function.
Definition: forwards.h:115
A tag class representing the asin() function.
Definition: forwards.h:97
Definition: forwards.h:479
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...
Definition: vector_operations.hpp:608
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:339
virtual ~memory_exception()
Definition: forwards.h:493
A tag class representing a lower triangular matrix with unit diagonal.
Definition: forwards.h:713
std::ptrdiff_t vcl_ptrdiff_t
Definition: forwards.h:59
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 Toeplitz matrix class.
Definition: forwards.h:330
A tag class representing transposed matrices.
Definition: forwards.h:165
void inner_prod_cpu(viennacl::vector_expression< LHS1, RHS1, OP1 > const &vec1, viennacl::vector_expression< LHS2, RHS2, OP2 > const &vec2, S3 &result)
Definition: vector_operations.hpp:476
Represents a vector consisting of ones only.
Definition: forwards.h:199
static void apply(const MATRIXTYPE &, unsigned int &, unsigned int &)
Definition: forwards.h:523
basic_range range
Definition: forwards.h:339
A sparse square matrix in compressed sparse rows format.
Definition: compressed_matrix.hpp:428
A tag class representing the Frobenius-norm of a matrix.
Definition: forwards.h:162
A tag for column-major storage of a dense matrix.
Definition: forwards.h:263
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:86
A Circulant matrix class.
Definition: circulant_matrix.hpp:41
Class for representing non-strided submatrices of a bigger matrix A.
Definition: forwards.h:355
Helper class for checking whether a matrix is a coordinate_matrix (COO format)
Definition: forwards.h:413
void norm_frobenius_impl(matrix_base< T, F > const &vec, scalar< T > &result)
Computes the Frobenius norm of a matrix - dispatcher interface.
Definition: matrix_operations.hpp:311
Helper class for incrementing an iterator in a dense matrix.
Definition: forwards.h:519
Definition: forwards.h:386
Common base class for representing vectors where the entries are not all stored explicitly.
Definition: forwards.h:190
A tag class representing sign flips (for scalars only. Vectors and matrices use the standard multipli...
Definition: forwards.h:168
Helper class for checking whether a matrix is a Vandermonde matrix.
Definition: forwards.h:463
A tag class representing the acos() function.
Definition: forwards.h:95
A tag class representing the fdim() function.
Definition: forwards.h:113
A tag class representing inner products of two vectors.
Definition: forwards.h:150
A tag class representing the extraction of a matrix row to a vector.
Definition: forwards.h:144
A tag class representing the power function.
Definition: forwards.h:82
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:344
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Definition: forwards.h:178
A tag class representing the inf-norm of a vector.
Definition: forwards.h:159
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...
Definition: vector_operations.hpp:792
A tag class representing the log10() function.
Definition: forwards.h:125
A tag class representing element-wise unary operations (like sin()) on vectors or matrices...
Definition: forwards.h:90
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...
Definition: vector_operations.hpp:700
A tag class representing the 2-norm of a vector.
Definition: forwards.h:156
void fast_copy(const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)
STL-like transfer of a GPU vector to the CPU. The cpu type is assumed to reside in a linear piece of ...
Definition: vector.hpp:1284
A tag for row-major storage of a dense matrix.
Definition: forwards.h:246
Helper class for checking whether a matrix is an ell_matrix (ELL format)
Definition: forwards.h:420
A tag class representing the cos() function.
Definition: forwards.h:105
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
Definition: forwards.h:202
Simple enable-if variant that uses the SFINAE pattern.
A tag class representing an upper triangular matrix with unit diagonal.
Definition: forwards.h:718
A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row an...
Definition: coordinate_matrix.hpp:186