SubvectorData.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_
36 #define _BLAZE_MATH_VIEWS_SUBVECTOR_SUBVECTORDATA_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/util/Types.h>
44 #include <blaze/util/Unused.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
63 template< size_t... CSAs > // Compile time subvector arguments
65 {};
66 //*************************************************************************************************
67 
68 
69 
70 
71 //=================================================================================================
72 //
73 // CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME ARGUMENTS
74 //
75 //=================================================================================================
76 
77 //*************************************************************************************************
86 template<>
87 struct SubvectorData<>
88 {
89  public:
90  //**Constructors********************************************************************************
93  template< typename... RSAs >
94  explicit inline SubvectorData( size_t index, size_t n, RSAs... args );
95 
96  SubvectorData( const SubvectorData& ) = default;
98  //**********************************************************************************************
99 
100  //**Destructor**********************************************************************************
103  ~SubvectorData() = default;
105  //**********************************************************************************************
106 
107  //**Assignment operators************************************************************************
110  SubvectorData& operator=( const SubvectorData& ) = delete;
112  //**********************************************************************************************
113 
114  //**Utility functions***************************************************************************
117  inline size_t offset() const noexcept;
118  inline size_t size () const noexcept;
120  //**********************************************************************************************
121 
122  private:
123  //**Member variables****************************************************************************
126  const size_t offset_;
127  const size_t size_;
128 
129  //**********************************************************************************************
130 };
132 //*************************************************************************************************
133 
134 
135 //*************************************************************************************************
143 template< typename... RSAs > // Optional subvector arguments
144 inline SubvectorData<>::SubvectorData( size_t index, size_t n, RSAs... args )
145  : offset_( index ) // The offset of the subvector within the vector
146  , size_ ( n ) // The size of the subvector
147 {
148  UNUSED_PARAMETER( args... );
149 }
151 //*************************************************************************************************
152 
153 
154 //*************************************************************************************************
160 inline size_t SubvectorData<>::offset() const noexcept
161 {
162  return offset_;
163 }
165 //*************************************************************************************************
166 
167 
168 //*************************************************************************************************
174 inline size_t SubvectorData<>::size() const noexcept
175 {
176  return size_;
177 }
179 //*************************************************************************************************
180 
181 
182 
183 
184 //=================================================================================================
185 //
186 // CLASS TEMPLATE SPECIALIZATION FOR TWO COMPILE TIME ARGUMENTS
187 //
188 //=================================================================================================
189 
190 //*************************************************************************************************
199 template< size_t I // Index of the first element
200  , size_t N > // Number of elements
201 struct SubvectorData<I,N>
202 {
203  public:
204  //**Constructors********************************************************************************
207  template< typename... RSAs >
208  explicit inline SubvectorData( RSAs... args );
209 
210  SubvectorData( const SubvectorData& ) = default;
212  //**********************************************************************************************
213 
214  //**Destructor**********************************************************************************
217  ~SubvectorData() = default;
219  //**********************************************************************************************
220 
221  //**Assignment operators************************************************************************
224  SubvectorData& operator=( const SubvectorData& ) = delete;
226  //**********************************************************************************************
227 
228  //**Utility functions***************************************************************************
231  static inline constexpr size_t offset() noexcept;
232  static inline constexpr size_t size () noexcept;
234  //**********************************************************************************************
235 };
237 //*************************************************************************************************
238 
239 
240 //*************************************************************************************************
246 template< size_t I // Index of the first element
247  , size_t N > // Number of elements
248 template< typename... RSAs > // Optional subvector arguments
249 inline SubvectorData<I,N>::SubvectorData( RSAs... args )
250 {
251  UNUSED_PARAMETER( args... );
252 }
254 //*************************************************************************************************
255 
256 
257 //*************************************************************************************************
263 template< size_t I // Index of the first element
264  , size_t N > // Number of elements
265 inline constexpr size_t SubvectorData<I,N>::offset() noexcept
266 {
267  return I;
268 }
270 //*************************************************************************************************
271 
272 
273 //*************************************************************************************************
279 template< size_t I // Index of the first element
280  , size_t N > // Number of elements
281 inline constexpr size_t SubvectorData<I,N>::size() noexcept
282 {
283  return N;
284 }
286 //*************************************************************************************************
287 
288 } // namespace blaze
289 
290 #endif
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
Auxiliary class template for the data members of the Subvector class.The auxiliary SubvectorData clas...
Definition: SubvectorData.h:64
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530