Blaze 3.9
StrictlyLowerProxy.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_STRICTLYLOWERPROXY_H_
36#define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_STRICTLYLOWERPROXY_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
66#include <blaze/util/Types.h>
67
68
69namespace blaze {
70
71//=================================================================================================
72//
73// CLASS DEFINITION
74//
75//=================================================================================================
76
77//*************************************************************************************************
99template< typename MT > // Type of the adapted matrix
101 : public Proxy< StrictlyLowerProxy<MT>, ElementType_t<MT> >
102{
103 private:
104 //**Type definitions****************************************************************************
107 //**********************************************************************************************
108
109 public:
110 //**Type definitions****************************************************************************
114 //**********************************************************************************************
115
116 //**Constructors********************************************************************************
119 inline StrictlyLowerProxy( MT& matrix, size_t row, size_t column );
120
121 StrictlyLowerProxy( const StrictlyLowerProxy& ) = default;
123 //**********************************************************************************************
124
125 //**Destructor**********************************************************************************
128 ~StrictlyLowerProxy() = default;
130 //**********************************************************************************************
131
132 //**Assignment operators************************************************************************
135 inline const StrictlyLowerProxy& operator=( const StrictlyLowerProxy& ulp ) const;
136
137 template< typename T >
138 inline const StrictlyLowerProxy& operator=( initializer_list<T> list ) const;
139
140 template< typename T >
141 inline const StrictlyLowerProxy& operator=( initializer_list< initializer_list<T> > list ) const;
142
143 template< typename T > inline const StrictlyLowerProxy& operator= ( const T& value ) const;
144 template< typename T > inline const StrictlyLowerProxy& operator+=( const T& value ) const;
145 template< typename T > inline const StrictlyLowerProxy& operator-=( const T& value ) const;
146 template< typename T > inline const StrictlyLowerProxy& operator*=( const T& value ) const;
147 template< typename T > inline const StrictlyLowerProxy& operator/=( const T& value ) const;
148 template< typename T > inline const StrictlyLowerProxy& operator%=( const T& value ) const;
150 //**********************************************************************************************
151
152 //**Access operators****************************************************************************
155 inline const StrictlyLowerProxy* operator->() const noexcept;
157 //**********************************************************************************************
158
159 //**Utility functions***************************************************************************
162 inline RawReference get() const noexcept;
163 inline bool isRestricted() const noexcept;
165 //**********************************************************************************************
166
167 //**Conversion operator*************************************************************************
170 inline operator ConstReference() const noexcept;
172 //**********************************************************************************************
173
174 private:
175 //**Member variables****************************************************************************
179 const bool restricted_;
184 //**********************************************************************************************
185
186 //**Compile time checks*************************************************************************
201 //**********************************************************************************************
202};
203//*************************************************************************************************
204
205
206
207
208//=================================================================================================
209//
210// CONSTRUCTORS
211//
212//=================================================================================================
213
214//*************************************************************************************************
221template< typename MT > // Type of the adapted matrix
222inline StrictlyLowerProxy<MT>::StrictlyLowerProxy( MT& matrix, size_t row, size_t column )
223 : value_ ( matrix( row, column ) ) // Reference to the accessed matrix element
224 , restricted_( row <= column ) // Access flag for the accessed matrix element
225{}
226//*************************************************************************************************
227
228
229
230
231//=================================================================================================
232//
233// OPERATORS
234//
235//=================================================================================================
236
237//*************************************************************************************************
247template< typename MT > // Type of the adapted matrix
248inline const StrictlyLowerProxy<MT>&
250{
251 if( restricted_ ) {
252 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
253 }
254
255 value_ = slp.value_;
256
257 return *this;
258}
259//*************************************************************************************************
260
261
262//*************************************************************************************************
272template< typename MT > // Type of the adapted matrix
273template< typename T > // Type of the right-hand side value
274inline const StrictlyLowerProxy<MT>&
275 StrictlyLowerProxy<MT>::operator=( initializer_list<T> list ) const
276{
277 if( restricted_ ) {
278 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
279 }
280
281 value_ = list;
282
283 return *this;
284}
285//*************************************************************************************************
286
287
288//*************************************************************************************************
298template< typename MT > // Type of the adapted matrix
299template< typename T > // Type of the right-hand side value
300inline const StrictlyLowerProxy<MT>&
301 StrictlyLowerProxy<MT>::operator=( initializer_list< initializer_list<T> > list ) const
302{
303 if( restricted_ ) {
304 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
305 }
306
307 value_ = list;
308
309 return *this;
310}
311//*************************************************************************************************
312
313
314//*************************************************************************************************
324template< typename MT > // Type of the adapted matrix
325template< typename T > // Type of the right-hand side value
327{
328 if( restricted_ ) {
329 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
330 }
331
332 value_ = value;
333
334 return *this;
335}
336//*************************************************************************************************
337
338
339//*************************************************************************************************
349template< typename MT > // Type of the adapted matrix
350template< typename T > // Type of the right-hand side value
352{
353 if( restricted_ ) {
354 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
355 }
356
357 value_ += value;
358
359 return *this;
360}
361//*************************************************************************************************
362
363
364//*************************************************************************************************
374template< typename MT > // Type of the adapted matrix
375template< typename T > // Type of the right-hand side value
377{
378 if( restricted_ ) {
379 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
380 }
381
382 value_ -= value;
383
384 return *this;
385}
386//*************************************************************************************************
387
388
389//*************************************************************************************************
399template< typename MT > // Type of the adapted matrix
400template< typename T > // Type of the right-hand side value
402{
403 if( restricted_ ) {
404 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
405 }
406
407 value_ *= value;
408
409 return *this;
410}
411//*************************************************************************************************
412
413
414//*************************************************************************************************
424template< typename MT > // Type of the adapted matrix
425template< typename T > // Type of the right-hand side value
427{
428 if( restricted_ ) {
429 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
430 }
431
432 value_ /= value;
433
434 return *this;
435}
436//*************************************************************************************************
437
438
439//*************************************************************************************************
449template< typename MT > // Type of the adapted matrix
450template< typename T > // Type of the right-hand side value
452{
453 if( restricted_ ) {
454 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or upper matrix element" );
455 }
456
457 value_ %= value;
458
459 return *this;
460}
461//*************************************************************************************************
462
463
464
465
466//=================================================================================================
467//
468// ACCESS OPERATORS
469//
470//=================================================================================================
471
472//*************************************************************************************************
477template< typename MT > // Type of the adapted matrix
479{
480 return this;
481}
482//*************************************************************************************************
483
484
485
486
487//=================================================================================================
488//
489// UTILITY FUNCTIONS
490//
491//=================================================================================================
492
493//*************************************************************************************************
498template< typename MT > // Type of the adapted matrix
500{
501 return value_;
502}
503//*************************************************************************************************
504
505
506//*************************************************************************************************
511template< typename MT > // Type of the adapted matrix
512inline bool StrictlyLowerProxy<MT>::isRestricted() const noexcept
513{
514 return restricted_;
515}
516//*************************************************************************************************
517
518
519
520
521//=================================================================================================
522//
523// CONVERSION OPERATOR
524//
525//=================================================================================================
526
527//*************************************************************************************************
532template< typename MT > // Type of the adapted matrix
534{
535 return static_cast<ConstReference>( value_ );
536}
537//*************************************************************************************************
538
539} // namespace blaze
540
541#endif
Header file for the AddConst type trait.
Header file for the AddLValueReference type trait.
Header file for auxiliary alias declarations.
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
Constraint on the data type.
Constraint on the data type.
Header file for the isDefault shim.
Header file for the isOne shim.
Header file for the isReal shim.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Proxy base class.
Definition: Proxy.h:169
Access proxy for strictly lower triangular matrices.
Definition: StrictlyLowerProxy.h:102
ReferenceType value_
Reference to the accessed matrix element.
Definition: StrictlyLowerProxy.h:178
ElementType_t< MT > RepresentedType
Type of the represented matrix element.
Definition: StrictlyLowerProxy.h:111
bool isRestricted() const noexcept
Returns whether the proxy represents a restricted matrix element..
Definition: StrictlyLowerProxy.h:512
const bool restricted_
Access flag for the accessed matrix element.
Definition: StrictlyLowerProxy.h:179
StrictlyLowerProxy(MT &matrix, size_t row, size_t column)
Initialization constructor for an StrictlyLowerProxy.
Definition: StrictlyLowerProxy.h:222
const StrictlyLowerProxy & operator=(const StrictlyLowerProxy &ulp) const
Copy assignment operator for StrictlyLowerProxy.
Definition: StrictlyLowerProxy.h:249
RawReference get() const noexcept
Returning the value of the accessed matrix element.
Definition: StrictlyLowerProxy.h:499
AddLValueReference_t< ReferenceType > RawReference
Reference-to-non-const to the represented element.
Definition: StrictlyLowerProxy.h:112
AddConst_t< Reference_t< MT > > ReferenceType
Reference type of the underlying matrix type.
Definition: StrictlyLowerProxy.h:106
const RepresentedType & ConstReference
Reference-to-const to the represented element.
Definition: StrictlyLowerProxy.h:113
const StrictlyLowerProxy * operator->() const noexcept
Direct access to the accessed matrix element.
Definition: StrictlyLowerProxy.h:478
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition: Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition: Const.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Matrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.
Definition: View.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Hermitian.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Upper.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.
Definition: Transformation.h:81
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
typename AddConst< T >::Type AddConst_t
Auxiliary alias declaration for the AddConst type trait.
Definition: AddConst.h:95
typename AddLValueReference< T >::Type AddLValueReference_t
Auxiliary alias declaration for the AddLValueReference type trait.
Definition: AddLValueReference.h:97
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Header file for the Proxy class.
Header file for the isZero shim.
Header file for basic type definitions.