ViennaCL - The Vienna Computing Library
1.5.0
|
00001 #ifndef VIENNACL_TRAITS_START_HPP_ 00002 #define VIENNACL_TRAITS_START_HPP_ 00003 00004 /* ========================================================================= 00005 Copyright (c) 2010-2013, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 Portions of this software are copyright by UChicago Argonne, LLC. 00009 00010 ----------------- 00011 ViennaCL - The Vienna Computing Library 00012 ----------------- 00013 00014 Project Head: Karl Rupp rupp@iue.tuwien.ac.at 00015 00016 (A list of authors and contributors can be found in the PDF manual) 00017 00018 License: MIT (X11), see file LICENSE in the base directory 00019 ============================================================================= */ 00020 00025 #include <string> 00026 #include <fstream> 00027 #include <sstream> 00028 #include "viennacl/forwards.h" 00029 00030 #include "viennacl/meta/result_of.hpp" 00031 00032 namespace viennacl 00033 { 00034 namespace traits 00035 { 00036 // 00037 // start: Mostly for vectors 00038 // 00039 00040 // Default: Try to get the start index from the .start() member function 00041 template <typename T> 00042 typename result_of::size_type<T>::type 00043 start(T const & obj) 00044 { 00045 return obj.start(); 00046 } 00047 00048 //ViennaCL vector leads to start index 0: 00049 template <typename ScalarType, unsigned int ALIGNMENT> 00050 typename result_of::size_type<viennacl::vector<ScalarType, ALIGNMENT> >::type 00051 start(viennacl::vector<ScalarType, ALIGNMENT> const &) 00052 { 00053 return 0; 00054 } 00055 00056 00057 // 00058 // start1: Row start index 00059 // 00060 00061 // Default: Try to get the start index from the .start1() member function 00062 template <typename T> 00063 typename result_of::size_type<T>::type 00064 start1(T const & obj) 00065 { 00066 return obj.start1(); 00067 } 00068 00069 //ViennaCL matrix leads to start index 0: 00070 template <typename ScalarType, typename F, unsigned int ALIGNMENT> 00071 typename result_of::size_type<viennacl::matrix<ScalarType, F, ALIGNMENT> >::type 00072 start1(viennacl::matrix<ScalarType, F, ALIGNMENT> const &) 00073 { 00074 return 0; 00075 } 00076 00077 00078 // 00079 // start2: Column start index 00080 // 00081 template <typename T> 00082 typename result_of::size_type<T>::type 00083 start2(T const & obj) 00084 { 00085 return obj.start2(); 00086 } 00087 00088 //ViennaCL matrix leads to start index 0: 00089 template <typename ScalarType, typename F, unsigned int ALIGNMENT> 00090 typename result_of::size_type<viennacl::matrix<ScalarType, F, ALIGNMENT> >::type 00091 start2(viennacl::matrix<ScalarType, F, ALIGNMENT> const &) 00092 { 00093 return 0; 00094 } 00095 00096 00097 } //namespace traits 00098 } //namespace viennacl 00099 00100 00101 #endif