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 
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< ptrdiff_t... CBAs > // Compile time band arguments
64 struct BandData
65 {};
66 //*************************************************************************************************
67 
68 
69 
70 
71 //=================================================================================================
72 //
73 // CLASS TEMPLATE SPECIALIZATION FOR ZERO COMPILE TIME BAND INDICES
74 //
75 //=================================================================================================
76 
77 //*************************************************************************************************
85 template<>
86 struct BandData<>
87 {
88  public:
89  //**Constructors********************************************************************************
92  template< typename... RBAs >
93  explicit inline BandData( ptrdiff_t index, RBAs... args );
94 
95  BandData( const BandData& ) = default;
97  //**********************************************************************************************
98 
99  //**Destructor**********************************************************************************
102  ~BandData() = default;
104  //**********************************************************************************************
105 
106  //**Assignment operators************************************************************************
109  BandData& operator=( const BandData& ) = delete;
111  //**********************************************************************************************
112 
113  //**Utility functions***************************************************************************
116  inline ptrdiff_t band () const noexcept;
117  inline size_t row () const noexcept;
118  inline size_t column() const noexcept;
120  //**********************************************************************************************
121 
122  private:
123  //**Member variables****************************************************************************
126  const ptrdiff_t band_;
127  const size_t row_;
128  const size_t column_;
129 
130  //**********************************************************************************************
131 };
133 //*************************************************************************************************
134 
135 
136 //*************************************************************************************************
143 template< typename... RBAs > // Optional band arguments
144 inline BandData<>::BandData( ptrdiff_t index, RBAs... args )
145  : band_ ( index ) // The band index
146  , row_ ( index >= 0L ? 0UL : -index ) // The index of the row containing the first element of the band
147  , column_( index >= 0L ? index : 0UL ) // The index of the column containing the first element of the band
148 {
149  UNUSED_PARAMETER( args... );
150 }
152 //*************************************************************************************************
153 
154 
155 //*************************************************************************************************
161 inline ptrdiff_t BandData<>::band() const noexcept
162 {
163  return band_;
164 }
166 //*************************************************************************************************
167 
168 
169 //*************************************************************************************************
175 inline size_t BandData<>::row() const noexcept
176 {
177  return row_;
178 }
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
189 inline size_t BandData<>::column() const noexcept
190 {
191  return column_;
192 }
194 //*************************************************************************************************
195 
196 
197 
198 
199 //=================================================================================================
200 //
201 // CLASS TEMPLATE SPECIALIZATION FOR ONE COMPILE TIME BAND INDEX
202 //
203 //=================================================================================================
204 
205 //*************************************************************************************************
213 template< ptrdiff_t I > // Compile time band index
214 struct BandData<I>
215 {
216  public:
217  //**Constructors********************************************************************************
220  template< typename... RBAs >
221  explicit inline BandData( RBAs... args );
222 
223  BandData( const BandData& ) = default;
225  //**********************************************************************************************
226 
227  //**Destructor**********************************************************************************
230  ~BandData() = default;
232  //**********************************************************************************************
233 
234  //**Assignment operators************************************************************************
237  BandData& operator=( const BandData& ) = delete;
239  //**********************************************************************************************
240 
241  //**Utility functions***************************************************************************
244  static inline constexpr ptrdiff_t band () noexcept;
245  static inline constexpr size_t row () noexcept;
246  static inline constexpr size_t column() noexcept;
248  //**********************************************************************************************
249 };
251 //*************************************************************************************************
252 
253 
254 //*************************************************************************************************
260 template< ptrdiff_t I > // Compile time band index
261 template< typename... RBAs > // Optional band arguments
262 inline BandData<I>::BandData( RBAs... args )
263 {
264  UNUSED_PARAMETER( args... );
265 }
267 //*************************************************************************************************
268 
269 
270 //*************************************************************************************************
276 template< ptrdiff_t I > // Compile time band index
277 inline constexpr ptrdiff_t BandData<I>::band() noexcept
278 {
279  return I;
280 }
282 //*************************************************************************************************
283 
284 
285 //*************************************************************************************************
291 template< ptrdiff_t I > // Compile time band index
292 inline constexpr size_t BandData<I>::row() noexcept
293 {
294  return ( I >= 0L ? 0UL : -I );
295 }
297 //*************************************************************************************************
298 
299 
300 //*************************************************************************************************
306 template< ptrdiff_t I > // Compile time band index
307 inline constexpr size_t BandData<I>::column() noexcept
308 {
309  return ( I >= 0L ? I : 0UL );
310 }
312 //*************************************************************************************************
313 
314 } // namespace blaze
315 
316 #endif
Pointer difference type of the Blaze library.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
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
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Auxiliary class template for the data members of the Band class.The auxiliary BandData class template...
Definition: BandData.h:64