Blaze 3.9
UniLowerElement.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_UNILOWERELEMENT_H_
36#define _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_UNILOWERELEMENT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
60#include <blaze/util/Types.h>
61
62
63namespace blaze {
64
65//=================================================================================================
66//
67// CLASS DEFINITION
68//
69//=================================================================================================
70
71//*************************************************************************************************
97template< typename MT > // Type of the adapted matrix
99 : private SparseElement
100{
101 private:
102 //**Type definitions****************************************************************************
105 //**********************************************************************************************
106
107 public:
108 //**Type definitions****************************************************************************
110 using IndexType = size_t;
114 //**********************************************************************************************
115
116 //**Constructor*********************************************************************************
119 inline UniLowerElement( IteratorType pos, bool diagonal );
121 //**********************************************************************************************
122
123 //**Assignment operators************************************************************************
126 template< typename T > inline UniLowerElement& operator= ( const T& v );
127 template< typename T > inline UniLowerElement& operator+=( const T& v );
128 template< typename T > inline UniLowerElement& operator-=( const T& v );
129 template< typename T > inline UniLowerElement& operator*=( const T& v );
130 template< typename T > inline UniLowerElement& operator/=( const T& v );
132 //**********************************************************************************************
133
134 //**Access operators****************************************************************************
137 inline Pointer operator->() noexcept;
139 //**********************************************************************************************
140
141 //**Utility functions***************************************************************************
144 inline Reference value() const;
145 inline IndexType index() const;
147 //**********************************************************************************************
148
149 private:
150 //**Member variables****************************************************************************
153 //**********************************************************************************************
154
155 //**Compile time checks*************************************************************************
171 //**********************************************************************************************
172};
173//*************************************************************************************************
174
175
176
177
178//=================================================================================================
179//
180// CONSTRUCTORS
181//
182//=================================================================================================
183
184//*************************************************************************************************
190template< typename MT > // Type of the adapted matrix
192 : pos_ ( pos ) // Iterator to the current lower unitriangular matrix element
193 , diagonal_( diagonal ) // true in case the element is on the diagonal, false if not
194{}
195//*************************************************************************************************
196
197
198
199
200//=================================================================================================
201//
202// OPERATORS
203//
204//=================================================================================================
205
206//*************************************************************************************************
213template< typename MT > // Type of the adapted matrix
214template< typename T > // Type of the right-hand side value
216{
217 if( diagonal_ ) {
218 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix element" );
219 }
220
221 *pos_ = v;
222
223 return *this;
224}
225//*************************************************************************************************
226
227
228//*************************************************************************************************
235template< typename MT > // Type of the adapted matrix
236template< typename T > // Type of the right-hand side value
238{
239 if( diagonal_ ) {
240 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix element" );
241 }
242
243 *pos_ += v;
244
245 return *this;
246}
247//*************************************************************************************************
248
249
250//*************************************************************************************************
257template< typename MT > // Type of the adapted matrix
258template< typename T > // Type of the right-hand side value
260{
261 if( diagonal_ ) {
262 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix element" );
263 }
264
265 *pos_ -= v;
266
267 return *this;
268}
269//*************************************************************************************************
270
271
272//*************************************************************************************************
279template< typename MT > // Type of the adapted matrix
280template< typename T > // Type of the right-hand side value
282{
283 if( diagonal_ ) {
284 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix element" );
285 }
286
287 *pos_ *= v;
288
289 return *this;
290}
291//*************************************************************************************************
292
293
294//*************************************************************************************************
301template< typename MT > // Type of the adapted matrix
302template< typename T > // Type of the right-hand side value
304{
305 if( diagonal_ ) {
306 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix element" );
307 }
308
309 *pos_ /= v;
310
311 return *this;
312}
313//*************************************************************************************************
314
315
316
317
318//=================================================================================================
319//
320// ACCESS OPERATORS
321//
322//=================================================================================================
323
324//*************************************************************************************************
329template< typename MT > // Type of the adapted matrix
331{
332 return this;
333}
334//*************************************************************************************************
335
336
337
338
339//=================================================================================================
340//
341// UTILITY FUNCTIONS
342//
343//=================================================================================================
344
345//*************************************************************************************************
350template< typename MT > // Type of the adapted matrix
352{
353 return Reference( pos_->value(), diagonal_ );
354}
355//*************************************************************************************************
356
357
358//*************************************************************************************************
363template< typename MT > // Type of the adapted matrix
365{
366 return pos_->index();
367}
368//*************************************************************************************************
369
370} // namespace blaze
371
372#endif
Header file for auxiliary alias declarations.
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.
Definition: Aliases.h:210
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the UniLowerValue class.
Constraint on the data type.
Constraint on the data type.
Representation of an element within a sparse lower unitriangular matrix.
Definition: UniLowerElement.h:100
bool diagonal_
true in case the element is on the diagonal, false if not.
Definition: UniLowerElement.h:152
UniLowerValue< MT > Reference
Reference return type.
Definition: UniLowerElement.h:111
Reference value() const
Access to the current value of the unilower element.
Definition: UniLowerElement.h:351
IteratorType pos_
Iterator to the current lower unitriangular matrix element.
Definition: UniLowerElement.h:151
Iterator_t< MT > IteratorType
Type of the underlying sparse matrix iterators.
Definition: UniLowerElement.h:104
ElementType_t< MT > ElementType
Type of the represented matrix element.
Definition: UniLowerElement.h:103
IndexType index() const
Access to the current index of the unilower element.
Definition: UniLowerElement.h:364
Pointer operator->() noexcept
Direct access to the unilower element.
Definition: UniLowerElement.h:330
size_t IndexType
The index type of the value-index-pair.
Definition: UniLowerElement.h:110
UniLowerElement(IteratorType pos, bool diagonal)
Constructor for the UniLowerElement class.
Definition: UniLowerElement.h:191
Representation of a value within a sparse lower unitriangular matrix.
Definition: UniLowerValue.h:109
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
decltype(auto) diagonal(Matrix< MT, SO > &matrix, RDAs... args)
Creating a view on the diagonal of the given matrix.
Definition: Band.h:380
#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_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_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.
Definition: Transformation.h:81
#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 SparseElement base class.
Base class for all sparse element types.
Definition: SparseElement.h:58
Header file for basic type definitions.