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  // No explicitly declared copy constructor.
96  //**********************************************************************************************
97 
98  //**Destructor**********************************************************************************
99  // No explicitly declared destructor.
100  //**********************************************************************************************
101 
102  //**Assignment operators************************************************************************
103  BandData& operator=( const BandData& ) = delete;
104  //**********************************************************************************************
105 
106  //**Utility functions***************************************************************************
109  inline ptrdiff_t band () const noexcept;
110  inline size_t row () const noexcept;
111  inline size_t column() const noexcept;
113  //**********************************************************************************************
114 
115  private:
116  //**Member variables****************************************************************************
119  const ptrdiff_t band_;
120  const size_t row_;
121  const size_t column_;
122 
123  //**********************************************************************************************
124 };
126 //*************************************************************************************************
127 
128 
129 //*************************************************************************************************
136 template< typename... RBAs > // Optional band arguments
137 inline BandData<>::BandData( ptrdiff_t index, RBAs... args )
138  : band_ ( index ) // The band index
139  , row_ ( index >= 0L ? 0UL : -index ) // The index of the row containing the first element of the band
140  , column_( index >= 0L ? index : 0UL ) // The index of the column containing the first element of the band
141 {
142  UNUSED_PARAMETER( args... );
143 }
145 //*************************************************************************************************
146 
147 
148 //*************************************************************************************************
154 inline ptrdiff_t BandData<>::band() const noexcept
155 {
156  return band_;
157 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
168 inline size_t BandData<>::row() const noexcept
169 {
170  return row_;
171 }
173 //*************************************************************************************************
174 
175 
176 //*************************************************************************************************
182 inline size_t BandData<>::column() const noexcept
183 {
184  return column_;
185 }
187 //*************************************************************************************************
188 
189 
190 
191 
192 //=================================================================================================
193 //
194 // CLASS TEMPLATE SPECIALIZATION FOR ONE COMPILE TIME BAND INDEX
195 //
196 //=================================================================================================
197 
198 //*************************************************************************************************
206 template< ptrdiff_t I > // Compile time band index
207 struct BandData<I>
208 {
209  public:
210  //**Constructors********************************************************************************
213  template< typename... RBAs >
214  explicit inline BandData( RBAs... args );
215  // No explicitly declared copy constructor.
217  //**********************************************************************************************
218 
219  //**Destructor**********************************************************************************
220  // No explicitly declared destructor.
221  //**********************************************************************************************
222 
223  //**Assignment operators************************************************************************
224  BandData& operator=( const BandData& ) = delete;
225  //**********************************************************************************************
226 
227  //**Utility functions***************************************************************************
230  static inline constexpr ptrdiff_t band () noexcept;
231  static inline constexpr size_t row () noexcept;
232  static inline constexpr size_t column() noexcept;
234  //**********************************************************************************************
235 };
237 //*************************************************************************************************
238 
239 
240 //*************************************************************************************************
246 template< ptrdiff_t I > // Compile time band index
247 template< typename... RBAs > // Optional band arguments
248 inline BandData<I>::BandData( RBAs... args )
249 {
250  UNUSED_PARAMETER( args... );
251 }
253 //*************************************************************************************************
254 
255 
256 //*************************************************************************************************
262 template< ptrdiff_t I > // Compile time band index
263 inline constexpr ptrdiff_t BandData<I>::band() noexcept
264 {
265  return I;
266 }
268 //*************************************************************************************************
269 
270 
271 //*************************************************************************************************
277 template< ptrdiff_t I > // Compile time band index
278 inline constexpr size_t BandData<I>::row() noexcept
279 {
280  return ( I >= 0L ? 0UL : -I );
281 }
283 //*************************************************************************************************
284 
285 
286 //*************************************************************************************************
292 template< ptrdiff_t I > // Compile time band index
293 inline constexpr size_t BandData<I>::column() noexcept
294 {
295  return ( I >= 0L ? I : 0UL );
296 }
298 //*************************************************************************************************
299 
300 } // namespace blaze
301 
302 #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:131
Header file for the UNUSED_PARAMETER function template.
Header file for basic type definitions.
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:134
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Auxiliary class template for the data members of the Band class.The auxiliary BandData class template...
Definition: BandData.h:64