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

Representation of two synchronized elements within the sparse Hermitian matrix.The HermitianElement class represents two synchronized elements (i.e. two value/index pairs) within a sparse Hermitian 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 <HermitianElement.h>

Inherits blaze::SparseElement.

Public Types

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

Public Member Functions

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

Private Types

typedef MT::ElementType ElementType
 Type of the represented matrix element.
 
typedef MT::Iterator 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::HermitianElement< MT >

Representation of two synchronized elements within the sparse Hermitian matrix.

The HermitianElement class represents two synchronized elements (i.e. two value/index pairs) within a sparse Hermitian 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:

typedef std::complex<double> cplx;
// Creating a 3x3 Hermitian dense matrix
//
// ( ( 0, 0) (0, 0) (-2,1) )
// ( ( 0, 0) (3, 0) ( 5,2) )
// ( (-2,-1) (5,-2) ( 0,0) )
//
Hermitian A( 3UL );
A(0,2) = cplx(-2,1);
A(1,1) = cplx( 3,0);
A(1,2) = cplx( 5,2);
// Modification of the elements at position (2,0) and (0,2)
//
// ( (0,0) (0, 0) (4,-3) )
// ( (0,0) (3, 0) (5, 2) )
// ( (4,3) (5,-2) (0, 0) )
//
Hermitian::Iterator it = A.begin( 2UL );
*it = cplx(4,3);

Constructor & Destructor Documentation

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

Constructor for the HermitianElement 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 >
HermitianElement< MT >::IndexType blaze::HermitianElement< 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::HermitianElement< 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 >
HermitianElement<MT>& blaze::HermitianElement< 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.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT >
template<typename T >
HermitianElement<MT>& blaze::HermitianElement< 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.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT >
template<typename T >
HermitianElement<MT>& blaze::HermitianElement< 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.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT >
HermitianElement< MT >::Pointer blaze::HermitianElement< MT >::operator-> ( )
inline

Direct access to the Hermitian element.

Returns
Reference to the value of the Hermitian element.
template<typename MT >
template<typename T >
HermitianElement<MT>& blaze::HermitianElement< 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.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT >
template<typename T >
HermitianElement<MT>& blaze::HermitianElement< MT >::operator= ( const T &  v)
inline

Assignment to the Hermitian element.

Parameters
vThe new value of the Hermitian element.
Returns
Reference to the assigned Hermitian element.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT >
void blaze::HermitianElement< MT >::sync ( )
inlineprivate

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

Returns
void
template<typename MT >
HermitianElement< MT >::Reference blaze::HermitianElement< 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: