Blaze 3.9
StrictlyUpperProxy.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_UPPERPROXY_H_
36#define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_UPPERPROXY_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< StrictlyUpperProxy<MT>, ElementType_t<MT> >
102{
103 private:
104 //**Type definitions****************************************************************************
107 //**********************************************************************************************
108
109 public:
110 //**Type definitions****************************************************************************
114 //**********************************************************************************************
115
116 //**Constructors********************************************************************************
119 inline StrictlyUpperProxy( MT& matrix, size_t row, size_t column );
120
121 StrictlyUpperProxy( const StrictlyUpperProxy& ) = default;
123 //**********************************************************************************************
124
125 //**Destructor**********************************************************************************
128 ~StrictlyUpperProxy() = default;
130 //**********************************************************************************************
131
132 //**Assignment operators************************************************************************
135 inline const StrictlyUpperProxy& operator= ( const StrictlyUpperProxy& uup ) const;
136
137 template< typename T >
138 inline const StrictlyUpperProxy& operator=( initializer_list<T> list ) const;
139
140 template< typename T >
141 inline const StrictlyUpperProxy& operator=( initializer_list< initializer_list<T> > list ) const;
142
143 template< typename T > inline const StrictlyUpperProxy& operator= ( const T& value ) const;
144 template< typename T > inline const StrictlyUpperProxy& operator+=( const T& value ) const;
145 template< typename T > inline const StrictlyUpperProxy& operator-=( const T& value ) const;
146 template< typename T > inline const StrictlyUpperProxy& operator*=( const T& value ) const;
147 template< typename T > inline const StrictlyUpperProxy& operator/=( const T& value ) const;
148 template< typename T > inline const StrictlyUpperProxy& operator%=( const T& value ) const;
150 //**********************************************************************************************
151
152 //**Access operators****************************************************************************
155 inline const StrictlyUpperProxy* 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 StrictlyUpperProxy<MT>::StrictlyUpperProxy( MT& matrix, size_t row, size_t column )
223 : value_ ( matrix( row, column ) ) // Reference to the accessed matrix element
224 , restricted_( column <= row ) // 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
249{
250 if( restricted_ ) {
251 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
252 }
253
254 value_ = uup.value_;
255
256 return *this;
257}
258//*************************************************************************************************
259
260
261//*************************************************************************************************
271template< typename MT > // Type of the adapted matrix
272template< typename T > // Type of the right-hand side value
273inline const StrictlyUpperProxy<MT>&
274 StrictlyUpperProxy<MT>::operator=( initializer_list<T> list ) const
275{
276 if( restricted_ ) {
277 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
278 }
279
280 value_ = list;
281
282 return *this;
283}
284//*************************************************************************************************
285
286
287//*************************************************************************************************
297template< typename MT > // Type of the adapted matrix
298template< typename T > // Type of the right-hand side value
299inline const StrictlyUpperProxy<MT>&
300 StrictlyUpperProxy<MT>::operator=( initializer_list< initializer_list<T> > list ) const
301{
302 if( restricted_ ) {
303 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
304 }
305
306 value_ = list;
307
308 return *this;
309}
310//*************************************************************************************************
311
312
313//*************************************************************************************************
323template< typename MT > // Type of the adapted matrix
324template< typename T > // Type of the right-hand side value
326{
327 if( restricted_ ) {
328 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
329 }
330
331 value_ = value;
332
333 return *this;
334}
335//*************************************************************************************************
336
337
338//*************************************************************************************************
348template< typename MT > // Type of the adapted matrix
349template< typename T > // Type of the right-hand side value
351{
352 if( restricted_ ) {
353 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
354 }
355
356 value_ += value;
357
358 return *this;
359}
360//*************************************************************************************************
361
362
363//*************************************************************************************************
373template< typename MT > // Type of the adapted matrix
374template< typename T > // Type of the right-hand side value
376{
377 if( restricted_ ) {
378 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
379 }
380
381 value_ -= value;
382
383 return *this;
384}
385//*************************************************************************************************
386
387
388//*************************************************************************************************
398template< typename MT > // Type of the adapted matrix
399template< typename T > // Type of the right-hand side value
401{
402 if( restricted_ ) {
403 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
404 }
405
406 value_ *= value;
407
408 return *this;
409}
410//*************************************************************************************************
411
412
413//*************************************************************************************************
423template< typename MT > // Type of the adapted matrix
424template< typename T > // Type of the right-hand side value
426{
427 if( restricted_ ) {
428 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
429 }
430
431 value_ /= value;
432
433 return *this;
434}
435//*************************************************************************************************
436
437
438//*************************************************************************************************
448template< typename MT > // Type of the adapted matrix
449template< typename T > // Type of the right-hand side value
451{
452 if( restricted_ ) {
453 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal or lower matrix element" );
454 }
455
456 value_ %= value;
457
458 return *this;
459}
460//*************************************************************************************************
461
462
463
464
465//=================================================================================================
466//
467// ACCESS OPERATORS
468//
469//=================================================================================================
470
471//*************************************************************************************************
476template< typename MT > // Type of the adapted matrix
478{
479 return this;
480}
481//*************************************************************************************************
482
483
484
485
486//=================================================================================================
487//
488// UTILITY FUNCTIONS
489//
490//=================================================================================================
491
492//*************************************************************************************************
497template< typename MT > // Type of the adapted matrix
499{
500 return value_;
501}
502//*************************************************************************************************
503
504
505//*************************************************************************************************
510template< typename MT > // Type of the adapted matrix
511inline bool StrictlyUpperProxy<MT>::isRestricted() const noexcept
512{
513 return restricted_;
514}
515//*************************************************************************************************
516
517
518
519
520//=================================================================================================
521//
522// CONVERSION OPERATOR
523//
524//=================================================================================================
525
526//*************************************************************************************************
531template< typename MT > // Type of the adapted matrix
533{
534 return static_cast<ConstReference>( value_ );
535}
536//*************************************************************************************************
537
538} // namespace blaze
539
540#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 upper triangular matrices.
Definition: StrictlyUpperProxy.h:102
const StrictlyUpperProxy & operator=(const StrictlyUpperProxy &uup) const
Copy assignment operator for StrictlyUpperProxy.
Definition: StrictlyUpperProxy.h:248
const StrictlyUpperProxy * operator->() const noexcept
Direct access to the accessed matrix element.
Definition: StrictlyUpperProxy.h:477
const bool restricted_
Access flag for the accessed matrix element.
Definition: StrictlyUpperProxy.h:179
ElementType_t< MT > RepresentedType
Type of the represented matrix element.
Definition: StrictlyUpperProxy.h:111
StrictlyUpperProxy(MT &matrix, size_t row, size_t column)
Initialization constructor for a StrictlyUpperProxy.
Definition: StrictlyUpperProxy.h:222
AddConst_t< Reference_t< MT > > ReferenceType
Reference type of the underlying matrix type.
Definition: StrictlyUpperProxy.h:106
const RepresentedType & ConstReference
Reference-to-const to the represented element.
Definition: StrictlyUpperProxy.h:113
RawReference get() const noexcept
Returning the value of the accessed matrix element.
Definition: StrictlyUpperProxy.h:498
ReferenceType value_
Reference to the accessed matrix element.
Definition: StrictlyUpperProxy.h:178
bool isRestricted() const noexcept
Returns whether the proxy represents a restricted matrix element..
Definition: StrictlyUpperProxy.h:511
AddLValueReference_t< ReferenceType > RawReference
Reference-to-non-const to the represented element.
Definition: StrictlyUpperProxy.h:112
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.