![]() |
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 >, MT::ElementType >.
Public Types | |
typedef MT::ElementType | RepresentedType |
Type of the represented sparse matrix element. | |
typedef RepresentedType & | RawReference |
Raw reference to the represented element. | |
Public Member Functions | |
template<typename T > | |
MatrixAccessProxy< MT > & | operator= (const T &value) |
Assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
MatrixAccessProxy< MT > & | operator+= (const T &value) |
Addition assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
MatrixAccessProxy< MT > & | operator-= (const T &value) |
Subtraction assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
MatrixAccessProxy< MT > & | operator*= (const T &value) |
Multiplication assignment to the accessed sparse matrix element. More... | |
template<typename T > | |
MatrixAccessProxy< MT > & | operator/= (const T &value) |
Division 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 | |
MatrixAccessProxy & | operator= (const MatrixAccessProxy &map) |
Copy assignment operator for MatrixAccessProxy. More... | |
template<typename T > | |
MatrixAccessProxy & | operator= (const T &value) |
template<typename T > | |
MatrixAccessProxy & | operator+= (const T &value) |
template<typename T > | |
MatrixAccessProxy & | operator-= (const T &value) |
template<typename T > | |
MatrixAccessProxy & | operator*= (const T &value) |
template<typename T > | |
MatrixAccessProxy & | operator/= (const T &value) |
Utility functions | |
RawReference | get () const |
Returning the value of the accessed sparse matrix element. More... | |
Conversion operator | |
operator RawReference () const | |
Conversion to the accessed sparse matrix element. More... | |
Private Types | |
enum | { 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. |
|
inline |
Returning the value of the accessed sparse matrix element.
|
inline |
Conversion to the accessed sparse matrix element.
|
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 |
Assignment to the accessed sparse matrix element.
value | The new value of the sparse matrix element. |