ViennaCL - The Vienna Computing Library: viennacl/traits/stride.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
stride.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_TRAITS_STRIDE_HPP_
2 #define VIENNACL_TRAITS_STRIDE_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 #include "viennacl/meta/result_of.hpp"
30
31
32 #include <vector>
33 #include <map>
34
35 namespace viennacl
36 {
37 namespace traits
38 {
39
40 //
41 // inc: Increment for vectors. Defaults to 1
42 //
43 template<typename T>
44 typename result_of::size_type< viennacl::vector_base<T> >::type
45 stride(viennacl::vector_base<T> const & s) { return s.stride(); }
46
47 //
48 // inc1: Row increment for matrices. Defaults to 1
49 //
50 //template<typename MatrixType>
51 //typename result_of::size_type<MatrixType>::type
52 //stride1(MatrixType const &) { return 1; }
53 template<typename NumericT>
54 typename result_of::size_type< matrix_base<NumericT> >::type
55 stride1(matrix_base<NumericT> const & s) { return s.stride1(); }
56
57 //
58 // inc2: Column increment for matrices. Defaults to 1
59 //
60 //template<typename MatrixType>
61 //typename result_of::size_type<MatrixType>::type
62 //stride2(MatrixType const &) { return 1; }
63 template<typename NumericT>
64 typename result_of::size_type< matrix_base<NumericT> >::type
65 stride2(matrix_base<NumericT> const & s) { return s.stride2(); }
66
67
68 } //namespace traits
69 } //namespace viennacl
70
71
72 #endif
viennacl::traits::stride1
result_of::size_type< matrix_base< NumericT > >::type stride1(matrix_base< NumericT > const &s)
Definition: stride.hpp:55
viennacl::matrix_base< NumericT >
viennacl::matrix_base::stride2
size_type stride2() const
Returns the number of columns.
Definition: matrix_def.hpp:234
viennacl::traits::stride
result_of::size_type< viennacl::vector_base< T > >::type stride(viennacl::vector_base< T > const &s)
Definition: stride.hpp:45
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::vector_base::stride
size_type stride() const
Returns the stride within the buffer (in multiples of sizeof(NumericT))
Definition: vector_def.hpp:124
viennacl::matrix_base::stride1
size_type stride1() const
Returns the number of rows.
Definition: matrix_def.hpp:232
viennacl::vector_base
Common base class for dense vectors, vector ranges, and vector slices.
Definition: vector_def.hpp:104
viennacl::traits::stride2
result_of::size_type< matrix_base< NumericT > >::type stride2(matrix_base< NumericT > const &s)
Definition: stride.hpp:65
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.