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 
96  SubmatrixData( const SubmatrixData& ) = default;
98  //**********************************************************************************************
99 
100  //**Destructor**********************************************************************************
103  ~SubmatrixData() = default;
105  //**********************************************************************************************
106 
107  //**Assignment operators************************************************************************
110  SubmatrixData& operator=( const SubmatrixData& ) = delete;
112  //**********************************************************************************************
113 
114  //**Utility functions***************************************************************************
117  inline size_t row () const noexcept;
118  inline size_t column () const noexcept;
119  inline size_t rows () const noexcept;
120  inline size_t columns() const noexcept;
122  //**********************************************************************************************
123 
124  private:
125  //**Member variables****************************************************************************
128  const size_t row_;
129  const size_t column_;
130  const size_t m_;
131  const size_t n_;
132 
133  //**********************************************************************************************
134 };
136 //*************************************************************************************************
137 
138 
139 //*************************************************************************************************
149 template< typename... RSAs > // Optional submatrix arguments
150 inline SubmatrixData<>::SubmatrixData( size_t rindex, size_t cindex, size_t m, size_t n, RSAs... args )
151  : row_ ( rindex ) // The first row of the submatrix
152  , column_( cindex ) // The first column of the submatrix
153  , m_ ( m ) // The number of rows of the submatrix
154  , n_ ( n ) // The number of columns of the submatrix
155 {
156  UNUSED_PARAMETER( args... );
157 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
168 inline size_t SubmatrixData<>::row() const noexcept
169 {
170  return row_;
171 }
173 //*************************************************************************************************
174 
175 
176 //*************************************************************************************************
182 inline size_t SubmatrixData<>::column() const noexcept
183 {
184  return column_;
185 }
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
196 inline size_t SubmatrixData<>::rows() const noexcept
197 {
198  return m_;
199 }
201 //*************************************************************************************************
202 
203 
204 //*************************************************************************************************
210 inline size_t SubmatrixData<>::columns() const noexcept
211 {
212  return n_;
213 }
215 //*************************************************************************************************
216 
217 
218 
219 
220 //=================================================================================================
221 //
222 // CLASS TEMPLATE SPECIALIZATION FOR FOUR COMPILE TIME ARGUMENTS
223 //
224 //=================================================================================================
225 
226 //*************************************************************************************************
235 template< size_t I // Index of the first row
236  , size_t J // Index of the first column
237  , size_t M // Number of rows
238  , size_t N > // Number of columns
239 struct SubmatrixData<I,J,M,N>
240 {
241  public:
242  //**Constructors********************************************************************************
245  template< typename... RSAs >
246  explicit inline SubmatrixData( RSAs... args );
247 
248  SubmatrixData( const SubmatrixData& ) = default;
250  //**********************************************************************************************
251 
252  //**Destructor**********************************************************************************
255  ~SubmatrixData() = default;
257  //**********************************************************************************************
258 
259  //**Assignment operators************************************************************************
262  SubmatrixData& operator=( const SubmatrixData& ) = delete;
264  //**********************************************************************************************
265 
266  //**Utility functions***************************************************************************
269  static inline constexpr size_t row () noexcept;
270  static inline constexpr size_t column () noexcept;
271  static inline constexpr size_t rows () noexcept;
272  static inline constexpr size_t columns() noexcept;
274  //**********************************************************************************************
275 };
277 //*************************************************************************************************
278 
279 
280 //*************************************************************************************************
286 template< size_t I // Index of the first row
287  , size_t J // Index of the first column
288  , size_t M // Number of rows
289  , size_t N > // Number of columns
290 template< typename... RSAs > // Optional submatrix arguments
291 inline SubmatrixData<I,J,M,N>::SubmatrixData( RSAs... args )
292 {
293  UNUSED_PARAMETER( args... );
294 }
296 //*************************************************************************************************
297 
298 
299 //*************************************************************************************************
305 template< size_t I // Index of the first row
306  , size_t J // Index of the first column
307  , size_t M // Number of rows
308  , size_t N > // Number of columns
309 inline constexpr size_t SubmatrixData<I,J,M,N>::row() noexcept
310 {
311  return I;
312 }
314 //*************************************************************************************************
315 
316 
317 //*************************************************************************************************
323 template< size_t I // Index of the first row
324  , size_t J // Index of the first column
325  , size_t M // Number of rows
326  , size_t N > // Number of columns
327 inline constexpr size_t SubmatrixData<I,J,M,N>::column() noexcept
328 {
329  return J;
330 }
332 //*************************************************************************************************
333 
334 
335 //*************************************************************************************************
341 template< size_t I // Index of the first row
342  , size_t J // Index of the first column
343  , size_t M // Number of rows
344  , size_t N > // Number of columns
345 inline constexpr size_t SubmatrixData<I,J,M,N>::rows() noexcept
346 {
347  return M;
348 }
350 //*************************************************************************************************
351 
352 
353 //*************************************************************************************************
359 template< size_t I // Index of the first row
360  , size_t J // Index of the first column
361  , size_t M // Number of rows
362  , size_t N > // Number of columns
363 inline constexpr size_t SubmatrixData<I,J,M,N>::columns() noexcept
364 {
365  return N;
366 }
368 //*************************************************************************************************
369 
370 } // namespace blaze
371 
372 #endif
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.
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3289
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3290
Auxiliary class template for the data members of the Submatrix class.The auxiliary SubmatrixData clas...
Definition: SubmatrixData.h:64