ViennaCL - The Vienna Computing Library  1.5.2
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-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 
25 #include <string>
26 #include <fstream>
27 #include <sstream>
28 #include "viennacl/forwards.h"
30 
31 
32 #include <vector>
33 #include <map>
34 
35 namespace viennacl
36 {
37 
38  namespace traits
39  {
40 
41  //
42  // inc: Increment for vectors. Defaults to 1
43  //
44  template <typename T>
45  typename result_of::size_type< viennacl::vector_base<T> >::type
46  stride(viennacl::vector_base<T> const & s) { return s.stride(); }
47 
48  //
49  // inc1: Row increment for matrices. Defaults to 1
50  //
51  //template <typename MatrixType>
52  //typename result_of::size_type<MatrixType>::type
53  //stride1(MatrixType const &) { return 1; }
54 
55  template <typename NumericT, typename F>
57  stride1(matrix_base<NumericT, F> const & s) { return s.stride1(); }
58 
59  //
60  // inc2: Column increment for matrices. Defaults to 1
61  //
62  //template <typename MatrixType>
63  //typename result_of::size_type<MatrixType>::type
64  //stride2(MatrixType const &) { return 1; }
65 
66  template <typename NumericT, typename F>
68  stride2(matrix_base<NumericT, F> const & s) { return s.stride2(); }
69 
70 
71  } //namespace traits
72 } //namespace viennacl
73 
74 
75 #endif
result_of::size_type< matrix_base< NumericT, F > >::type stride2(matrix_base< NumericT, F > const &s)
Definition: stride.hpp:68
size_type stride1() const
Returns the number of rows.
Definition: matrix.hpp:635
result_of::size_type< viennacl::vector_base< T > >::type stride(viennacl::vector_base< T > const &s)
Definition: stride.hpp:46
Common base class for dense vectors, vector ranges, and vector slices.
Definition: forwards.h:205
This file provides the forward declarations for the main types used within ViennaCL.
size_type stride2() const
Returns the number of columns.
Definition: matrix.hpp:637
A dense matrix class.
Definition: forwards.h:290
result_of::size_type< matrix_base< NumericT, F > >::type stride1(matrix_base< NumericT, F > const &s)
Definition: stride.hpp:57
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
Generic meta-function for retrieving the size_type associated with type T.
Definition: result_of.hpp:184
A collection of compile time type deductions.
size_type stride() const
Returns the stride within the buffer (in multiples of sizeof(SCALARTYPE))
Definition: vector.hpp:849