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

Representation of two synchronized values within a sparse Hermitian matrix.The HermitianValue class represents two synchronized values within a sparse Hermitian 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 Hermitian matrix: More...

#include <HermitianValue.h>

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

Public Types

using RepresentedType = ElementType_t< MT >
 Type of the represented matrix element.
 
using ValueType = typename If_t< IsComplex_v< RepresentedType >, ComplexType< RepresentedType >, BuiltinType< RepresentedType > >::Type
 Value type of the represented complex element.
 
using value_type = ValueType
 Value type of the represented complex element.
 

Public Member Functions

template<typename T >
HermitianValue< MT > & operator= (const T &value)
 Assignment to the Hermitian value. More...
 
template<typename T >
HermitianValue< MT > & operator+= (const T &value)
 Addition assignment to the Hermitian value. More...
 
template<typename T >
HermitianValue< MT > & operator-= (const T &value)
 Subtraction assignment to the Hermitian value. More...
 
template<typename T >
HermitianValue< MT > & operator*= (const T &value)
 Multiplication assignment to the Hermitian value. More...
 
template<typename T >
HermitianValue< MT > & operator/= (const T &value)
 Division assignment to the Hermitian value. More...
 
Constructors
 HermitianValue (IteratorType pos, MT *matrix, size_t index)
 Constructor for the HermitianValue class. More...
 
Assignment operators
HermitianValueoperator= (const HermitianValue &hv)
 Copy assignment operator for HermitianValue. More...
 
template<typename T >
HermitianValueoperator= (const T &value)
 
template<typename T >
HermitianValueoperator+= (const T &value)
 
template<typename T >
HermitianValueoperator-= (const T &value)
 
template<typename T >
HermitianValueoperator*= (const T &value)
 
template<typename T >
HermitianValueoperator/= (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

using IteratorType = typename MT::Iterator
 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

void reset () const
 Reset the Hermitian value to its default initial value. More...
 
void clear () const
 Clearing the Hermitian value. More...
 
void invert () const
 In-place inversion of the Hermitian 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::HermitianValue< MT >

Representation of two synchronized values within a sparse Hermitian matrix.

The HermitianValue class represents two synchronized values within a sparse Hermitian 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 Hermitian matrix:

using cplx = std::complex<double>;
// 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 values 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->value() = cplx(4,3);

Constructor & Destructor Documentation

◆ HermitianValue()

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

Constructor for the HermitianValue class.

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

Member Function Documentation

◆ clear()

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

Clearing the Hermitian value.

Returns
void

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

◆ get()

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

Access to the represented value.

Returns
Copy of the represented value.

◆ imag() [1/2]

template<typename MT >
HermitianValue< MT >::ValueType blaze::HermitianValue< 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.

◆ imag() [2/2]

template<typename MT >
void blaze::HermitianValue< 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.

◆ invert()

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

In-place inversion of the Hermitian value.

Returns
void

◆ operator RepresentedType()

template<typename MT >
blaze::HermitianValue< MT >::operator RepresentedType ( ) const
inlinenoexcept

Conversion to the represented value.

Returns
Copy of the represented value.

◆ operator*=()

template<typename MT>
template<typename T >
HermitianValue<MT>& blaze::HermitianValue< MT >::operator*= ( const T &  value)
inline

Multiplication assignment to the Hermitian value.

Parameters
valueThe right-hand side value for the multiplication.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ operator+=()

template<typename MT>
template<typename T >
HermitianValue<MT>& blaze::HermitianValue< MT >::operator+= ( const T &  value)
inline

Addition assignment to the Hermitian value.

Parameters
valueThe right-hand side value to be added to the Hermitian value.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ operator-=()

template<typename MT>
template<typename T >
HermitianValue<MT>& blaze::HermitianValue< MT >::operator-= ( const T &  value)
inline

Subtraction assignment to the Hermitian value.

Parameters
valueThe right-hand side value to be subtracted from the Hermitian value.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ operator/=()

template<typename MT>
template<typename T >
HermitianValue<MT>& blaze::HermitianValue< MT >::operator/= ( const T &  value)
inline

Division assignment to the Hermitian value.

Parameters
valueThe right-hand side value for the division.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ operator=() [1/2]

template<typename MT >
HermitianValue< MT > & blaze::HermitianValue< MT >::operator= ( const HermitianValue< MT > &  hv)
inline

Copy assignment operator for HermitianValue.

Parameters
hvThe Hermitian value to be copied.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ operator=() [2/2]

template<typename MT>
template<typename T >
HermitianValue<MT>& blaze::HermitianValue< MT >::operator= ( const T &  value)
inline

Assignment to the Hermitian value.

Parameters
valueThe new value of the Hermitian value.
Returns
Reference to the assigned Hermitian value.
Exceptions
std::invalid_argumentInvalid assignment to diagonal matrix element.

◆ real() [1/2]

template<typename MT >
HermitianValue< MT >::ValueType blaze::HermitianValue< 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.

◆ real() [2/2]

template<typename MT >
void blaze::HermitianValue< 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.

◆ reset()

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

Reset the Hermitian value to its default initial value.

Returns
void

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

◆ sync()

template<typename MT >
void blaze::HermitianValue< 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: