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

Representation of two synchronized values within a sparse symmetric matrix.The SymmetricValue class represents two synchronized values within a sparse symmetric matrix. It guarantees that a modification of value $ a_{ij} $ via iterator is also applied to the value $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ sparse symmetric matrix: More...

#include <SymmetricValue.h>

Inherits blaze::Proxy< SymmetricValue< MT > >.

Public Types

typedef ElementType_< MT > RepresentedType
 Type of the represented matrix element.
 
typedef If_< IsComplex< RepresentedType >, ComplexType< RepresentedType >, BuiltinType< RepresentedType > >::Type ValueType
 Value type of the represented complex element.
 
typedef ValueType value_type
 Value type of the represented complex element.
 

Public Member Functions

template<typename T >
SymmetricValue< MT > & operator= (const T &value)
 Assignment to the symmetric value. More...
 
template<typename T >
SymmetricValue< MT > & operator+= (const T &value)
 Addition assignment to the symmetric value. More...
 
template<typename T >
SymmetricValue< MT > & operator-= (const T &value)
 Subtraction assignment to the symmetric value. More...
 
template<typename T >
SymmetricValue< MT > & operator*= (const T &value)
 Multiplication assignment to the symmetric value. More...
 
template<typename T >
SymmetricValue< MT > & operator/= (const T &value)
 Division assignment to the symmetric value. More...
 
Constructors
 SymmetricValue (IteratorType pos, MT *matrix, size_t index)
 Constructor for the SymmetricValue class. More...
 
Assignment operators
SymmetricValueoperator= (const SymmetricValue &sv)
 Copy assignment operator for SymmetricValue. More...
 
template<typename T >
SymmetricValueoperator= (const T &value)
 
template<typename T >
SymmetricValueoperator+= (const T &value)
 
template<typename T >
SymmetricValueoperator-= (const T &value)
 
template<typename T >
SymmetricValueoperator*= (const T &value)
 
template<typename T >
SymmetricValueoperator/= (const T &value)
 
Conversion operator
 operator RepresentedType () const noexcept
 Conversion to the represented value. More...
 
Complex data access functions
ValueType real () const
 Returns the real part of the represented complex number. More...
 
void real (ValueType value) const
 Setting the real part of the represented complex number. More...
 
ValueType imag () const
 Returns the imaginary part of the represented complex number. More...
 
void imag (ValueType value) const
 Setting the imaginary part of the represented complex number. More...
 

Private Types

typedef MT::Iterator IteratorType
 Type of the underlying sparse matrix iterators.
 

Private Attributes

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

Utility functions

void reset () const
 Reset the symmetric value to its default initial value. More...
 
void clear () const
 Clearing the symmetric value. More...
 
void invert () const
 In-place inversion of the symmetric value. More...
 
RepresentedType get () const noexcept
 Access to the represented value. More...
 
void sync () const
 Synchronization of the current sparse element to the according paired element. More...
 

Detailed Description

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

Representation of two synchronized values within a sparse symmetric matrix.

The SymmetricValue class represents two synchronized values within a sparse symmetric matrix. It guarantees that a modification of value $ a_{ij} $ via iterator is also applied to the value $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ sparse symmetric 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->value() = 4;

Constructor & Destructor Documentation

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

Constructor for the SymmetricValue class.

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

Member Function Documentation

template<typename MT >
void blaze::SymmetricValue< MT >::clear ( ) const
inline

Clearing the symmetric value.

Returns
void

This function clears the symmetric value to its default initial state.

template<typename MT >
SymmetricValue< MT >::RepresentedType blaze::SymmetricValue< MT >::get ( ) const
inlinenoexcept

Access to the represented value.

Returns
Copy of the represented value.
template<typename MT >
SymmetricValue< MT >::ValueType blaze::SymmetricValue< MT >::imag ( ) const
inline

Returns the imaginary part of the represented complex number.

Returns
The current imaginary part of the represented complex number.

In case the value represents a complex number, this function returns the current value of its imaginary part.

template<typename MT >
void blaze::SymmetricValue< MT >::imag ( ValueType  value) const
inline

Setting the imaginary part of the represented complex number.

Parameters
valueThe new value for the imaginary part.
Returns
void

In case the proxy represents a complex number, this function sets a new value to its imaginary part.

template<typename MT >
void blaze::SymmetricValue< MT >::invert ( ) const
inline

In-place inversion of the symmetric value.

Returns
void
template<typename MT >
blaze::SymmetricValue< MT >::operator RepresentedType ( ) const
inlinenoexcept

Conversion to the represented value.

Returns
Copy of the represented value.
template<typename MT>
template<typename T >
SymmetricValue<MT>& blaze::SymmetricValue< MT >::operator*= ( const T &  value)
inline

Multiplication assignment to the symmetric value.

Parameters
valueThe right-hand side value for the multiplication.
Returns
Reference to the assigned symmetric value.
template<typename MT>
template<typename T >
SymmetricValue<MT>& blaze::SymmetricValue< MT >::operator+= ( const T &  value)
inline

Addition assignment to the symmetric value.

Parameters
valueThe right-hand side value to be added to the symmetric value.
Returns
Reference to the assigned symmetric value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.
template<typename MT>
template<typename T >
SymmetricValue<MT>& blaze::SymmetricValue< MT >::operator-= ( const T &  value)
inline

Subtraction assignment to the symmetric value.

Parameters
valueThe right-hand side value to be subtracted from the symmetric value.
Returns
Reference to the assigned symmetric value.
template<typename MT>
template<typename T >
SymmetricValue<MT>& blaze::SymmetricValue< MT >::operator/= ( const T &  value)
inline

Division assignment to the symmetric value.

Parameters
valueThe right-hand side value for the division.
Returns
Reference to the assigned symmetric value.
template<typename MT >
SymmetricValue< MT > & blaze::SymmetricValue< MT >::operator= ( const SymmetricValue< MT > &  sv)
inline

Copy assignment operator for SymmetricValue.

Parameters
svThe symmetric value to be copied.
Returns
Reference to the assigned symmetric value.
template<typename MT>
template<typename T >
SymmetricValue<MT>& blaze::SymmetricValue< MT >::operator= ( const T &  value)
inline

Assignment to the symmetric value.

Parameters
valueThe new value of the symmetric value.
Returns
Reference to the assigned symmetric value.
template<typename MT >
SymmetricValue< MT >::ValueType blaze::SymmetricValue< MT >::real ( ) const
inline

Returns the real part of the represented complex number.

Returns
The current real part of the represented complex number.

In case the value represents a complex number, this function returns the current value of its real part.

template<typename MT >
void blaze::SymmetricValue< MT >::real ( ValueType  value) const
inline

Setting the real part of the represented complex number.

Parameters
valueThe new value for the real part.
Returns
void

In case the value represents a complex number, this function sets a new value to its real part.

template<typename MT >
void blaze::SymmetricValue< MT >::reset ( ) const
inline

Reset the symmetric value to its default initial value.

Returns
void

This function resets the symmetric value to its default initial value.

template<typename MT >
void blaze::SymmetricValue< MT >::sync ( ) const
inlineprivate

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

Returns
void

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