ViennaCL - The Vienna Computing Library  1.6.0
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-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 
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 
69 #include "viennacl/version.hpp"
70 
72 namespace viennacl
73 {
74  typedef std::size_t vcl_size_t;
75  typedef std::ptrdiff_t vcl_ptrdiff_t;
76 
77 
78 
80  struct op_assign {};
82  struct op_inplace_add {};
84  struct op_inplace_sub {};
85 
87  struct op_add {};
89  struct op_sub {};
91  struct op_mult {};
93  struct op_prod {};
95  struct op_mat_mat_prod {};
97  struct op_div {};
99  struct op_pow {};
100 
102  struct op_eq {};
104  struct op_neq {};
106  struct op_greater {};
108  struct op_less {};
110  struct op_geq {};
112  struct op_leq {};
113 
114  template<class T>
115  struct op_reduce_vector{ };
116 
117  template<class T>
118  struct op_reduce_rows{ };
119 
120  template<class T>
121  struct op_reduce_columns{ };
122 
124  template<typename OP>
125  struct op_element_cast {};
126 
128  template<typename OP>
129  struct op_element_binary {};
130 
132  template<typename OP>
133  struct op_element_unary {};
134 
136  struct op_abs {};
138  struct op_acos {};
140  struct op_asin {};
142  struct op_argmax {};
144  struct op_argmin {};
146  struct op_atan {};
148  struct op_atan2 {};
150  struct op_ceil {};
152  struct op_cos {};
154  struct op_cosh {};
156  struct op_exp {};
158  struct op_fabs {};
160  struct op_fdim {};
162  struct op_floor {};
164  struct op_fmax {};
166  struct op_fmin {};
168  struct op_fmod {};
170  struct op_log {};
172  struct op_log10 {};
174  struct op_sin {};
176  struct op_sinh {};
178  struct op_sqrt {};
180  struct op_tan {};
182  struct op_tanh {};
183 
185  struct op_matrix_diag {};
186 
188  struct op_vector_diag {};
189 
191  struct op_row {};
192 
194  struct op_column {};
195 
197  struct op_inner_prod {};
198 
200  struct op_norm_1 {};
201 
203  struct op_norm_2 {};
204 
206  struct op_norm_inf {};
207 
209  struct op_max {};
210 
212  struct op_min {};
213 
214 
216  struct op_norm_frobenius {};
217 
219  struct op_trans {};
220 
222  struct op_flip_sign {};
223 
224  //forward declaration of basic types:
225  template<class TYPE>
226  class scalar;
227 
228  template<typename LHS, typename RHS, typename OP>
230 
231  template<typename SCALARTYPE>
232  class entry_proxy;
233 
234  template<typename SCALARTYPE>
236 
237  template<typename LHS, typename RHS, typename OP>
239 
240  template<class SCALARTYPE, unsigned int ALIGNMENT>
242 
243  template<class SCALARTYPE, unsigned int ALIGNMENT>
245 
246  template<typename SCALARTYPE>
247  class implicit_vector_base;
248 
249  template<typename SCALARTYPE>
250  struct zero_vector;
251 
252  template<typename SCALARTYPE>
253  struct unit_vector;
254 
255  template<typename SCALARTYPE>
256  struct one_vector;
257 
258  template<typename SCALARTYPE>
259  struct scalar_vector;
260 
261  template<class SCALARTYPE, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
262  class vector_base;
263 
264  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
265  class vector;
266 
267  template<typename ScalarT>
269 
270  //the following forwards are needed for GMRES
271  template<typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
272  void copy(CPU_ITERATOR const & cpu_begin,
273  CPU_ITERATOR const & cpu_end,
275 
276  template<typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
277  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
280 
281  template<typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
282  void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
285 
286  template<typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
289  CPU_ITERATOR cpu_begin );
290 
291  template<typename CPU_ITERATOR, typename SCALARTYPE, unsigned int ALIGNMENT>
292  void fast_copy(CPU_ITERATOR const & cpu_begin,
293  CPU_ITERATOR const & cpu_end,
295 
296 
298  struct row_major_tag {};
300  struct column_major_tag {};
301 
303  struct row_major
304  {
306 
313  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t /* num_rows */, vcl_size_t num_cols)
314  {
315  return i * num_cols + j;
316  }
317  };
318 
321  {
323 
330  static vcl_size_t mem_index(vcl_size_t i, vcl_size_t j, vcl_size_t num_rows, vcl_size_t /* num_cols */)
331  {
332  return i + j * num_rows;
333  }
334  };
335 
336  struct row_iteration;
337  struct col_iteration;
338 
339  template<typename LHS, typename RHS, typename OP>
341 
342  class context;
343 
345  {
350  };
351 
352  namespace backend
353  {
354  class mem_handle;
355  }
356 
357  //
358  // Matrix types:
359  //
360  static const vcl_size_t dense_padding_size = 128;
361 
367  template<typename ROWCOL, typename MATRIXTYPE>
369 
370  template<class SCALARTYPE, typename SizeType = vcl_size_t, typename DistanceType = vcl_ptrdiff_t>
371  class matrix_base;
372 
373  template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
374  class matrix;
375 
376  template<typename SCALARTYPE>
377  class implicit_matrix_base;
378 
379  template<class SCALARTYPE>
380  class identity_matrix;
381 
382  template<class SCALARTYPE>
383  class zero_matrix;
384 
385  template<class SCALARTYPE>
386  class scalar_matrix;
387 
388  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
389  class compressed_matrix;
390 
391  template<class SCALARTYPE>
393 
394 
395  template<class SCALARTYPE, unsigned int ALIGNMENT = 128>
396  class coordinate_matrix;
397 
398  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
399  class ell_matrix;
400 
401  template<typename ScalarT, typename IndexT = unsigned int>
403 
404  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
405  class hyb_matrix;
406 
407  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
408  class circulant_matrix;
409 
410  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
412 
413  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
415 
416  template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
418 
419  //
420  // Proxies:
421  //
422  template<typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
423  class basic_range;
424 
425  typedef basic_range<> range;
426 
427  template<typename SizeType = vcl_size_t, typename DistanceType = std::ptrdiff_t>
428  class basic_slice;
429 
430  typedef basic_slice<> slice;
431 
432  template<typename VectorType>
434 
435  template<typename VectorType>
437 
438  template<typename MatrixType>
440 
441  template<typename MatrixType>
443 
444 
446  template<typename T>
448  {
449  enum { value = false };
450  };
451 
453  template<typename T>
454  struct is_scalar
455  {
456  enum { value = false };
457  };
458 
460  template<typename T>
462  {
463  enum { value = false };
464  };
465 
467  template<typename T>
469  {
471  };
472 
474  template<typename T>
475  struct is_any_vector { enum { value = 0 }; };
476 
478  template<typename T>
479  struct is_any_dense_matrix { enum { value = 0 }; };
480 
482  template<typename T>
484  {
485  enum { value = false };
486  };
487 
489  template<typename T>
491  {
492  enum { value = false };
493  };
494 
496  template<typename T>
498  {
499  enum { value = false };
500  };
501 
503  template<typename T>
505  {
506  enum { value = false };
507  };
508 
510  template<typename T>
512  {
513  enum { value = false };
514  };
515 
516 
518  template<typename T>
520  {
521  enum { value = false };
522  };
523 
525  template<typename T>
527  {
528  enum { value = false };
529  };
530 
531 
533  template<typename T>
535  {
536  enum { value = false };
537  };
538 
540  template<typename T>
542  {
543  enum { value = false };
544  };
545 
547  template<typename T>
549  {
550  enum { value = false };
551  };
552 
554  template<typename T>
556  {
557  enum { value = false };
558  };
559 
561  template<typename T>
563  {
565  };
566 
567 
568 
569 
571  class memory_exception : public std::exception
572  {
573  public:
574  memory_exception() : message_() {}
575  memory_exception(std::string message) : message_("ViennaCL: Internal memory error: " + message) {}
576 
577  virtual const char* what() const throw() { return message_.c_str(); }
578 
579  virtual ~memory_exception() throw() {}
580  private:
581  std::string message_;
582  };
583 
584  class cuda_not_available_exception : public std::exception
585  {
586  public:
587  cuda_not_available_exception() : message_("ViennaCL was compiled without CUDA support, but CUDA functionality required for this operation.") {}
588 
589  virtual const char* what() const throw() { return message_.c_str(); }
590 
591  virtual ~cuda_not_available_exception() throw() {}
592  private:
593  std::string message_;
594  };
595 
596 
597 
598  namespace tools
599  {
600  //helper for matrix row/col iterators
601  //must be specialized for every viennacl matrix type
603  template<typename ROWCOL, typename MATRIXTYPE>
605  {
606  typedef typename MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator;
607 
608  static void apply(const MATRIXTYPE & /*mat*/, unsigned int & /*row*/, unsigned int & /*col*/) {}
609  };
610  }
611 
612  namespace linalg
613  {
614 #if !defined(_MSC_VER) || defined(__CUDACC__)
615 
616  template<class SCALARTYPE, unsigned int ALIGNMENT>
620 
621  template<typename T>
623  element_prod(vector_base<T> const & v1, vector_base<T> const & v2);
624 
625  template<typename T>
627  element_div(vector_base<T> const & v1, vector_base<T> const & v2);
628 
629 
630 
631  template<typename T>
632  void inner_prod_impl(vector_base<T> const & vec1,
633  vector_base<T> const & vec2,
634  scalar<T> & result);
635 
636  template<typename LHS, typename RHS, typename OP, typename T>
638  vector_base<T> const & vec2,
639  scalar<T> & result);
640 
641  template<typename T, typename LHS, typename RHS, typename OP>
642  void inner_prod_impl(vector_base<T> const & vec1,
644  scalar<T> & result);
645 
646  template<typename LHS1, typename RHS1, typename OP1,
647  typename LHS2, typename RHS2, typename OP2, typename T>
650  scalar<T> & result);
651 
653 
654  template<typename T>
655  void inner_prod_cpu(vector_base<T> const & vec1,
656  vector_base<T> const & vec2,
657  T & result);
658 
659  template<typename LHS, typename RHS, typename OP, typename T>
661  vector_base<T> const & vec2,
662  T & result);
663 
664  template<typename T, typename LHS, typename RHS, typename OP>
665  void inner_prod_cpu(vector_base<T> const & vec1,
667  T & result);
668 
669  template<typename LHS1, typename RHS1, typename OP1,
670  typename LHS2, typename RHS2, typename OP2, typename S3>
673  S3 & result);
674 
675 
676 
677  //forward definition of norm_1_impl function
678  template<typename T>
679  void norm_1_impl(vector_base<T> const & vec, scalar<T> & result);
680 
681  template<typename LHS, typename RHS, typename OP, typename T>
683  scalar<T> & result);
684 
685 
686  template<typename T>
687  void norm_1_cpu(vector_base<T> const & vec,
688  T & result);
689 
690  template<typename LHS, typename RHS, typename OP, typename S2>
692  S2 & result);
693 
694  //forward definition of norm_2_impl function
695  template<typename T>
696  void norm_2_impl(vector_base<T> const & vec, scalar<T> & result);
697 
698  template<typename LHS, typename RHS, typename OP, typename T>
700  scalar<T> & result);
701 
702  template<typename T>
703  void norm_2_cpu(vector_base<T> const & vec, T & result);
704 
705  template<typename LHS, typename RHS, typename OP, typename S2>
707  S2 & result);
708 
709 
710  //forward definition of norm_inf_impl function
711  template<typename T>
712  void norm_inf_impl(vector_base<T> const & vec, scalar<T> & result);
713 
714  template<typename LHS, typename RHS, typename OP, typename T>
716  scalar<T> & result);
717 
718 
719  template<typename T>
720  void norm_inf_cpu(vector_base<T> const & vec, T & result);
721 
722  template<typename LHS, typename RHS, typename OP, typename S2>
724  S2 & result);
725 
726  //forward definition of max()-related functions
727  template<typename T>
728  void max_impl(vector_base<T> const & vec, scalar<T> & result);
729 
730  template<typename LHS, typename RHS, typename OP, typename T>
732  scalar<T> & result);
733 
734 
735  template<typename T>
736  void max_cpu(vector_base<T> const & vec, T & result);
737 
738  template<typename LHS, typename RHS, typename OP, typename S2>
740  S2 & result);
741 
742  //forward definition of min()-related functions
743  template<typename T>
744  void min_impl(vector_base<T> const & vec, scalar<T> & result);
745 
746  template<typename LHS, typename RHS, typename OP, typename T>
748  scalar<T> & result);
749 
750 
751  template<typename T>
752  void min_cpu(vector_base<T> const & vec, T & result);
753 
754  template<typename LHS, typename RHS, typename OP, typename S2>
756  S2 & result);
757 
758 
759  // forward definition of frobenius norm:
760  template<typename T>
761  void norm_frobenius_impl(matrix_base<T> const & vec, scalar<T> & result);
762 
763  template<typename T>
764  void norm_frobenius_cpu(matrix_base<T> const & vec, T & result);
765 
766 
767  template<typename T>
769 
770  template<typename LHS, typename RHS, typename OP>
772 
773  //forward definition of prod_impl functions
774 
775  template<typename NumericT>
776  void prod_impl(const matrix_base<NumericT> & mat,
777  const vector_base<NumericT> & vec,
778  vector_base<NumericT> & result);
779 
780  template<typename NumericT>
781  void prod_impl(const matrix_expression< const matrix_base<NumericT>, const matrix_base<NumericT>, op_trans> & mat_trans,
782  const vector_base<NumericT> & vec,
783  vector_base<NumericT> & result);
784 
785  template<typename SparseMatrixType, class SCALARTYPE, unsigned int ALIGNMENT>
787  vector_expression<const SparseMatrixType,
789  op_prod >
790  >::type
791  prod_impl(const SparseMatrixType & mat,
792  const vector<SCALARTYPE, ALIGNMENT> & vec);
793 #endif
794 
795  namespace detail
796  {
798  {
803  };
804 
805  }
806 
807 
809  struct lower_tag
810  {
811  static const char * name() { return "lower"; }
812  }; //lower triangular matrix
814  struct upper_tag
815  {
816  static const char * name() { return "upper"; }
817  }; //upper triangular matrix
820  {
821  static const char * name() { return "unit_lower"; }
822  }; //unit lower triangular matrix
825  {
826  static const char * name() { return "unit_upper"; }
827  }; //unit upper triangular matrix
828 
829  //preconditioner tags
830  class ilut_tag;
831 
834  {
835  public:
836  template<typename VectorType>
837  void apply(VectorType &) const {}
838  };
839 
840 
841  } //namespace linalg
842 
843  //
844  // More namespace comments to follow:
845  //
846 
848  namespace backend
849  {
851  namespace cpu_ram
852  {
854  namespace detail {}
855  }
856 
858  namespace cuda
859  {
861  namespace detail {}
862  }
863 
865  namespace detail {}
866 
868  namespace opencl
869  {
871  namespace detail {}
872  }
873  }
874 
875 
877  namespace detail
878  {
880  namespace fft
881  {
883  namespace FFT_DATA_ORDER {}
884  }
885  }
886 
887 
889  namespace device_specific
890  {
892  namespace autotune {}
893 
895  namespace detail {}
896 
898  namespace profiles {}
899 
901  namespace utils {}
902  }
903 
905  namespace io
906  {
908  namespace detail {}
909 
911  namespace tag {}
912 
914  namespace val {}
915  }
916 
918  namespace linalg
919  {
921  namespace cuda
922  {
924  namespace detail {}
925  }
926 
928  namespace detail
929  {
931  namespace amg {}
932 
934  namespace spai {}
935  }
936 
938  namespace host_based
939  {
941  namespace detail {}
942  }
943 
945  namespace kernels {}
946 
948  namespace opencl
949  {
951  namespace detail {}
952 
954  namespace kernels
955  {
957  namespace detail {}
958  }
959  }
960  }
961 
963  namespace ocl {}
964 
966  namespace result_of {}
967 
969  namespace tools
970  {
972  namespace detail {}
973  }
974 
976  namespace traits {}
977 
979  namespace scheduler
980  {
982  namespace detail {}
983 
985  namespace result_of {}
986  }
987 
988 } //namespace viennacl
989 
990 #endif
991 
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:405
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:91
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:154
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated...
Definition: forwards.h:244
A tag class representing equality.
Definition: forwards.h:102
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:313
A tag class representing the tan() function.
Definition: forwards.h:180
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
Definition: forwards.h:226
static const char * name()
Definition: forwards.h:811
static const char * name()
Definition: forwards.h:821
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Definition: forwards.h:235
Checks for either matrix_base or implicit_matrix_base.
Definition: forwards.h:479
Exception class in case of memory errors.
Definition: forwards.h:571
Helper class for checking whether a matrix is a compressed_matrix (CSR format)
Definition: forwards.h:490
A tag class representing less-than.
Definition: forwards.h:108
Helper class for checking whether a matrix is a hyb_matrix (hybrid format: ELL plus CSR) ...
Definition: forwards.h:519
Class for representing strided submatrices of a bigger matrix A.
Definition: forwards.h:442
Helper class for checking whether the provided type is one of the sparse matrix types (compressed_mat...
Definition: forwards.h:526
Helper class for checking whether a matrix has a row-major layout.
Definition: forwards.h:483
Helper struct for checking whether a type represents a sign flip on a viennacl::scalar<> ...
Definition: forwards.h:461
A tag class representing the extraction of a matrix column to a vector.
Definition: forwards.h:194
A tag class representing a matrix given by a vector placed on a certain (off-)diagonal.
Definition: forwards.h:188
A tag class representing a lower triangular matrix.
Definition: forwards.h:809
A tag class representing subtraction.
Definition: forwards.h:89
A tag class representing assignment.
Definition: forwards.h:80
Helper class for checking whether a matrix is a Toeplitz matrix.
Definition: forwards.h:548
A tag class representing the modulus function for integers.
Definition: forwards.h:136
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:340
A tag class representing the ceil() function.
Definition: forwards.h:150
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:411
A dense matrix class.
Definition: forwards.h:374
void max_impl(viennacl::vector_expression< LHS, RHS, OP > const &vec, scalar< T > &result)
A tag class representing division.
Definition: forwards.h:97
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:229
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:238
A tag class representing the log() function.
Definition: forwards.h:170
memory_exception(std::string message)
Definition: forwards.h:575
A tag class representing inplace addition.
Definition: forwards.h:82
A tag class representing the tanh() function.
Definition: forwards.h:182
A tag class representing the fabs() function.
Definition: forwards.h:158
A tag class representing the maximum of a vector.
Definition: forwards.h:209
A tag class representing the atan2() function.
Definition: forwards.h:148
A Vandermonde matrix class.
Definition: forwards.h:417
A tag class representing the (off-)diagonal of a matrix.
Definition: forwards.h:185
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:146
basic_range range
Definition: forwards.h:423
Helper class for checking whether a matrix is a sliced_ell_matrix (SELL-C- format) ...
Definition: forwards.h:511
A tag class representing the sinh() function.
Definition: forwards.h:176
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:475
column_major_tag orientation_category
Definition: forwards.h:322
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:447
A tag class representing the fmax() function.
Definition: forwards.h:164
Class for representing non-strided subvectors of a bigger vector x.
Definition: forwards.h:433
Helper class for checking whether a matrix is a circulant matrix.
Definition: forwards.h:534
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:833
A tag class representing the fmod() function.
Definition: forwards.h:168
A tag class representing the exp() function.
Definition: forwards.h:156
A tag class representing greater-than-or-equal-to.
Definition: forwards.h:110
A tag class representing an upper triangular matrix.
Definition: forwards.h:814
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:268
virtual const char * what() const
Definition: forwards.h:589
Helper struct for checking whether the provided type represents a scalar (either host, from ViennaCL, or a flip-sign proxy)
Definition: forwards.h:468
Sparse matrix class using the sliced ELLPACK with parameters C, .
Definition: forwards.h:402
A tag class representing inequality.
Definition: forwards.h:104
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!!
Definition: forwards.h:241
A tag class representing less-than-or-equal-to.
Definition: forwards.h:112
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:436
A tag class representing addition.
Definition: forwards.h:87
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:178
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:300
A tag class representing matrix-matrix products.
Definition: forwards.h:95
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:74
static const char * name()
Definition: forwards.h:826
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:212
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:837
A tag class representing the sin() function.
Definition: forwards.h:174
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:606
Helper class for checking whether a matrix is a Hankel matrix.
Definition: forwards.h:541
A tag class representing the fmin() function.
Definition: forwards.h:166
A tag class representing inplace subtraction.
Definition: forwards.h:84
Helper class for checking whether the provided type is any of the dense structured matrix types (circ...
Definition: forwards.h:562
A tag class representing the 1-norm of a vector.
Definition: forwards.h:200
A tag class representing matrix-vector products and element-wise multiplications. ...
Definition: forwards.h:93
Helper struct for checking whether a type is a viennacl::scalar<>
Definition: forwards.h:454
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:298
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:368
basic_slice slice
Definition: forwards.h:428
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:162
A tag class representing the asin() function.
Definition: forwards.h:140
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:423
virtual const char * what() const
Definition: forwards.h:577
A tag class representing a lower triangular matrix with unit diagonal.
Definition: forwards.h:819
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:414
A tag class for representing the argmax() function.
Definition: forwards.h:142
A tag class representing transposed matrices.
Definition: forwards.h:219
A sparse square matrix in compressed sparse rows format.
A tag class representing the Frobenius-norm of a matrix.
Definition: forwards.h:216
A tag for column-major storage of a dense matrix.
Definition: forwards.h:320
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:129
A Circulant matrix class.
Class for representing non-strided submatrices of a bigger matrix A.
Definition: forwards.h:439
Helper class for checking whether a matrix is a coordinate_matrix (COO format)
Definition: forwards.h:497
static const char * name()
Definition: forwards.h:816
Helper class for incrementing an iterator in a dense matrix.
Definition: forwards.h:604
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:330
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:222
Helper class for checking whether a matrix is a Vandermonde matrix.
Definition: forwards.h:555
A tag class representing the acos() function.
Definition: forwards.h:138
memory_types
Definition: forwards.h:344
A tag class representing the fdim() function.
Definition: forwards.h:160
A tag class representing inner products of two vectors.
Definition: forwards.h:197
A tag class representing the extraction of a matrix row to a vector.
Definition: forwards.h:191
A tag class representing the power function.
Definition: forwards.h:99
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:428
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Definition: forwards.h:232
A tag class representing the inf-norm of a vector.
Definition: forwards.h:206
A tag class representing the log10() function.
Definition: forwards.h:172
A tag class representing element-wise unary operations (like sin()) on vectors or matrices...
Definition: forwards.h:133
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:608
A tag class representing the 2-norm of a vector.
Definition: forwards.h:203
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:303
A tag class for representing the argmin() function.
Definition: forwards.h:144
Helper class for checking whether a matrix is an ell_matrix (ELL format)
Definition: forwards.h:504
A tag class representing greater-than.
Definition: forwards.h:106
A tag class representing the cos() function.
Definition: forwards.h:152
row_major_tag orientation_category
Definition: forwards.h:305
Simple enable-if variant that uses the SFINAE pattern.
A tag class representing an upper triangular matrix with unit diagonal.
Definition: forwards.h:824
std::ptrdiff_t vcl_ptrdiff_t
Definition: forwards.h:75
A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row an...
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:125
void fast_copy(const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)