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
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-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 
21 
51 //compatibility defines:
52 #ifdef VIENNACL_HAVE_UBLAS
53  #define VIENNACL_WITH_UBLAS
54 #endif
55 
56 #ifdef VIENNACL_HAVE_EIGEN
57  #define VIENNACL_WITH_EIGEN
58 #endif
59 
60 #ifdef VIENNACL_HAVE_MTL4
61  #define VIENNACL_WITH_MTL4
62 #endif
63 
64 #include <cstddef>
65 #include <cassert>
66 #include <string>
67 #include <stdexcept>
68 
70 #include "viennacl/version.hpp"
71 
73 namespace viennacl
74 {
75  typedef std::size_t vcl_size_t;
76  typedef std::ptrdiff_t vcl_ptrdiff_t;
77 
78 
79 
81  struct op_assign {};
83  struct op_inplace_add {};
85  struct op_inplace_sub {};
86 
88  struct op_add {};
90  struct op_sub {};
92  struct op_mult {};
94  struct op_prod {};
96  struct op_mat_mat_prod {};
98  struct op_div {};
100  struct op_pow {};
101 
103  struct op_eq {};
105  struct op_neq {};
107  struct op_greater {};
109  struct op_less {};
111  struct op_geq {};
113  struct op_leq {};
114 
116  struct op_sum {};
117 
119  struct op_row_sum {};
120 
122  struct op_col_sum {};
123 
125  template<typename OP>
126  struct op_element_cast {};
127 
129  template<typename OP>
130  struct op_element_binary {};
131 
133  template<typename OP>
134  struct op_element_unary {};
135 
137  struct op_abs {};
139  struct op_acos {};
141  struct op_asin {};
143  struct op_argmax {};
145  struct op_argmin {};
147  struct op_atan {};
149  struct op_atan2 {};
151  struct op_ceil {};
153  struct op_cos {};
155  struct op_cosh {};
157  struct op_exp {};
159  struct op_fabs {};
161  struct op_fdim {};
163  struct op_floor {};
165  struct op_fmax {};
167  struct op_fmin {};
169  struct op_fmod {};
171  struct op_log {};
173  struct op_log10 {};
175  struct op_sin {};
177  struct op_sinh {};
179  struct op_sqrt {};
181  struct op_tan {};
183  struct op_tanh {};
184 
186  struct op_matrix_diag {};
187 
189  struct op_vector_diag {};
190 
192  struct op_row {};
193 
195  struct op_column {};
196 
198  struct op_inner_prod {};
199 
201  struct op_norm_1 {};
202 
204  struct op_norm_2 {};
205 
207  struct op_norm_inf {};
208 
210  struct op_max {};
211 
213  struct op_min {};
214 
215 
217  struct op_norm_frobenius {};
218 
220  struct op_trans {};
221 
223  struct op_flip_sign {};
224 
225  //forward declaration of basic types:
226  template<class TYPE>
227  class scalar;
228 
229  template<typename LHS, typename RHS, typename OP>
231 
232  template<typename SCALARTYPE>
233  class entry_proxy;
234 
235  template<typename SCALARTYPE>
237 
238  template<typename LHS, typename RHS, typename OP>
240 
241  template<class SCALARTYPE, unsigned int ALIGNMENT>
243 
244  template<class SCALARTYPE, unsigned int ALIGNMENT>
246 
247  template<typename SCALARTYPE>
248  class implicit_vector_base;
249 
250  template<typename SCALARTYPE>
251  struct zero_vector;
252 
253  template<typename SCALARTYPE>
254  struct unit_vector;
255 
256  template<typename SCALARTYPE>
257  struct one_vector;
258 
259  template<typename SCALARTYPE>
260  struct scalar_vector;
261 
262  template<class SCALARTYPE, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
263  class vector_base;
264 
265  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
266  class vector;
267 
268  template<typename ScalarT>
270 
271  //the following forwards are needed for GMRES
272  template<typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
273  void copy(CPU_ITERATOR const & cpu_begin,
274  CPU_ITERATOR const & cpu_end,
276 
277  template<typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
278  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
281 
282  template<typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
283  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
286 
287  template<typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
290  CPU_ITERATOR cpu_begin );
291 
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,
296 
297 
299  struct row_major_tag {};
301  struct column_major_tag {};
302 
304  struct row_major
305  {
307 
314  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t /* num_rows */, vcl_size_t num_cols)
315  {
316  return i * num_cols + j;
317  }
318  };
319 
322  {
324 
331  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t num_rows, vcl_size_t /* num_cols */)
332  {
333  return i + j * num_rows;
334  }
335  };
336 
337  struct row_iteration;
338  struct col_iteration;
339 
340  template<typename LHS, typename RHS, typename OP>
342 
343  class context;
344 
346  {
351  };
352 
353  namespace backend
354  {
355  class mem_handle;
356  }
357 
358  //
359  // Matrix types:
360  //
361  static const vcl_size_t dense_padding_size = 128;
362 
368  template<typename ROWCOL, typename MATRIXTYPE>
370 
371  template<class SCALARTYPE, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
372  class matrix_base;
373 
374  template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
375  class matrix;
376 
377  template<typename SCALARTYPE>
378  class implicit_matrix_base;
379 
380  template<class SCALARTYPE>
381  class identity_matrix;
382 
383  template<class SCALARTYPE>
384  class zero_matrix;
385 
386  template<class SCALARTYPE>
387  class scalar_matrix;
388 
389  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
390  class compressed_matrix;
391 
392  template<class SCALARTYPE>
394 
395 
396  template<class SCALARTYPE, unsigned int ALIGNMENT = 128>
397  class coordinate_matrix;
398 
399  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
400  class ell_matrix;
401 
402  template<typename ScalarT, typename IndexT = unsigned int>
404 
405  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
406  class hyb_matrix;
407 
408  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
409  class circulant_matrix;
410 
411  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
413 
414  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
416 
417  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
419 
420  //
421  // Proxies:
422  //
423  template<typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
424  class basic_range;
425 
426  typedef basic_range<> range;
427 
428  template<typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
429  class basic_slice;
430 
431  typedef basic_slice<> slice;
432 
433  template<typename VectorType>
435 
436  template<typename VectorType>
438 
439  template<typename MatrixType>
441 
442  template<typename MatrixType>
444 
445 
447  template<typename T>
449  {
450  enum { value = false };
451  };
452 
454  template<typename T>
455  struct is_scalar
456  {
457  enum { value = false };
458  };
459 
461  template<typename T>
463  {
464  enum { value = false };
465  };
466 
468  template<typename T>
470  {
472  };
473 
475  template<typename T>
476  struct is_any_vector { enum { value = 0 }; };
477 
479  template<typename T>
480  struct is_any_dense_matrix { enum { value = 0 }; };
481 
483  template<typename T>
485  {
486  enum { value = false };
487  };
488 
490  template<typename T>
492  {
493  enum { value = false };
494  };
495 
497  template<typename T>
499  {
500  enum { value = false };
501  };
502 
504  template<typename T>
506  {
507  enum { value = false };
508  };
509 
511  template<typename T>
513  {
514  enum { value = false };
515  };
516 
517 
519  template<typename T>
521  {
522  enum { value = false };
523  };
524 
526  template<typename T>
528  {
529  enum { value = false };
530  };
531 
532 
534  template<typename T>
536  {
537  enum { value = false };
538  };
539 
541  template<typename T>
543  {
544  enum { value = false };
545  };
546 
548  template<typename T>
550  {
551  enum { value = false };
552  };
553 
555  template<typename T>
557  {
558  enum { value = false };
559  };
560 
562  template<typename T>
564  {
566  };
567 
568 
569 
570 
572  class memory_exception : public std::exception
573  {
574  public:
575  memory_exception() : message_() {}
576  memory_exception(std::string message) : message_("ViennaCL: Internal memory error: " + message) {}
577 
578  virtual const char* what() const throw() { return message_.c_str(); }
579 
580  virtual ~memory_exception() throw() {}
581  private:
582  std::string message_;
583  };
584 
585  class cuda_not_available_exception : public std::exception
586  {
587  public:
588  cuda_not_available_exception() : message_("ViennaCL was compiled without CUDA support, but CUDA functionality required for this operation.") {}
589 
590  virtual const char* what() const throw() { return message_.c_str(); }
591 
592  virtual ~cuda_not_available_exception() throw() {}
593  private:
594  std::string message_;
595  };
596 
597  class zero_on_diagonal_exception : public std::runtime_error
598  {
599  public:
600  zero_on_diagonal_exception(std::string const & what_arg) : std::runtime_error(what_arg) {}
601  };
602 
603  class unknown_norm_exception : public std::runtime_error
604  {
605  public:
606  unknown_norm_exception(std::string const & what_arg) : std::runtime_error(what_arg) {}
607  };
608 
609 
610 
611  namespace tools
612  {
613  //helper for matrix row/col iterators
614  //must be specialized for every viennacl matrix type
616  template<typename ROWCOL, typename MATRIXTYPE>
618  {
619  typedef typename MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator;
620 
621  static void apply(const MATRIXTYPE & /*mat*/, unsigned int & /*row*/, unsigned int & /*col*/) {}
622  };
623  }
624 
625  namespace linalg
626  {
627 #if !defined(_MSC_VER) || defined(__CUDACC__)
628 
629  template<class SCALARTYPE, unsigned int ALIGNMENT>
633 
634  template<typename T>
636  element_prod(vector_base<T> const & v1, vector_base<T> const & v2);
637 
638  template<typename T>
640  element_div(vector_base<T> const & v1, vector_base<T> const & v2);
641 
642 
643 
644  template<typename T>
645  void inner_prod_impl(vector_base<T> const & vec1,
646  vector_base<T> const & vec2,
647  scalar<T> & result);
648 
649  template<typename LHS, typename RHS, typename OP, typename T>
651  vector_base<T> const & vec2,
652  scalar<T> & result);
653 
654  template<typename T, typename LHS, typename RHS, typename OP>
655  void inner_prod_impl(vector_base<T> const & vec1,
657  scalar<T> & result);
658 
659  template<typename LHS1, typename RHS1, typename OP1,
660  typename LHS2, typename RHS2, typename OP2, typename T>
663  scalar<T> & result);
664 
666 
667  template<typename T>
668  void inner_prod_cpu(vector_base<T> const & vec1,
669  vector_base<T> const & vec2,
670  T & result);
671 
672  template<typename LHS, typename RHS, typename OP, typename T>
674  vector_base<T> const & vec2,
675  T & result);
676 
677  template<typename T, typename LHS, typename RHS, typename OP>
678  void inner_prod_cpu(vector_base<T> const & vec1,
680  T & result);
681 
682  template<typename LHS1, typename RHS1, typename OP1,
683  typename LHS2, typename RHS2, typename OP2, typename S3>
686  S3 & result);
687 
688 
689 
690  //forward definition of norm_1_impl function
691  template<typename T>
692  void norm_1_impl(vector_base<T> const & vec, scalar<T> & result);
693 
694  template<typename LHS, typename RHS, typename OP, typename T>
696  scalar<T> & result);
697 
698 
699  template<typename T>
700  void norm_1_cpu(vector_base<T> const & vec,
701  T & result);
702 
703  template<typename LHS, typename RHS, typename OP, typename S2>
705  S2 & result);
706 
707  //forward definition of norm_2_impl function
708  template<typename T>
709  void norm_2_impl(vector_base<T> const & vec, scalar<T> & result);
710 
711  template<typename LHS, typename RHS, typename OP, typename T>
713  scalar<T> & result);
714 
715  template<typename T>
716  void norm_2_cpu(vector_base<T> const & vec, T & result);
717 
718  template<typename LHS, typename RHS, typename OP, typename S2>
720  S2 & result);
721 
722 
723  //forward definition of norm_inf_impl function
724  template<typename T>
725  void norm_inf_impl(vector_base<T> const & vec, scalar<T> & result);
726 
727  template<typename LHS, typename RHS, typename OP, typename T>
729  scalar<T> & result);
730 
731 
732  template<typename T>
733  void norm_inf_cpu(vector_base<T> const & vec, T & result);
734 
735  template<typename LHS, typename RHS, typename OP, typename S2>
737  S2 & result);
738 
739  //forward definition of max()-related functions
740  template<typename T>
741  void max_impl(vector_base<T> const & vec, scalar<T> & result);
742 
743  template<typename LHS, typename RHS, typename OP, typename T>
745  scalar<T> & result);
746 
747 
748  template<typename T>
749  void max_cpu(vector_base<T> const & vec, T & result);
750 
751  template<typename LHS, typename RHS, typename OP, typename S2>
753  S2 & result);
754 
755  //forward definition of min()-related functions
756  template<typename T>
757  void min_impl(vector_base<T> const & vec, scalar<T> & result);
758 
759  template<typename LHS, typename RHS, typename OP, typename T>
761  scalar<T> & result);
762 
763 
764  template<typename T>
765  void min_cpu(vector_base<T> const & vec, T & result);
766 
767  template<typename LHS, typename RHS, typename OP, typename S2>
769  S2 & result);
770 
771  //forward definition of sum()-related functions
772  template<typename T>
773  void sum_impl(vector_base<T> const & vec, scalar<T> & result);
774 
775  template<typename LHS, typename RHS, typename OP, typename T>
777  scalar<T> & result);
778 
779 
780  template<typename T>
781  void sum_cpu(vector_base<T> const & vec, T & result);
782 
783  template<typename LHS, typename RHS, typename OP, typename S2>
785  S2 & result);
786 
787 
788  // forward definition of frobenius norm:
789  template<typename T>
790  void norm_frobenius_impl(matrix_base<T> const & vec, scalar<T> & result);
791 
792  template<typename T>
793  void norm_frobenius_cpu(matrix_base<T> const & vec, T & result);
794 
795 
796  template<typename T>
798 
799  template<typename LHS, typename RHS, typename OP>
801 
802  //forward definition of prod_impl functions
803 
804  template<typename NumericT>
805  void prod_impl(const matrix_base<NumericT> & mat,
806  const vector_base<NumericT> & vec,
807  vector_base<NumericT> & result);
808 
809  template<typename NumericT>
810  void prod_impl(const matrix_expression< const matrix_base<NumericT>, const matrix_base<NumericT>, op_trans> & mat_trans,
811  const vector_base<NumericT> & vec,
812  vector_base<NumericT> & result);
813 
814  template<typename SparseMatrixType, class SCALARTYPE, unsigned int ALIGNMENT>
816  vector_expression<const SparseMatrixType,
818  op_prod >
819  >::type
820  prod_impl(const SparseMatrixType & mat,
821  const vector<SCALARTYPE, ALIGNMENT> & vec);
822 
823  // forward definition of summation routines for matrices:
824 
825  template<typename NumericT>
826  void row_sum_impl(const matrix_base<NumericT> & A,
827  vector_base<NumericT> & result);
828 
829  template<typename NumericT>
830  void column_sum_impl(const matrix_base<NumericT> & A,
831  vector_base<NumericT> & result);
832 
833 #endif
834 
835  namespace detail
836  {
838  {
843  };
844 
845  }
846 
847 
849  struct lower_tag
850  {
851  static const char * name() { return "lower"; }
852  }; //lower triangular matrix
854  struct upper_tag
855  {
856  static const char * name() { return "upper"; }
857  }; //upper triangular matrix
860  {
861  static const char * name() { return "unit_lower"; }
862  }; //unit lower triangular matrix
865  {
866  static const char * name() { return "unit_upper"; }
867  }; //unit upper triangular matrix
868 
869  //preconditioner tags
870  class ilut_tag;
871 
874  {
875  public:
876  template<typename VectorType>
877  void apply(VectorType &) const {}
878  };
879 
880 
881  } //namespace linalg
882 
883  //
884  // More namespace comments to follow:
885  //
886 
888  namespace backend
889  {
891  namespace cpu_ram
892  {
894  namespace detail {}
895  }
896 
898  namespace cuda
899  {
901  namespace detail {}
902  }
903 
905  namespace detail {}
906 
908  namespace opencl
909  {
911  namespace detail {}
912  }
913  }
914 
915 
917  namespace detail
918  {
920  namespace fft
921  {
923  namespace FFT_DATA_ORDER {}
924  }
925  }
926 
927 
929  namespace device_specific
930  {
932  namespace autotune {}
933 
935  namespace detail {}
936 
938  namespace profiles {}
939 
941  namespace utils {}
942  }
943 
945  namespace io
946  {
948  namespace detail {}
949 
951  namespace tag {}
952 
954  namespace val {}
955  }
956 
958  namespace linalg
959  {
961  namespace cuda
962  {
964  namespace detail {}
965  }
966 
968  namespace detail
969  {
971  namespace amg {}
972 
974  namespace spai {}
975  }
976 
978  namespace host_based
979  {
981  namespace detail {}
982  }
983 
985  namespace kernels {}
986 
988  namespace opencl
989  {
991  namespace detail {}
992 
994  namespace kernels
995  {
997  namespace detail {}
998  }
999  }
1000  }
1001 
1003  namespace ocl {}
1004 
1006  namespace result_of {}
1007 
1009  namespace tools
1010  {
1012  namespace detail {}
1013  }
1014 
1016  namespace traits {}
1017 
1019  namespace scheduler
1020  {
1022  namespace detail {}
1023 
1025  namespace result_of {}
1026  }
1027 
1028 } //namespace viennacl
1029 
1030 #endif
1031 
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...
Definition: forwards.h:406
void row_sum_impl(const matrix_base< NumericT > &A, vector_base< NumericT > &result)
Simple enable-if variant that uses the SFINAE pattern.
Definition: enable_if.hpp:30
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.
Definition: forwards.h:92
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:155
A tag class representing the summation of all columns of a matrix.
Definition: forwards.h:122
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated...
Definition: forwards.h:245
A tag class representing equality.
Definition: forwards.h:103
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:314
A tag class representing the tan() function.
Definition: forwards.h:181
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
Definition: forwards.h:227
static const char * name()
Definition: forwards.h:851
static const char * name()
Definition: forwards.h:861
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Definition: forwards.h:236
A tag class representing the summation of a vector.
Definition: forwards.h:116
Checks for either matrix_base or implicit_matrix_base.
Definition: forwards.h:480
Exception class in case of memory errors.
Definition: forwards.h:572
Helper class for checking whether a matrix is a compressed_matrix (CSR format)
Definition: forwards.h:491
A tag class representing less-than.
Definition: forwards.h:109
Helper class for checking whether a matrix is a hyb_matrix (hybrid format: ELL plus CSR) ...
Definition: forwards.h:520
A tag class representing the summation of all rows of a matrix.
Definition: forwards.h:119
Class for representing strided submatrices of a bigger matrix A.
Definition: forwards.h:443
Helper class for checking whether the provided type is one of the sparse matrix types (compressed_mat...
Definition: forwards.h:527
Helper class for checking whether a matrix has a row-major layout.
Definition: forwards.h:484
Helper struct for checking whether a type represents a sign flip on a viennacl::scalar<> ...
Definition: forwards.h:462
A tag class representing the extraction of a matrix column to a vector.
Definition: forwards.h:195
A tag class representing a matrix given by a vector placed on a certain (off-)diagonal.
Definition: forwards.h:189
A tag class representing a lower triangular matrix.
Definition: forwards.h:849
A tag class representing subtraction.
Definition: forwards.h:90
A tag class representing assignment.
Definition: forwards.h:81
Helper class for checking whether a matrix is a Toeplitz matrix.
Definition: forwards.h:549
A tag class representing the modulus function for integers.
Definition: forwards.h:137
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:341
A tag class representing the ceil() function.
Definition: forwards.h:151
void inner_prod_impl(viennacl::vector_expression< LHS1, RHS1, OP1 > const &vec1, viennacl::vector_expression< LHS2, RHS2, OP2 > const &vec2, scalar< T > &result)
A Hankel matrix class.
Definition: forwards.h:412
A dense matrix class.
Definition: forwards.h:375
void max_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
A tag class representing division.
Definition: forwards.h:98
Represents a vector consisting of 1 at a given index and zeros otherwise. To be used as an initialize...
Definition: matrix_def.hpp:69
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)
Definition: forwards.h:230
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:239
A tag class representing the log() function.
Definition: forwards.h:171
memory_exception(std::string message)
Definition: forwards.h:576
zero_on_diagonal_exception(std::string const &what_arg)
Definition: forwards.h:600
A tag class representing inplace addition.
Definition: forwards.h:83
A tag class representing the tanh() function.
Definition: forwards.h:183
A tag class representing the fabs() function.
Definition: forwards.h:159
A tag class representing the maximum of a vector.
Definition: forwards.h:210
A tag class representing the atan2() function.
Definition: forwards.h:149
A Vandermonde matrix class.
Definition: forwards.h:418
A tag class representing the (off-)diagonal of a matrix.
Definition: forwards.h:186
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition: context.hpp:39
A tag class representing the atan() function.
Definition: forwards.h:147
basic_range range
Definition: forwards.h:424
Helper class for checking whether a matrix is a sliced_ell_matrix (SELL-C- format) ...
Definition: forwards.h:512
A tag class representing the sinh() function.
Definition: forwards.h:177
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.
Definition: forwards.h:476
column_major_tag orientation_category
Definition: forwards.h:323
Base class for representing matrices where the individual entries are not all stored explicitly...
Definition: matrix_def.hpp:35
Helper struct for checking whether a type is a host scalar type (e.g. float, double) ...
Definition: forwards.h:448
A tag class representing the fmax() function.
Definition: forwards.h:165
Class for representing non-strided subvectors of a bigger vector x.
Definition: forwards.h:434
Helper class for checking whether a matrix is a circulant matrix.
Definition: forwards.h:535
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:873
A tag class representing the fmod() function.
Definition: forwards.h:169
A tag class representing the exp() function.
Definition: forwards.h:157
A tag class representing greater-than-or-equal-to.
Definition: forwards.h:111
A tag class representing an upper triangular matrix.
Definition: forwards.h:854
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...
Definition: forwards.h:269
virtual const char * what() const
Definition: forwards.h:590
Helper struct for checking whether the provided type represents a scalar (either host, from ViennaCL, or a flip-sign proxy)
Definition: forwards.h:469
void sum_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
Sparse matrix class using the sliced ELLPACK with parameters C, .
Definition: forwards.h:403
A tag class representing inequality.
Definition: forwards.h:105
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
Definition: forwards.h:242
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.
Definition: forwards.h:113
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.
Definition: forwards.h:437
A tag class representing addition.
Definition: forwards.h:88
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
Definition: matrix_def.hpp:93
Common base class for dense vectors, vector ranges, and vector slices.
Definition: vector_def.hpp:104
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:179
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...
Definition: forwards.h:301
A tag class representing matrix-matrix products.
Definition: forwards.h:96
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...
std::size_t vcl_size_t
Definition: forwards.h:75
static const char * name()
Definition: forwards.h:866
Represents a vector consisting of zeros only. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only.
Definition: matrix_def.hpp:81
A tag class representing the minimum of a vector.
Definition: forwards.h:213
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
Definition: forwards.h:877
A tag class representing the sin() function.
Definition: forwards.h:175
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.
MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator
Definition: forwards.h:619
Helper class for checking whether a matrix is a Hankel matrix.
Definition: forwards.h:542
A tag class representing the fmin() function.
Definition: forwards.h:167
A tag class representing inplace subtraction.
Definition: forwards.h:85
Helper class for checking whether the provided type is any of the dense structured matrix types (circ...
Definition: forwards.h:563
A tag class representing the 1-norm of a vector.
Definition: forwards.h:201
A tag class representing matrix-vector products and element-wise multiplications. ...
Definition: forwards.h:94
Helper struct for checking whether a type is a viennacl::scalar<>
Definition: forwards.h:455
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.
Definition: forwards.h:299
Represents a vector consisting of 1 at a given index and zeros otherwise.
Definition: vector_def.hpp:76
viennacl::vector< int > v2
A dense matrix class.
Definition: forwards.h:369
basic_slice slice
Definition: forwards.h:429
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
Definition: vector_def.hpp:87
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.
Definition: forwards.h:163
A tag class representing the asin() function.
Definition: forwards.h:141
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:424
virtual const char * what() const
Definition: forwards.h:578
A tag class representing a lower triangular matrix with unit diagonal.
Definition: forwards.h:859
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:415
A tag class for representing the argmax() function.
Definition: forwards.h:143
A tag class representing transposed matrices.
Definition: forwards.h:220
A sparse square matrix in compressed sparse rows format.
A tag class representing the Frobenius-norm of a matrix.
Definition: forwards.h:217
A tag for column-major storage of a dense matrix.
Definition: forwards.h:321
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:130
A Circulant matrix class.
Class for representing non-strided submatrices of a bigger matrix A.
Definition: forwards.h:440
Helper class for checking whether a matrix is a coordinate_matrix (COO format)
Definition: forwards.h:498
static const char * name()
Definition: forwards.h:856
Helper class for incrementing an iterator in a dense matrix.
Definition: forwards.h:617
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:331
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.
Definition: vector_def.hpp:36
A tag class representing sign flips (for scalars only. Vectors and matrices use the standard multipli...
Definition: forwards.h:223
Helper class for checking whether a matrix is a Vandermonde matrix.
Definition: forwards.h:556
A tag class representing the acos() function.
Definition: forwards.h:139
memory_types
Definition: forwards.h:345
A tag class representing the fdim() function.
Definition: forwards.h:161
A tag class representing inner products of two vectors.
Definition: forwards.h:198
A tag class representing the extraction of a matrix row to a vector.
Definition: forwards.h:192
A tag class representing the power function.
Definition: forwards.h:100
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:429
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Definition: forwards.h:233
A tag class representing the inf-norm of a vector.
Definition: forwards.h:207
A tag class representing the log10() function.
Definition: forwards.h:173
A tag class representing element-wise unary operations (like sin()) on vectors or matrices...
Definition: forwards.h:134
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...
static void apply(const MATRIXTYPE &, unsigned int &, unsigned int &)
Definition: forwards.h:621
A tag class representing the 2-norm of a vector.
Definition: forwards.h:204
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.
Definition: forwards.h:304
A tag class for representing the argmin() function.
Definition: forwards.h:145
Helper class for checking whether a matrix is an ell_matrix (ELL format)
Definition: forwards.h:505
A tag class representing greater-than.
Definition: forwards.h:107
A tag class representing the cos() function.
Definition: forwards.h:153
row_major_tag orientation_category
Definition: forwards.h:306
Simple enable-if variant that uses the SFINAE pattern.
A tag class representing an upper triangular matrix with unit diagonal.
Definition: forwards.h:864
std::ptrdiff_t vcl_ptrdiff_t
Definition: forwards.h:76
unknown_norm_exception(std::string const &what_arg)
Definition: forwards.h:606
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)
Definition: fft_1d.cpp:719
A tag class representing element-wise casting operations on vectors and matrices. ...
Definition: forwards.h:126
void fast_copy(const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)