Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
views
subvector
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/MaybeUnused.h
>
44
#include <
blaze/util/Types.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
64
class
SubvectorData
65
{};
66
//*************************************************************************************************
67
68
69
70
71
//=================================================================================================
72
//
73
// CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME ARGUMENTS
74
//
75
//=================================================================================================
76
77
//*************************************************************************************************
86
template
<>
87
class
SubvectorData
<>
88
{
89
public
:
90
//**Compile time flags**************************************************************************
92
96
static
constexpr
bool
compileTimeArgs =
false
;
97
//**********************************************************************************************
98
99
//**Constructors********************************************************************************
102
template
<
typename
... RSAs >
103
inline
SubvectorData
(
size_t
index,
size_t
n, RSAs... args );
104
105
SubvectorData
(
const
SubvectorData
& ) =
default
;
107
//**********************************************************************************************
108
109
//**Destructor**********************************************************************************
112
~SubvectorData
() =
default
;
114
//**********************************************************************************************
115
116
//**Assignment operators************************************************************************
119
SubvectorData
& operator=(
const
SubvectorData
& ) =
delete
;
121
//**********************************************************************************************
122
123
//**Utility functions***************************************************************************
126
inline
size_t
offset() const noexcept;
127
inline
size_t
size
() const noexcept;
129
//**********************************************************************************************
130
131
private:
132
//**Member variables****************************************************************************
135
const
size_t
offset_;
136
const
size_t
size_;
138
//**********************************************************************************************
139
};
141
//*************************************************************************************************
142
143
144
//*************************************************************************************************
152
template< typename... RSAs >
// Optional subvector arguments
153
inline
SubvectorData
<>::
SubvectorData
(
size_t
index,
size_t
n, RSAs... args )
154
: offset_( index )
// The offset of the subvector within the vector
155
, size_ ( n )
// The size of the subvector
156
{
157
MAYBE_UNUSED
( args... );
158
}
160
//*************************************************************************************************
161
162
163
//*************************************************************************************************
169
inline
size_t
SubvectorData<>::offset() const noexcept
170
{
171
return
offset_;
172
}
174
//*************************************************************************************************
175
176
177
//*************************************************************************************************
183
inline
size_t
SubvectorData<>::size() const noexcept
184
{
185
return
size_;
186
}
188
//*************************************************************************************************
189
190
191
192
193
//=================================================================================================
194
//
195
// CLASS TEMPLATE SPECIALIZATION FOR TWO COMPILE TIME ARGUMENTS
196
//
197
//=================================================================================================
198
199
//*************************************************************************************************
208
template
<
size_t
I
// Index of the first element
209
,
size_t
N >
// Number of elements
210
class
SubvectorData<I,N>
211
{
212
public
:
213
//**Compile time flags**************************************************************************
215
219
static
constexpr
bool
compileTimeArgs =
true
;
220
//**********************************************************************************************
221
222
//**Constructors********************************************************************************
225
template
<
typename
... RSAs >
226
explicit
inline
SubvectorData( RSAs... args );
227
228
SubvectorData(
const
SubvectorData& ) =
default
;
230
//**********************************************************************************************
231
232
//**Destructor**********************************************************************************
235
~SubvectorData() =
default
;
237
//**********************************************************************************************
238
239
//**Assignment operators************************************************************************
242
SubvectorData& operator=(
const
SubvectorData& ) =
delete
;
244
//**********************************************************************************************
245
246
//**Utility functions***************************************************************************
249
static
constexpr
size_t
offset() noexcept;
250
static constexpr
size_t
size () noexcept;
252
//**********************************************************************************************
253
};
255
//*************************************************************************************************
256
257
258
//*************************************************************************************************
264
template<
size_t
I
// Index of the first element
265
,
size_t
N >
// Number of elements
266
template< typename... RSAs >
// Optional subvector arguments
267
inline SubvectorData<I,N>::SubvectorData( RSAs... args )
268
{
269
MAYBE_UNUSED
( args... );
270
}
272
//*************************************************************************************************
273
274
275
//*************************************************************************************************
281
template
<
size_t
I
// Index of the first element
282
,
size_t
N >
// Number of elements
283
constexpr
size_t
SubvectorData<I,N>::offset() noexcept
284
{
285
return
I;
286
}
288
//*************************************************************************************************
289
290
291
//*************************************************************************************************
297
template
<
size_t
I
// Index of the first element
298
,
size_t
N >
// Number of elements
299
constexpr
size_t
SubvectorData<I,N>::size() noexcept
300
{
301
return
N;
302
}
304
//*************************************************************************************************
305
306
}
// namespace blaze
307
308
#endif
MaybeUnused.h
Header file for the MAYBE_UNUSED function template.
blaze::SubvectorData
Auxiliary class template for the data members of the Subvector class.
Definition
SubvectorData.h:65
blaze::size
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition
Matrix.h:676
blaze::MAYBE_UNUSED
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition
MaybeUnused.h:81
Types.h
Header file for basic type definitions.
Generated by
1.18.0