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

Access proxy for diagonal matrices.The DiagonalProxy provides controlled access to the elements of a non-const diagonal matrix. It guarantees that the diagonal matrix invariant is not violated, i.e. that elements in the lower and upper part of the matrix remain default values. The following example illustrates this by means of a $ 3 \times 3 $ dense diagonal matrix: More...

#include <DiagonalProxy.h>

Inherits blaze::Proxy< DiagonalProxy< MT >, ElementType_t< MT > >.

Public Types

using RepresentedType = ElementType_t< MT >
 Type of the represented matrix element.
 
using RawReference = AddReference_t< ReferenceType >
 Reference-to-non-const to the represented element.
 
using ConstReference = const RepresentedType &
 Reference-to-const to the represented element.
 

Public Member Functions

template<typename T >
DiagonalProxy< MT > & operator= (initializer_list< T > list)
 Initializer list assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator= (initializer_list< initializer_list< T > > list)
 Initializer list assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator= (const T &value)
 Assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator+= (const T &value)
 Addition assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator-= (const T &value)
 Subtraction assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator *= (const T &value)
 Multiplication assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator/= (const T &value)
 Division assignment to the accessed matrix element. More...
 
template<typename T >
DiagonalProxy< MT > & operator%= (const T &value)
 Modulo assignment to the accessed matrix element. More...
 
Constructors
 DiagonalProxy (MT &matrix, size_t row, size_t column)
 Initialization constructor for a DiagonalProxy. More...
 
 DiagonalProxy (const DiagonalProxy &dp)
 The copy constructor for DiagonalProxy. More...
 
Destructor
 ~DiagonalProxy ()=default
 
Assignment operators
DiagonalProxyoperator= (const DiagonalProxy &dp)
 Copy assignment operator for DiagonalProxy. More...
 
template<typename T >
DiagonalProxyoperator= (initializer_list< T > list)
 
template<typename T >
DiagonalProxyoperator= (initializer_list< initializer_list< T > > list)
 
template<typename T >
DiagonalProxyoperator= (const T &value)
 
template<typename T >
DiagonalProxyoperator+= (const T &value)
 
template<typename T >
DiagonalProxyoperator-= (const T &value)
 
template<typename T >
DiagonalProxyoperator *= (const T &value)
 
template<typename T >
DiagonalProxyoperator/= (const T &value)
 
template<typename T >
DiagonalProxyoperator%= (const T &value)
 
Access operators
const DiagonalProxyoperator-> () const noexcept
 Direct access to the accessed matrix element. More...
 
Utility functions
RawReference get () const noexcept
 Returning the value of the accessed matrix element. More...
 
bool isRestricted () const noexcept
 Returns whether the proxy represents a restricted matrix element.. More...
 
Conversion operator
 operator ConstReference () const noexcept
 Conversion to the accessed matrix element. More...
 

Private Types

using ReferenceType = AddConst_t< typename MT::Reference >
 Reference type of the underlying matrix type.
 

Private Attributes

Member variables
ReferenceType value_
 Reference to the accessed matrix element.
 
const bool restricted_
 Access flag for the accessed matrix element. More...
 

Detailed Description

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

Access proxy for diagonal matrices.

The DiagonalProxy provides controlled access to the elements of a non-const diagonal matrix. It guarantees that the diagonal matrix invariant is not violated, i.e. that elements in the lower and upper part of the matrix remain default values. The following example illustrates this by means of a $ 3 \times 3 $ dense diagonal matrix:

// Creating a 3x3 dense diagonal matrix
A(0,0) = -2; // ( -2 0 0 )
A(1,1) = 3; // => A = ( 0 3 0 )
A(2,2) = 5; // ( 0 0 5 )
A(0,2) = 7; // Invalid assignment to upper matrix element; results in an exception!

Constructor & Destructor Documentation

◆ DiagonalProxy() [1/2]

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

Initialization constructor for a DiagonalProxy.

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

◆ DiagonalProxy() [2/2]

template<typename MT >
blaze::DiagonalProxy< MT >::DiagonalProxy ( const DiagonalProxy< MT > &  dp)
inline

The copy constructor for DiagonalProxy.

Parameters
dpDiagonal proxy to be copied.

Member Function Documentation

◆ get()

template<typename MT >
DiagonalProxy< MT >::RawReference blaze::DiagonalProxy< MT >::get ( ) const
inlinenoexcept

Returning the value of the accessed matrix element.

Returns
Direct/raw reference to the accessed matrix element.

◆ isRestricted()

template<typename MT >
bool blaze::DiagonalProxy< MT >::isRestricted ( ) const
inlinenoexcept

Returns whether the proxy represents a restricted matrix element..

Returns
true in case access to the matrix element is restricted, false if not.

◆ operator *=()

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator ConstReference()

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

Conversion to the accessed matrix element.

Returns
Reference-to-const to the accessed matrix element.

◆ operator%=()

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator+=()

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator-=()

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator->()

template<typename MT >
const DiagonalProxy< MT > * blaze::DiagonalProxy< MT >::operator-> ( ) const
inlinenoexcept

Direct access to the accessed matrix element.

Returns
Pointer to the accessed matrix element.

◆ operator/=()

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator=() [1/4]

template<typename MT >
DiagonalProxy< MT > & blaze::DiagonalProxy< MT >::operator= ( const DiagonalProxy< MT > &  dp)
inline

Copy assignment operator for DiagonalProxy.

Parameters
dpDiagonal proxy to be copied.
Returns
Reference to the assigned proxy.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator=() [2/4]

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< MT >::operator= ( initializer_list< T >  list)
inline

Initializer list assignment to the accessed matrix element.

Parameters
listThe list to be assigned to the matrix element.
Returns
Reference to the assigned proxy.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator=() [3/4]

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< MT >::operator= ( initializer_list< initializer_list< T > >  list)
inline

Initializer list assignment to the accessed matrix element.

Parameters
listThe list to be assigned to the matrix element.
Returns
Reference to the assigned proxy.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

◆ operator=() [4/4]

template<typename MT>
template<typename T >
DiagonalProxy<MT>& blaze::DiagonalProxy< 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.
Exceptions
std::invalid_argumentInvalid assignment to non-diagonal matrix element.

In case the proxy represents a non-diagonal matrix element, a std::invalid_argument exception is thrown.

Member Data Documentation

◆ restricted_

template<typename MT>
const bool blaze::DiagonalProxy< MT >::restricted_
private

Access flag for the accessed matrix element.

The flag indicates if access to the matrix element is restricted. It is true in case the proxy represents an element in the lower or upper part of the matrix.


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