Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
blaze::SymmetricElement< MT > Class Template Reference

Representation of two synchronized elements within the sparse symmetric matrix.The SymmetricElement class represents two synchronized elements (i.e. two value/index pairs) within a sparse symmetric matrix. It guarantees that a modification of element $ a_{ij} $ via iterator is also applied to element $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ dense Hermitian matrix: More...

#include <SymmetricElement.h>

Inherits blaze::SparseElement.

Public Types

typedef SymmetricValue< MT > ValueType
 The value type of the value-index-pair.
 
typedef size_t IndexType
 The index type of the value-index-pair.
 
typedef SymmetricValue< MT > Reference
 Reference return type.
 
typedef const SymmetricValue< MT > ConstReference
 Reference-to-const return type.
 
typedef SymmetricElementPointer
 Pointer return type.
 

Public Member Functions

template<typename T >
SymmetricElement< MT > & operator= (const T &v)
 Assignment to the symmetric element. More...
 
template<typename T >
SymmetricElement< MT > & operator+= (const T &v)
 Addition assignment to the Hermitian element. More...
 
template<typename T >
SymmetricElement< MT > & operator-= (const T &v)
 Subtraction assignment to the Hermitian element. More...
 
template<typename T >
SymmetricElement< MT > & operator*= (const T &v)
 Multiplication assignment to the Hermitian element. More...
 
template<typename T >
SymmetricElement< MT > & operator/= (const T &v)
 Division assignment to the Hermitian element. More...
 
Constructors
 SymmetricElement (IteratorType pos, MT *matrix, size_t idx)
 Constructor for the SymmetricElement class. More...
 
Assignment operators
template<typename T >
SymmetricElementoperator= (const T &v)
 
template<typename T >
SymmetricElementoperator+= (const T &v)
 
template<typename T >
SymmetricElementoperator-= (const T &v)
 
template<typename T >
SymmetricElementoperator*= (const T &v)
 
template<typename T >
SymmetricElementoperator/= (const T &v)
 
Access operators
Pointer operator-> () noexcept
 Direct access to the Hermitian element. More...
 

Private Types

typedef ElementType_< MT > ElementType
 Type of the represented matrix element.
 
typedef Iterator_< MT > IteratorType
 Type of the underlying sparse matrix iterators.
 

Private Attributes

IteratorType pos_
 Iterator to the current sparse Hermitian matrix element.
 
MT * matrix_
 The sparse matrix containing the iterator.
 
size_t index_
 The row/column index of the iterator.
 

Utility functions

Reference value () const
 Access to the current value of the Hermitian element. More...
 
IndexType index () const
 Access to the current index of the Hermitian element. More...
 
void sync ()
 Synchronization of the current sparse element to the according paired element. More...
 
bool isSynced () const
 Checking if the current sparse element is in sync. More...
 

Detailed Description

template<typename MT>
class blaze::SymmetricElement< MT >

Representation of two synchronized elements within the sparse symmetric matrix.

The SymmetricElement class represents two synchronized elements (i.e. two value/index pairs) within a sparse symmetric matrix. It guarantees that a modification of element $ a_{ij} $ via iterator is also applied to element $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ dense Hermitian matrix:

// Creating a 3x3 symmetric sparse matrix
//
// ( 0 0 -2 )
// ( 0 3 5 )
// ( -2 5 0 )
//
Symmetric A( 3UL );
A(0,2) = -2;
A(1,1) = 3;
A(1,2) = 5;
// Modification of the values at position (2,0) and (0,2)
//
// ( 0 0 4 )
// ( 0 3 5 )
// ( 4 5 0 )
//
Symmetric::Iterator it = A.begin( 2UL );
*it = 4;

Constructor & Destructor Documentation

template<typename MT >
blaze::SymmetricElement< MT >::SymmetricElement ( IteratorType  pos,
MT *  matrix,
size_t  idx 
)
inline

Constructor for the SymmetricElement class.

Parameters
posThe initial position of the iterator.
matrixThe sparse matrix containing the iterator.
idxThe row/column index of the iterator.

Member Function Documentation

template<typename MT >
SymmetricElement< MT >::IndexType blaze::SymmetricElement< MT >::index ( ) const
inline

Access to the current index of the Hermitian element.

Returns
The current index of the Hermitian element.
template<typename MT >
bool blaze::SymmetricElement< MT >::isSynced ( ) const
inlineprivate

Checking if the current sparse element is in sync.

Returns
true if the current sparse element is in sync, false if not.
template<typename MT >
template<typename T >
SymmetricElement<MT>& blaze::SymmetricElement< MT >::operator*= ( const T &  v)
inline

Multiplication assignment to the Hermitian element.

Parameters
vThe right-hand side value for the multiplication.
Returns
Reference to the assigned Hermitian element.
template<typename MT >
template<typename T >
SymmetricElement<MT>& blaze::SymmetricElement< MT >::operator+= ( const T &  v)
inline

Addition assignment to the Hermitian element.

Parameters
vThe right-hand side value for the addition.
Returns
Reference to the assigned Hermitian element.
template<typename MT >
template<typename T >
SymmetricElement<MT>& blaze::SymmetricElement< MT >::operator-= ( const T &  v)
inline

Subtraction assignment to the Hermitian element.

Parameters
vThe right-hand side value for the subtraction.
Returns
Reference to the assigned Hermitian element.
template<typename MT >
SymmetricElement< MT >::Pointer blaze::SymmetricElement< MT >::operator-> ( )
inlinenoexcept

Direct access to the Hermitian element.

Returns
Reference to the value of the Hermitian element.
template<typename MT >
template<typename T >
SymmetricElement<MT>& blaze::SymmetricElement< MT >::operator/= ( const T &  v)
inline

Division assignment to the Hermitian element.

Parameters
vThe right-hand side value for the division.
Returns
Reference to the assigned Hermitian element.
template<typename MT >
template<typename T >
SymmetricElement<MT>& blaze::SymmetricElement< MT >::operator= ( const T &  v)
inline

Assignment to the symmetric element.

Parameters
vThe new value of the symmetric element.
Returns
Reference to the assigned Hermitian element.
template<typename MT >
void blaze::SymmetricElement< MT >::sync ( )
inlineprivate

Synchronization of the current sparse element to the according paired element.

Returns
void
template<typename MT >
SymmetricElement< MT >::Reference blaze::SymmetricElement< MT >::value ( ) const
inline

Access to the current value of the Hermitian element.

Returns
The current value of the Hermitian element.

The documentation for this class was generated from the following file: