Blaze  3.6
Public Types | Public Member Functions | List of all members
blaze::NumericProxy< MT > Class Template Reference

Access proxy for symmetric, square matrices with numeric element types.The NumericProxy provides controlled access to the elements of a non-const symmetric matrix with numeric element type (e.g. integral values, floating point values, and complex values). It guarantees that a modification of element $ a_{ij} $ of the accessed matrix is also applied to element $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ dense symmetric matrix: More...

#include <NumericProxy.h>

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

Public Types

using RepresentedType = ElementType_t< MT >
 Type of the represented matrix element.
 
using Reference = Reference_t< MT >
 Reference to the represented element.
 
using ConstReference = ConstReference_t< MT >
 Reference-to-const to the represented element.
 
using Pointer = NumericProxy *
 Pointer to the represented element.
 
using ConstPointer = const NumericProxy *
 Pointer-to-const to the represented element.
 
using ValueType = typename If_t< IsComplex_v< RepresentedType >, ComplexType< RepresentedType >, BuiltinType< RepresentedType > >::Type
 Value type of the represented complex element.
 

Public Member Functions

template<typename T >
NumericProxy< MT > & operator= (const T &value)
 Assignment to the accessed matrix element. More...
 
template<typename T >
NumericProxy< MT > & operator+= (const T &value)
 Addition assignment to the accessed matrix element. More...
 
template<typename T >
NumericProxy< MT > & operator-= (const T &value)
 Subtraction assignment to the accessed matrix element. More...
 
template<typename T >
NumericProxy< MT > & operator *= (const T &value)
 Multiplication assignment to the accessed matrix element. More...
 
template<typename T >
NumericProxy< MT > & operator/= (const T &value)
 Division assignment to the accessed matrix element. More...
 
template<typename T >
NumericProxy< MT > & operator%= (const T &value)
 Modulo assignment to the accessed matrix element. More...
 
Constructors
 NumericProxy (MT &matrix, size_t row, size_t column)
 Initialization constructor for a NumericProxy. More...
 
 NumericProxy (const NumericProxy &np)
 The copy constructor for NumericProxy. More...
 
Destructor
 ~NumericProxy ()=default
 
Assignment operators
NumericProxyoperator= (const NumericProxy &sp)
 Copy assignment operator for NumericProxy. More...
 
template<typename T >
NumericProxyoperator= (const T &value)
 
template<typename T >
NumericProxyoperator+= (const T &value)
 
template<typename T >
NumericProxyoperator-= (const T &value)
 
template<typename T >
NumericProxyoperator *= (const T &value)
 
template<typename T >
NumericProxyoperator/= (const T &value)
 
template<typename T >
NumericProxyoperator%= (const T &value)
 
Access operators
Pointer operator-> ()
 Direct access to the represented matrix element. More...
 
ConstPointer operator-> () const
 Direct access to the represented matrix element. More...
 
Utility functions
void reset () const
 Reset the represented element to its default initial value. More...
 
void clear () const
 Clearing the represented element. More...
 
void invert () const
 In-place inversion of the represented element. More...
 
ConstReference get () const noexcept
 Returning the value of the accessed matrix element. More...
 
Conversion operator
 operator ConstReference () const noexcept
 Conversion to the accessed matrix element. 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 Attributes

Member variables
MT & matrix_
 Reference to the adapted matrix.
 
size_t row_
 Row index of the accessed matrix element.
 
size_t column_
 Column index of the accessed matrix element.
 

Detailed Description

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

Access proxy for symmetric, square matrices with numeric element types.

The NumericProxy provides controlled access to the elements of a non-const symmetric matrix with numeric element type (e.g. integral values, floating point values, and complex values). It guarantees that a modification of element $ a_{ij} $ of the accessed matrix is also applied to element $ a_{ji} $. The following example illustrates this by means of a $ 3 \times 3 $ dense symmetric matrix:

// Creating a 3x3 symmetric dense matrix
A(0,2) = -2; // ( 0 0 -2 )
A(1,1) = 3; // => A = ( 0 3 5 )
A(1,2) = 5; // ( -2 5 0 )

Constructor & Destructor Documentation

◆ NumericProxy() [1/2]

template<typename MT >
blaze::NumericProxy< MT >::NumericProxy ( MT &  matrix,
size_t  row,
size_t  column 
)
inlineexplicit

Initialization constructor for a NumericProxy.

Parameters
matrixReference to the adapted matrix.
rowThe row-index of the accessed matrix element.
columnThe column-index of the accessed matrix element.

◆ NumericProxy() [2/2]

template<typename MT >
blaze::NumericProxy< MT >::NumericProxy ( const NumericProxy< MT > &  np)
inline

The copy constructor for NumericProxy.

Parameters
npNumeric proxy to be copied.

Member Function Documentation

◆ clear()

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

Clearing the represented element.

Returns
void

This function clears the element represented by the proxy to its default initial state.

◆ get()

template<typename MT >
NumericProxy< MT >::ConstReference blaze::NumericProxy< MT >::get ( ) const
inlinenoexcept

Returning the value of the accessed matrix element.

Returns
Direct/raw reference to the accessed matrix element.

◆ imag() [1/2]

template<typename MT >
NumericProxy< MT >::ValueType blaze::NumericProxy< 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 proxy represents a complex number, this function returns the current value of its imaginary part.

◆ imag() [2/2]

template<typename MT >
void blaze::NumericProxy< 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::NumericProxy< MT >::invert ( ) const
inline

In-place inversion of the represented element.

Returns
void

◆ operator *=()

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

Multiplication assignment to the accessed matrix element.

Parameters
valueThe right-hand side value for the multiplication.
Returns
Reference to the assigned proxy.

◆ operator ConstReference()

template<typename MT >
blaze::NumericProxy< MT >::operator ConstReference ( ) const
inlinenoexcept

Conversion to the accessed matrix element.

Returns
Direct/raw reference to the accessed matrix element.

◆ operator%=()

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

Modulo assignment to the accessed matrix element.

Parameters
valueThe right-hand side value for the modulo operation.
Returns
Reference to the assigned proxy.

◆ operator+=()

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

Addition assignment to the accessed matrix element.

Parameters
valueThe right-hand side value to be added to the matrix element.
Returns
Reference to the assigned proxy.

◆ operator-=()

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

Subtraction assignment to the accessed matrix element.

Parameters
valueThe right-hand side value to be subtracted from the matrix element.
Returns
Reference to the assigned proxy.

◆ operator->() [1/2]

template<typename MT >
NumericProxy< MT >::Pointer blaze::NumericProxy< MT >::operator-> ( )
inline

Direct access to the represented matrix element.

Returns
Pointer to the represented matrix element.

◆ operator->() [2/2]

template<typename MT >
NumericProxy< MT >::ConstPointer blaze::NumericProxy< MT >::operator-> ( ) const
inline

Direct access to the represented matrix element.

Returns
Pointer to the represented matrix element.

◆ operator/=()

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

Division assignment to the accessed matrix element.

Parameters
valueThe right-hand side value for the division.
Returns
Reference to the assigned proxy.

◆ operator=() [1/2]

template<typename MT >
NumericProxy< MT > & blaze::NumericProxy< MT >::operator= ( const NumericProxy< MT > &  np)
inline

Copy assignment operator for NumericProxy.

Parameters
npNumeric proxy to be copied.
Returns
Reference to the assigned proxy.

◆ operator=() [2/2]

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

Assignment to the accessed matrix element.

Parameters
valueThe new value of the matrix element.
Returns
Reference to the assigned proxy.

◆ real() [1/2]

template<typename MT >
NumericProxy< MT >::ValueType blaze::NumericProxy< 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 proxy represents a complex number, this function returns the current value of its real part.

◆ real() [2/2]

template<typename MT >
void blaze::NumericProxy< 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 proxy represents a complex number, this function sets a new value to its real part.

◆ reset()

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

Reset the represented element to its default initial value.

Returns
void

This function resets the element represented by the proxy to its default initial value.


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