SubmatrixData.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_SUBMATRIX_SUBMATRIXDATA_H_
36 #define _BLAZE_MATH_VIEWS_SUBMATRIX_SUBMATRIXDATA_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 submatrix 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 SubmatrixData<>
88 {
89  public:
90  //**Constructors********************************************************************************
93  template< typename... RSAs >
94  explicit inline SubmatrixData( size_t rindex, size_t cindex, size_t m, size_t n, RSAs... args );
95  // No explicitly declared copy constructor.
97  //**********************************************************************************************
98 
99  //**Destructor**********************************************************************************
100  // No explicitly declared destructor.
101  //**********************************************************************************************
102 
103  //**Assignment operators************************************************************************
104  SubmatrixData& operator=( const SubmatrixData& ) = delete;
105  //**********************************************************************************************
106 
107  //**Utility functions***************************************************************************
110  inline size_t row () const noexcept;
111  inline size_t column () const noexcept;
112  inline size_t rows () const noexcept;
113  inline size_t columns() const noexcept;
115  //**********************************************************************************************
116 
117  private:
118  //**Member variables****************************************************************************
121  const size_t row_;
122  const size_t column_;
123  const size_t m_;
124  const size_t n_;
125 
126  //**********************************************************************************************
127 };
129 //*************************************************************************************************
130 
131 
132 //*************************************************************************************************
142 template< typename... RSAs > // Optional submatrix arguments
143 inline SubmatrixData<>::SubmatrixData( size_t rindex, size_t cindex, size_t m, size_t n, RSAs... args )
144  : row_ ( rindex ) // The first row of the submatrix
145  , column_( cindex ) // The first column of the submatrix
146  , m_ ( m ) // The number of rows of the submatrix
147  , n_ ( n ) // The number of columns of the submatrix
148 {
149  UNUSED_PARAMETER( args... );
150 }
152 //*************************************************************************************************
153 
154 
155 //*************************************************************************************************
161 inline size_t SubmatrixData<>::row() const noexcept
162 {
163  return row_;
164 }
166 //*************************************************************************************************
167 
168 
169 //*************************************************************************************************
175 inline size_t SubmatrixData<>::column() const noexcept
176 {
177  return column_;
178 }
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
189 inline size_t SubmatrixData<>::rows() const noexcept
190 {
191  return m_;
192 }
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
203 inline size_t SubmatrixData<>::columns() const noexcept
204 {
205  return n_;
206 }
208 //*************************************************************************************************
209 
210 
211 
212 
213 //=================================================================================================
214 //
215 // CLASS TEMPLATE SPECIALIZATION FOR FOUR COMPILE TIME ARGUMENTS
216 //
217 //=================================================================================================
218 
219 //*************************************************************************************************
228 template< size_t I // Index of the first row
229  , size_t J // Index of the first column
230  , size_t M // Number of rows
231  , size_t N > // Number of columns
232 struct SubmatrixData<I,J,M,N>
233 {
234  public:
235  //**Constructors********************************************************************************
238  template< typename... RSAs >
239  explicit inline SubmatrixData( RSAs... args );
240  // No explicitly declared copy constructor.
242  //**********************************************************************************************
243 
244  //**Destructor**********************************************************************************
245  // No explicitly declared destructor.
246  //**********************************************************************************************
247 
248  //**Assignment operators************************************************************************
249  SubmatrixData& operator=( const SubmatrixData& ) = delete;
250  //**********************************************************************************************
251 
252  //**Utility functions***************************************************************************
255  static inline constexpr size_t row () noexcept;
256  static inline constexpr size_t column () noexcept;
257  static inline constexpr size_t rows () noexcept;
258  static inline constexpr size_t columns() noexcept;
260  //**********************************************************************************************
261 };
263 //*************************************************************************************************
264 
265 
266 //*************************************************************************************************
272 template< size_t I // Index of the first row
273  , size_t J // Index of the first column
274  , size_t M // Number of rows
275  , size_t N > // Number of columns
276 template< typename... RSAs > // Optional submatrix arguments
277 inline SubmatrixData<I,J,M,N>::SubmatrixData( RSAs... args )
278 {
279  UNUSED_PARAMETER( args... );
280 }
282 //*************************************************************************************************
283 
284 
285 //*************************************************************************************************
291 template< size_t I // Index of the first row
292  , size_t J // Index of the first column
293  , size_t M // Number of rows
294  , size_t N > // Number of columns
295 inline constexpr size_t SubmatrixData<I,J,M,N>::row() noexcept
296 {
297  return I;
298 }
300 //*************************************************************************************************
301 
302 
303 //*************************************************************************************************
309 template< size_t I // Index of the first row
310  , size_t J // Index of the first column
311  , size_t M // Number of rows
312  , size_t N > // Number of columns
313 inline constexpr size_t SubmatrixData<I,J,M,N>::column() noexcept
314 {
315  return J;
316 }
318 //*************************************************************************************************
319 
320 
321 //*************************************************************************************************
327 template< size_t I // Index of the first row
328  , size_t J // Index of the first column
329  , size_t M // Number of rows
330  , size_t N > // Number of columns
331 inline constexpr size_t SubmatrixData<I,J,M,N>::rows() noexcept
332 {
333  return M;
334 }
336 //*************************************************************************************************
337 
338 
339 //*************************************************************************************************
345 template< size_t I // Index of the first row
346  , size_t J // Index of the first column
347  , size_t M // Number of rows
348  , size_t N > // Number of columns
349 inline constexpr size_t SubmatrixData<I,J,M,N>::columns() noexcept
350 {
351  return N;
352 }
354 //*************************************************************************************************
355 
356 } // namespace blaze
357 
358 #endif
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.
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3288
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3289
Auxiliary class template for the data members of the Submatrix class.The auxiliary SubmatrixData clas...
Definition: SubmatrixData.h:64
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81