![]() |
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a non-const sparse matrices.
The proxied access to the elements of a sparse matrix is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedMatrix class:
More...
#include <MatrixAccessProxy.h>
Inherits blaze::Proxy< MatrixAccessProxy< MT >, ElementType_< MT > >.
Public Types | |
using | RepresentedType = ElementType_< MT > |
Type of the represented sparse matrix element. | |
using | RawReference = RepresentedType & |
Raw reference to the represented element. | |
Public Member Functions | |
template<typename T > | |
const MatrixAccessProxy< VT > & | operator= (initializer_list< T > list) const |
Initializer list assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< VT > & | operator= (initializer_list< initializer_list< T > > list) const |
Initializer list assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator= (const T &value) const |
Assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator+= (const T &value) const |
Addition assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator-= (const T &value) const |
Subtraction assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator*= (const T &value) const |
Multiplication assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator/= (const T &value) const |
Division assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
const MatrixAccessProxy< MT > & | operator%= (const T &value) const |
Modulo assignment to the accessed sparse matrix element. More... | |
Constructors | |
MatrixAccessProxy (MT &sm, size_t i, size_t j) | |
Initialization constructor for a MatrixAccessProxy. More... | |
MatrixAccessProxy (const MatrixAccessProxy &map) | |
The copy constructor for MatrixAccessProxy. More... | |
Destructor | |
~MatrixAccessProxy () | |
The destructor for MatrixAccessProxy. | |
Operators | |
const MatrixAccessProxy & | operator= (const MatrixAccessProxy &map) const |
Copy assignment operator for MatrixAccessProxy. More... | |
template<typename T > | |
const MatrixAccessProxy & | operator= (initializer_list< T > list) const |
template<typename T > | |
const MatrixAccessProxy & | operator= (initializer_list< initializer_list< T > > list) const |
template<typename T > | |
const MatrixAccessProxy & | operator= (const T &value) const |
template<typename T > | |
const MatrixAccessProxy & | operator+= (const T &value) const |
template<typename T > | |
const MatrixAccessProxy & | operator-= (const T &value) const |
template<typename T > | |
const MatrixAccessProxy & | operator*= (const T &value) const |
template<typename T > | |
const MatrixAccessProxy & | operator/= (const T &value) const |
template<typename T > | |
const MatrixAccessProxy & | operator%= (const T &value) const |
Utility functions | |
RawReference | get () const noexcept |
Returning the value of the accessed sparse matrix element. More... | |
bool | isRestricted () const noexcept |
Returns whether the proxy represents a restricted sparse matrix element.. More... | |
Conversion operator | |
operator RawReference () const noexcept | |
Conversion to the accessed sparse matrix element. More... | |
Private Types | |
enum | : bool { rmm = IsRowMajorMatrix<MT>::value } |
Compile time flag indicating whether the given matrix type is a row-major matrix. | |
Private Member Functions | |
Forbidden operations | |
void * | operator & () const |
Address operator (private & undefined) | |
Private Attributes | |
Member variables | |
MT & | sm_ |
Reference to the accessed sparse matrix. | |
size_t | i_ |
Row-index of the accessed sparse matrix element. | |
size_t | j_ |
Column-index of the accessed sparse matrix element. | |
Access proxy for sparse, matrices.
The MatrixAccessProxy provides safe access to the elements of a non-const sparse matrices.
The proxied access to the elements of a sparse matrix is necessary since it may be possible that several insertion operations happen in the same statement. The following code illustrates this with two examples by means of the CompressedMatrix class:
The problem (especially with the last statement) is that several insertion operations might take place due to the access via the function call operator. If the function call operator would return a direct reference to one of the accessed elements, this reference might be invalidated during the evaluation of a subsequent function call operator, which results in undefined behavior. This class provides the necessary functionality to guarantee a safe access to the sparse matrix elements while preserving the intuitive use of the function call operator.
|
inlineexplicit |
Initialization constructor for a MatrixAccessProxy.
sm | Reference to the accessed sparse matrix. |
i | The row-index of the accessed sparse matrix element. |
j | The column-index of the accessed sparse matrix element. |
|
inline |
The copy constructor for MatrixAccessProxy.
map | Sparse matrix access proxy to be copied. |
|
inlinenoexcept |
Returning the value of the accessed sparse matrix element.
|
inlinenoexcept |
Returns whether the proxy represents a restricted sparse matrix element..
|
inlinenoexcept |
Conversion to the accessed sparse matrix element.
|
inline |
Modulo assignment to the accessed sparse matrix element.
value | The right-hand side value for the modulo operation. |
If the access proxy represents an element of numeric type, this function performs a modulo assignment, if the proxy represents a dense or sparse vector, a cross product is computed, and if the proxy represents a dense or sparse matrix, a Schur product is computed.
|
inline |
Multiplication assignment to the accessed sparse matrix element.
value | The right-hand side value for the multiplication. |
|
inline |
Addition assignment to the accessed sparse matrix element.
value | The right-hand side value to be added to the sparse matrix element. |
|
inline |
Subtraction assignment to the accessed sparse matrix element.
value | The right-hand side value to be subtracted from the sparse matrix element. |
|
inline |
Division assignment to the accessed sparse matrix element.
value | The right-hand side value for the division. |
|
inline |
Copy assignment operator for MatrixAccessProxy.
map | Sparse matrix access proxy to be copied. |
|
inline |
Initializer list assignment to the accessed sparse matrix element.
list | The list to be assigned to the sparse matrix element. |
|
inline |
Initializer list assignment to the accessed sparse matrix element.
list | The list to be assigned to the sparse matrix element. |
|
inline |
Assignment to the accessed sparse matrix element.
value | The new value of the sparse matrix element. |