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>
47 #include <blaze/system/Inline.h>
49 #include <blaze/util/DisableIf.h>
50 #include <blaze/util/EnableIf.h>
51 #include <blaze/util/Unused.h>
52 
53 
54 namespace blaze {
55 
56 //=================================================================================================
57 //
58 // CLASS DEFINITION
59 //
60 //=================================================================================================
61 
62 //*************************************************************************************************
76 template< typename MT // Type of the dense matrix
77  , bool SO > // Storage order
79  : public Matrix<MT,SO>
80 {};
81 //*************************************************************************************************
82 
83 
84 
85 
86 //=================================================================================================
87 //
88 // GLOBAL FUNCTIONS
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
95 template< typename MT, bool SO >
96 BLAZE_ALWAYS_INLINE size_t spacing( const DenseMatrix<MT,SO>& dm ) noexcept;
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
108 template< typename MT // Type of the matrix
109  , bool SO > // Storage order of the matrix
110 BLAZE_ALWAYS_INLINE size_t spacing( const DenseMatrix<MT,SO>& dm ) noexcept
111 {
112  return (~dm).spacing();
113 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
128 template< typename MT > // Type of the matrix
129 inline DisableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,false>& dm )
130 {
131  const size_t m( (~dm).rows() );
132  const size_t n( (~dm).columns() );
133 
134  for( size_t i=1UL; i<m; ++i ) {
135  const size_t jend( min( i, n ) );
136  for( size_t j=0UL; j<jend; ++j ) {
137  reset( (~dm)(i,j) );
138  }
139  }
140 }
142 //*************************************************************************************************
143 
144 
145 //*************************************************************************************************
156 template< typename MT > // Type of the matrix
157 inline DisableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,true>& dm )
158 {
159  const size_t m ( (~dm).rows() );
160  const size_t n ( (~dm).columns() );
161  const size_t jend( min( m, n ) );
162 
163  for( size_t j=0UL; j<jend; ++j ) {
164  for( size_t i=j+1UL; i<m; ++i ) {
165  reset( (~dm)(i,j) );
166  }
167  }
168 }
170 //*************************************************************************************************
171 
172 
173 //*************************************************************************************************
183 template< typename MT // Type of the matrix
184  , bool SO > // Storage order of the matrix
185 inline EnableIf_< IsUpper<MT> > resetLower_backend( DenseMatrix<MT,SO>& dm )
186 {
187  UNUSED_PARAMETER( dm );
188 }
190 //*************************************************************************************************
191 
192 
193 //*************************************************************************************************
203 template< typename MT // Type of the matrix
204  , bool SO > // Storage order of the matrix
205 inline void resetLower( DenseMatrix<MT,SO>& dm )
206 {
207  resetLower_backend( ~dm );
208 }
210 //*************************************************************************************************
211 
212 
213 //*************************************************************************************************
224 template< typename MT > // Type of the matrix
225 inline DisableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,false>& dm )
226 {
227  const size_t m ( (~dm).rows() );
228  const size_t n ( (~dm).columns() );
229  const size_t iend( min( m, n ) );
230 
231  for( size_t i=0UL; i<iend; ++i ) {
232  for( size_t j=i+1UL; j<n; ++j ) {
233  reset( (~dm)(i,j) );
234  }
235  }
236 }
238 //*************************************************************************************************
239 
240 
241 //*************************************************************************************************
252 template< typename MT > // Type of the matrix
253 inline DisableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,true>& dm )
254 {
255  const size_t m( (~dm).rows() );
256  const size_t n( (~dm).columns() );
257 
258  for( size_t j=1UL; j<n; ++j ) {
259  const size_t iend( min( j, m ) );
260  for( size_t i=0UL; i<iend; ++i ) {
261  reset( (~dm)(i,j) );
262  }
263  }
264 }
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
279 template< typename MT // Type of the matrix
280  , bool SO > // Storage order of the matrix
281 inline EnableIf_< IsLower<MT> > resetUpper_backend( DenseMatrix<MT,SO>& dm )
282 {
283  UNUSED_PARAMETER( dm );
284 }
286 //*************************************************************************************************
287 
288 
289 //*************************************************************************************************
299 template< typename MT // Type of the matrix
300  , bool SO > // Storage order of the matrix
301 inline void resetUpper( DenseMatrix<MT,SO>& dm )
302 {
303  resetUpper_backend( ~dm );
304 }
306 //*************************************************************************************************
307 
308 } // namespace blaze
309 
310 #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:560
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:1762
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:78
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:110
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
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:340
Header file for the EnableIf class template.
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
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:324
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.