DenseMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DENSEMATRIX_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DENSEMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/shims/Reset.h>
49 #include <blaze/system/Inline.h>
51 #include <blaze/util/DisableIf.h>
52 #include <blaze/util/EnableIf.h>
53 #include <blaze/util/Unused.h>
54 
55 
56 namespace blaze {
57 
58 //=================================================================================================
59 //
60 // CLASS DEFINITION
61 //
62 //=================================================================================================
63 
64 //*************************************************************************************************
78 template< typename MT // Type of the dense matrix
79  , bool SO > // Storage order
81  : public Matrix<MT,SO>
82 {};
83 //*************************************************************************************************
84 
85 
86 
87 
88 //=================================================================================================
89 //
90 // GLOBAL FUNCTIONS
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
97 template< typename MT, bool SO >
99 
100 template< typename MT, bool SO >
101 BLAZE_ALWAYS_INLINE typename MT::ElementType* data( const DenseMatrix<MT,SO>& dm ) noexcept;
102 
103 template< typename MT, bool SO >
104 BLAZE_ALWAYS_INLINE size_t spacing( const DenseMatrix<MT,SO>& dm ) noexcept;
106 //*************************************************************************************************
107 
108 
109 //*************************************************************************************************
120 template< typename MT // Type of the matrix
121  , bool SO > // Storage order of the matrix
123  data_backend( DenseMatrix<MT,SO>& dm ) noexcept
124 {
125  UNUSED_PARAMETER( dm );
126 
127  return nullptr;
128 }
130 //*************************************************************************************************
131 
132 
133 //*************************************************************************************************
143 template< typename MT // Type of the matrix
144  , bool SO > // Storage order of the matrix
146  data_backend( DenseMatrix<MT,SO>& dm ) noexcept
147 {
148  return (~dm).data();
149 }
151 //*************************************************************************************************
152 
153 
154 //*************************************************************************************************
167 template< typename MT // Type of the matrix
168  , bool SO > // Storage order of the matrix
170 {
171  return data_backend( ~dm );
172 }
173 //*************************************************************************************************
174 
175 
176 //*************************************************************************************************
187 template< typename MT // Type of the matrix
188  , bool SO > // Storage order of the matrix
190  data_backend( const DenseMatrix<MT,SO>& dm ) noexcept
191 {
192  UNUSED_PARAMETER( dm );
193 
194  return nullptr;
195 }
197 //*************************************************************************************************
198 
199 
200 //*************************************************************************************************
210 template< typename MT // Type of the matrix
211  , bool SO > // Storage order of the matrix
213  data_backend( const DenseMatrix<MT,SO>& dm ) noexcept
214 {
215  return (~dm).data();
216 }
218 //*************************************************************************************************
219 
220 
221 //*************************************************************************************************
234 template< typename MT // Type of the matrix
235  , bool SO > // Storage order of the matrix
237 {
238  return data_backend( ~dm );
239 }
240 //*************************************************************************************************
241 
242 
243 //*************************************************************************************************
250 template< typename MT // Type of the matrix
251  , bool SO > // Storage order of the matrix
252 BLAZE_ALWAYS_INLINE size_t spacing( const DenseMatrix<MT,SO>& dm ) noexcept
253 {
254  return (~dm).spacing();
255 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
270 template< typename MT > // Type of the matrix
271 inline DisableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,false>& dm )
272 {
273  const size_t m( (~dm).rows() );
274  const size_t n( (~dm).columns() );
275 
276  for( size_t i=1UL; i<m; ++i ) {
277  const size_t jend( min( i, n ) );
278  for( size_t j=0UL; j<jend; ++j ) {
279  reset( (~dm)(i,j) );
280  }
281  }
282 }
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
298 template< typename MT > // Type of the matrix
299 inline DisableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,true>& dm )
300 {
301  const size_t m ( (~dm).rows() );
302  const size_t n ( (~dm).columns() );
303  const size_t jend( min( m, n ) );
304 
305  for( size_t j=0UL; j<jend; ++j ) {
306  for( size_t i=j+1UL; i<m; ++i ) {
307  reset( (~dm)(i,j) );
308  }
309  }
310 }
312 //*************************************************************************************************
313 
314 
315 //*************************************************************************************************
325 template< typename MT // Type of the matrix
326  , bool SO > // Storage order of the matrix
327 inline EnableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,SO>& dm )
328 {
329  UNUSED_PARAMETER( dm );
330 }
332 //*************************************************************************************************
333 
334 
335 //*************************************************************************************************
345 template< typename MT // Type of the matrix
346  , bool SO > // Storage order of the matrix
347 inline void resetLower( DenseMatrix<MT,SO>& dm )
348 {
349  resetLower_backend( ~dm );
350 }
352 //*************************************************************************************************
353 
354 
355 //*************************************************************************************************
366 template< typename MT > // Type of the matrix
367 inline DisableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,false>& dm )
368 {
369  const size_t m ( (~dm).rows() );
370  const size_t n ( (~dm).columns() );
371  const size_t iend( min( m, n ) );
372 
373  for( size_t i=0UL; i<iend; ++i ) {
374  for( size_t j=i+1UL; j<n; ++j ) {
375  reset( (~dm)(i,j) );
376  }
377  }
378 }
380 //*************************************************************************************************
381 
382 
383 //*************************************************************************************************
394 template< typename MT > // Type of the matrix
395 inline DisableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,true>& dm )
396 {
397  const size_t m( (~dm).rows() );
398  const size_t n( (~dm).columns() );
399 
400  for( size_t j=1UL; j<n; ++j ) {
401  const size_t iend( min( j, m ) );
402  for( size_t i=0UL; i<iend; ++i ) {
403  reset( (~dm)(i,j) );
404  }
405  }
406 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
421 template< typename MT // Type of the matrix
422  , bool SO > // Storage order of the matrix
423 inline EnableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,SO>& dm )
424 {
425  UNUSED_PARAMETER( dm );
426 }
428 //*************************************************************************************************
429 
430 
431 //*************************************************************************************************
441 template< typename MT // Type of the matrix
442  , bool SO > // Storage order of the matrix
443 inline void resetUpper( DenseMatrix<MT,SO>& dm )
444 {
445  resetUpper_backend( ~dm );
446 }
448 //*************************************************************************************************
449 
450 } // namespace blaze
451 
452 #endif
Headerfile for the generic min algorithm.
Header file for the UNUSED_PARAMETER function template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
Header file for the IsLower type trait.
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
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the Matrix base class.
Header file for the reset shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Header file for the HasMutableDataAccess type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
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
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
System settings for the inline keywords.