Blaze 3.9
BandData.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_VIEWS_BAND_BANDDATA_H_
36#define _BLAZE_MATH_VIEWS_BAND_BANDDATA_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/util/Types.h>
45
46
47namespace blaze {
48
49//=================================================================================================
50//
51// CLASS DEFINITION
52//
53//=================================================================================================
54
55//*************************************************************************************************
63template< ptrdiff_t... CBAs > // Compile time band arguments
65{};
66//*************************************************************************************************
67
68
69
70
71//=================================================================================================
72//
73// CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME BAND INDICES
74//
75//=================================================================================================
76
77//*************************************************************************************************
85template<>
86class BandData<>
87{
88 public:
89 //**Compile time flags**************************************************************************
91
95 static constexpr bool compileTimeArgs = false;
96 //**********************************************************************************************
97
98 //**Constructors********************************************************************************
101 template< typename... RBAs >
102 explicit inline BandData( ptrdiff_t index, RBAs... args );
103
104 BandData( const BandData& ) = default;
106 //**********************************************************************************************
107
108 //**Destructor**********************************************************************************
111 ~BandData() = default;
113 //**********************************************************************************************
114
115 //**Assignment operators************************************************************************
118 BandData& operator=( const BandData& ) = delete;
120 //**********************************************************************************************
121
122 //**Utility functions***************************************************************************
125 inline ptrdiff_t band () const noexcept;
126 inline size_t row () const noexcept;
127 inline size_t column() const noexcept;
129 //**********************************************************************************************
130
131 private:
132 //**Member variables****************************************************************************
135 const ptrdiff_t band_;
136 const size_t row_;
137 const size_t column_;
139 //**********************************************************************************************
140};
142//*************************************************************************************************
143
144
145//*************************************************************************************************
152template< typename... RBAs > // Optional band arguments
153inline BandData<>::BandData( ptrdiff_t index, RBAs... args )
154 : band_ ( index ) // The band index
155 , row_ ( index >= 0L ? 0UL : -index ) // The index of the row containing the first element of the band
156 , column_( index >= 0L ? index : 0UL ) // The index of the column containing the first element of the band
157{
158 MAYBE_UNUSED( args... );
159}
161//*************************************************************************************************
162
163
164//*************************************************************************************************
170inline ptrdiff_t BandData<>::band() const noexcept
171{
172 return band_;
173}
175//*************************************************************************************************
176
177
178//*************************************************************************************************
184inline size_t BandData<>::row() const noexcept
185{
186 return row_;
187}
189//*************************************************************************************************
190
191
192//*************************************************************************************************
198inline size_t BandData<>::column() const noexcept
199{
200 return column_;
201}
203//*************************************************************************************************
204
205
206
207
208//=================================================================================================
209//
210// CLASS TEMPLATE SPECIALIZATION FOR ONE COMPILE TIME BAND INDEX
211//
212//=================================================================================================
213
214//*************************************************************************************************
222template< ptrdiff_t I > // Compile time band index
223class BandData<I>
224{
225 public:
226 //**Compile time flags**************************************************************************
228
232 static constexpr bool compileTimeArgs = true;
233 //**********************************************************************************************
234
235 //**Constructors********************************************************************************
238 template< typename... RBAs >
239 explicit inline BandData( RBAs... args );
240
241 BandData( const BandData& ) = default;
243 //**********************************************************************************************
244
245 //**Destructor**********************************************************************************
248 ~BandData() = default;
250 //**********************************************************************************************
251
252 //**Assignment operators************************************************************************
255 BandData& operator=( const BandData& ) = delete;
257 //**********************************************************************************************
258
259 //**Utility functions***************************************************************************
262 static constexpr ptrdiff_t band () noexcept;
263 static constexpr size_t row () noexcept;
264 static constexpr size_t column() noexcept;
266 //**********************************************************************************************
267};
269//*************************************************************************************************
270
271
272//*************************************************************************************************
278template< ptrdiff_t I > // Compile time band index
279template< typename... RBAs > // Optional band arguments
280inline BandData<I>::BandData( RBAs... args )
281{
282 MAYBE_UNUSED( args... );
283}
285//*************************************************************************************************
286
287
288//*************************************************************************************************
294template< ptrdiff_t I > // Compile time band index
295constexpr ptrdiff_t BandData<I>::band() noexcept
296{
297 return I;
298}
300//*************************************************************************************************
301
302
303//*************************************************************************************************
309template< ptrdiff_t I > // Compile time band index
310constexpr size_t BandData<I>::row() noexcept
311{
312 return ( I >= 0L ? 0UL : -I );
313}
315//*************************************************************************************************
316
317
318//*************************************************************************************************
324template< ptrdiff_t I > // Compile time band index
325constexpr size_t BandData<I>::column() noexcept
326{
327 return ( I >= 0L ? I : 0UL );
328}
330//*************************************************************************************************
331
332} // namespace blaze
333
334#endif
Header file for the MAYBE_UNUSED function template.
Auxiliary class template for the data members of the Band class.
Definition: BandData.h:65
Pointer difference type of the Blaze library.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for basic type definitions.