• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

/data/development/ViennaCL/dev/viennacl/forwards.h

Go to the documentation of this file.
00001 #ifndef VIENNACL_FORWARDS_H
00002 #define VIENNACL_FORWARDS_H
00003 
00004 /* =========================================================================
00005    Copyright (c) 2010-2011, Institute for Microelectronics,
00006                             Institute for Analysis and Scientific Computing,
00007                             TU Wien.
00008 
00009                             -----------------
00010                   ViennaCL - The Vienna Computing Library
00011                             -----------------
00012 
00013    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
00014                
00015    (A list of authors and contributors can be found in the PDF manual)
00016 
00017    License:         MIT (X11), see file LICENSE in the base directory
00018 ============================================================================= */
00019 
00020 
00034 #include <cstddef>
00035 #include "viennacl/ocl/forwards.h"
00036 #include "viennacl/meta/enable_if.hpp"
00037 
00038 namespace viennacl
00039 {
00040   typedef std::size_t                                       vcl_size_t;
00041   typedef std::ptrdiff_t                                    vcl_ptrdiff_t;
00042  
00043   
00045   struct op_add;
00047   struct op_sub;
00049   struct op_div;
00050   
00052   struct op_inner_prod;
00053 
00055   struct op_norm_1;
00056 
00058   struct op_norm_2;
00059 
00061   struct op_norm_inf;
00062 
00064   struct op_prod;
00065   
00067   struct op_trans;
00068   
00069 
00070   //forward declaration of basic types:
00071   template<class TYPE>
00072   class scalar;
00073 
00074   template <typename LHS, typename RHS, typename OP>
00075   class scalar_expression;
00076 
00077   template <typename SCALARTYPE>
00078   class entry_proxy;
00079   
00080   template <typename LHS, typename RHS, typename OP>
00081   class vector_expression;
00082 
00083   template<class SCALARTYPE, unsigned int ALIGNMENT>
00084   class vector_iterator;
00085 
00086   template<class SCALARTYPE, unsigned int ALIGNMENT>
00087   class const_vector_iterator;
00088   
00089   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00090   class vector;
00091   
00092   //the following forwards are needed for GMRES
00093   template <typename SCALARTYPE, unsigned int ALIGNMENT, typename CPU_ITERATOR>
00094   void copy(CPU_ITERATOR const & cpu_begin,
00095             CPU_ITERATOR const & cpu_end,
00096             vector_iterator<SCALARTYPE, ALIGNMENT> gpu_begin);
00097 
00098   template <typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
00099   void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
00100             const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_end,
00101             vector_iterator<SCALARTYPE, ALIGNMENT_DEST> gpu_dest_begin);
00102   
00103   template <typename SCALARTYPE, unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
00104   void copy(const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_begin,
00105             const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC> const & gpu_src_end,
00106             const_vector_iterator<SCALARTYPE, ALIGNMENT_DEST> gpu_dest_begin);
00107   
00108   
00109   struct row_major;    
00110   struct column_major;    
00111   
00112   struct row_iteration;
00113   struct col_iteration;
00114 
00115   template <typename LHS, typename RHS, typename OP>
00116   class matrix_expression;
00117 
00118   //
00119   // Matrix types:
00120   //  
00121   template <class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
00122   class matrix;
00123   
00124   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00125   class compressed_matrix;
00126   
00127   template<class SCALARTYPE, unsigned int ALIGNMENT = 128>
00128   class coordinate_matrix;    
00129 
00130   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00131   class circulant_matrix;
00132     
00133   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00134   class hankel_matrix;
00135   
00136   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00137   class toeplitz_matrix;
00138   
00139   template<class SCALARTYPE, unsigned int ALIGNMENT = 1>
00140   class vandermonde_matrix;
00141   
00142   //
00143   // Proxies:
00144   //
00145   template <typename SizeType = std::size_t, typename DistanceType = std::ptrdiff_t>
00146   class basic_range;
00147   
00148   typedef basic_range<>  range;
00149   
00150   template <typename MatrixType>
00151   class matrix_range;
00152 
00153   template <typename VectorType>
00154   class vector_range;
00155   
00156   template <typename T>
00157   struct is_scalar;
00158 
00159   template <typename T>
00160   struct is_vector;
00161 
00162   template <typename T>
00163   struct is_matrix;
00164   
00165   namespace tools
00166   {
00167     //helper for matrix row/col iterators 
00168     //must be specialized for every viennacl matrix type
00169     template <typename ROWCOL, typename MATRIXTYPE>
00170     struct MATRIX_ITERATOR_INCREMENTER
00171     {
00172       static void apply(const MATRIXTYPE & mat, unsigned int & row, unsigned int & col)
00173       {
00174           typedef typename MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING          ErrorIndicator;
00175       }
00176     };
00177   }
00178     
00179   namespace linalg
00180   {
00181     template<class SCALARTYPE, unsigned int ALIGNMENT>
00182     void convolve_i(viennacl::vector<SCALARTYPE, ALIGNMENT>& input1,
00183                     viennacl::vector<SCALARTYPE, ALIGNMENT>& input2,
00184                     viennacl::vector<SCALARTYPE, ALIGNMENT>& output);
00185     
00186     //forward definition of norm_1_impl function
00187     template <typename V1, typename S2>
00188     typename viennacl::enable_if< viennacl::is_vector<V1>::value
00189                                   && viennacl::is_scalar<S2>::value
00190                                 >::type
00191     norm_1_impl(V1 const & vec,
00192                 S2 & result);
00193 
00194     //forward definition of norm_2_impl function
00195     template <typename V1, typename S2>
00196     typename viennacl::enable_if< viennacl::is_vector<V1>::value
00197                                   && viennacl::is_scalar<S2>::value
00198                                 >::type
00199     norm_2_impl(V1 const & vec,
00200                 S2 & result);
00201 
00202     //forward definition of norm_inf_impl function
00203     template <typename V1, typename S2>
00204     typename viennacl::enable_if< viennacl::is_vector<V1>::value
00205                                   && viennacl::is_scalar<S2>::value
00206                                 >::type
00207     norm_inf_impl(V1 const & vec,
00208                   S2 & result);
00209     
00210     //forward definition of prod_impl functions
00211     template<class SCALARTYPE, typename F, unsigned int ALIGNMENT, unsigned int VECTOR_ALIGNMENT>
00212     viennacl::vector_expression<const viennacl::matrix<SCALARTYPE, F, ALIGNMENT>,
00213                                 const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>, 
00214                                 op_prod > prod_impl(const viennacl::matrix<SCALARTYPE, F, ALIGNMENT> &, 
00215                                                     const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> &);
00216 
00217     template<class SCALARTYPE, unsigned int ALIGNMENT, unsigned int VECTOR_ALIGNMENT>
00218     viennacl::vector_expression<const viennacl::compressed_matrix<SCALARTYPE, ALIGNMENT>,
00219                                 const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>, 
00220                                 op_prod > prod_impl(const viennacl::compressed_matrix<SCALARTYPE, ALIGNMENT> & , 
00221                                                     const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> &);
00222 
00223     template<class SCALARTYPE, unsigned int ALIGNMENT, unsigned int VECTOR_ALIGNMENT>
00224     viennacl::vector_expression<const viennacl::coordinate_matrix<SCALARTYPE, ALIGNMENT>,
00225                                 const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>, 
00226                                 op_prod > prod_impl(const viennacl::coordinate_matrix<SCALARTYPE, ALIGNMENT> & , 
00227                                                     const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT> &);
00228 
00229                                                     
00230     //forward definition of inner_prod_impl function
00231     /*template <typename V1, typename V2>
00232     typename viennacl::enable_if< viennacl::is_vector<V1>::value
00233                                   && viennacl::is_vector<V2>::value,
00234                                   viennacl::scalar_expression< const V1, 
00235                                                                const V2,
00236                                                                viennacl::op_inner_prod >
00237                                 >::type
00238     inner_prod_impl(V1 const & vec1,
00239                     V2 const & vec2);*/
00240     
00241     
00242     template <typename V1, typename V2, typename S3>
00243     typename viennacl::enable_if< viennacl::is_vector<V1>::value
00244                                   && viennacl::is_vector<V2>::value
00245                                   && viennacl::is_scalar<S3>::value
00246                                 >::type
00247     inner_prod_impl(V1 const & vec1,
00248                     V2 const & vec2,
00249                     S3 & result);
00250                     
00251       
00253     struct lower_tag 
00254     {
00255       static const char * const name() { return "lower"; }
00256     };      //lower triangular matrix
00258     struct upper_tag 
00259     {
00260       static const char * const name() { return "upper"; }
00261     };      //upper triangular matrix
00263     struct unit_lower_tag
00264     {
00265       static const char * const name() { return "unit_lower"; }
00266     }; //unit lower triangular matrix
00268     struct unit_upper_tag
00269     {
00270       static const char * const name() { return "unit_upper"; }
00271     }; //unit upper triangular matrix
00272     
00273     //preconditioner tags
00274     class ilut_tag;
00275     
00277     class no_precond
00278     {
00279       public:
00280         template <typename VectorType>
00281         void apply(VectorType & vec) const {}
00282     };
00283     
00284     
00285   } //namespace linalg
00286 } //namespace viennacl
00287 
00288 #endif
00289 

Generated on Fri Dec 30 2011 23:20:42 for ViennaCL - The Vienna Computing Library by  doxygen 1.7.1