ViennaCL - The Vienna Computing Library: viennacl/traits/start.hpp Source File

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
start.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_TRAITS_START_HPP_
2 #define VIENNACL_TRAITS_START_HPP_
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
25 #include <string>
26 #include <fstream>
27 #include <sstream>
28 #include "viennacl/forwards.h"
29
30 #include "viennacl/meta/result_of.hpp"
31
32 namespace viennacl
33 {
34 namespace traits
35 {
36
37 //
38 // start: Mostly for vectors
39 //
40
41 // Default: Try to get the start index from the .start() member function
42 template<typename T>
43 typename result_of::size_type<T>::type
44 start(T const & obj)
45 {
46 return obj.start();
47 }
48
49 //ViennaCL vector leads to start index 0:
50 template<typename ScalarType, unsigned int AlignmentV>
51 typename result_of::size_type<viennacl::vector<ScalarType, AlignmentV> >::type
52 start(viennacl::vector<ScalarType, AlignmentV> const &)
53 {
54 return 0;
55 }
56
57
58 //
59 // start1: Row start index
60 //
61
62 // Default: Try to get the start index from the .start1() member function
63 template<typename T>
64 typename result_of::size_type<T>::type
65 start1(T const & obj)
66 {
67 return obj.start1();
68 }
69
70 //ViennaCL matrix leads to start index 0:
71 template<typename ScalarType, typename F, unsigned int AlignmentV>
72 typename result_of::size_type<viennacl::matrix<ScalarType, F, AlignmentV> >::type
73 start1(viennacl::matrix<ScalarType, F, AlignmentV> const &)
74 {
75 return 0;
76 }
77
78
79 //
80 // start2: Column start index
81 //
82 template<typename T>
83 typename result_of::size_type<T>::type
84 start2(T const & obj)
85 {
86 return obj.start2();
87 }
88
89 //ViennaCL matrix leads to start index 0:
90 template<typename ScalarType, typename F, unsigned int AlignmentV>
91 typename result_of::size_type<viennacl::matrix<ScalarType, F, AlignmentV> >::type
92 start2(viennacl::matrix<ScalarType, F, AlignmentV> const &)
93 {
94 return 0;
95 }
96
97
98 } //namespace traits
99 } //namespace viennacl
100
101
102 #endif
viennacl::result_of::size_type::type
T::size_type type
Definition: result_of.hpp:141
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::traits::start1
result_of::size_type< T >::type start1(T const &obj)
Definition: start.hpp:65
viennacl::matrix
A dense matrix class.
Definition: forwards.h:375
viennacl::traits::start2
result_of::size_type< T >::type start2(T const &obj)
Definition: start.hpp:84
viennacl::traits::start
result_of::size_type< T >::type start(T const &obj)
Definition: start.hpp:44
viennacl::vector
Definition: forwards.h:266
viennacl::result_of::size_type
Generic meta-function for retrieving the size_type associated with type T.
Definition: result_of.hpp:139
result_of.hpp
A collection of compile time type deductions.