Blaze  3.6
Public Types | Public Member Functions | Static Public Attributes | List of all members
blaze::DenseMatrixProxy< PT, MT > Class Template Reference

Proxy backend for dense matrix types.The DenseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a dense matrix and augments the Proxy interface by the complete interface required of dense matrices. More...

#include <DenseMatrixProxy.h>

Inherits blaze::DenseMatrix< PT, IsColumnMajorMatrix_v< MT > >.

Public Types

using ResultType = ResultType_t< MT >
 Result type for expression template evaluations.
 
using OppositeType = OppositeType_t< MT >
 Result type with opposite storage order for expression template evaluations.
 
using TransposeType = TransposeType_t< MT >
 Transpose type for expression template evaluations.
 
using ElementType = ElementType_t< MT >
 Type of the matrix elements.
 
using ReturnType = ReturnType_t< MT >
 Return type for expression template evaluations.
 
using CompositeType = CompositeType_t< MT >
 Data type for composite expression templates.
 
using Reference = Reference_t< MT >
 Reference to a non-constant matrix value.
 
using ConstReference = ConstReference_t< MT >
 Reference to a constant matrix value.
 
using Pointer = Pointer_t< MT >
 Pointer to a non-constant matrix value.
 
using ConstPointer = ConstPointer_t< MT >
 Pointer to a constant matrix value.
 
using Iterator = Iterator_t< MT >
 Iterator over non-constant elements.
 
using ConstIterator = ConstIterator_t< MT >
 Iterator over constant elements.
 
using MatrixType = PT
 Type of the matrix.
 

Public Member Functions

BLAZE_ALWAYS_INLINE constexpr MatrixTypeoperator~ () noexcept
 Conversion operator for non-constant matrices. More...
 
BLAZE_ALWAYS_INLINE constexpr const MatrixTypeoperator~ () const noexcept
 Conversion operator for constant matrices. More...
 
Data access functions
Reference operator() (size_t i, size_t j) const
 Function call operator for the direct access to matrix elements. More...
 
Reference at (size_t i, size_t j) const
 Checked access to the matrix elements. More...
 
Pointer data () const
 Low-level data access to matrix elements. More...
 
Pointer data (size_t i) const
 Low-level data access to matrix elements of row/column i. More...
 
Iterator begin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
ConstIterator cbegin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
Iterator end (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
ConstIterator cend (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
Utility functions
size_t rows () const
 Returns the current number of rows of the represented matrix. More...
 
size_t columns () const
 Returns the current number of columns of the represented matrix. More...
 
size_t spacing () const
 Returns the spacing between the beginning of two rows/columns of the represented matrix. More...
 
size_t capacity () const
 Returns the maximum capacity of the represented matrix. More...
 
size_t capacity (size_t i) const
 Returns the current capacity of the specified row/column of the represented matrix. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the represented matrix. More...
 
size_t nonZeros (size_t i) const
 Returns the number of non-zero elements in the specified row/column of the represented matrix. More...
 
void reset () const
 Reset to the default initial value. More...
 
void reset (size_t i) const
 Reset the specified row/column to the default initial values. More...
 
void clear () const
 Clearing the represented matrix. More...
 
void resize (size_t m, size_t n, bool preserve=true) const
 Changing the size of the represented matrix. More...
 
void extend (size_t m, size_t n, bool preserve=true) const
 Extending the size of the represented matrix. More...
 
void reserve (size_t n) const
 Setting the minimum capacity of the represented matrix. More...
 
Numeric functions
void transpose () const
 In-place transpose of the represented matrix. More...
 
void ctranspose () const
 In-place conjugate transpose of the represented matrix. More...
 
template<typename Other >
void scale (const Other &scalar) const
 Scaling of the matrix by the scalar value scalar ( $ A=B*s $). More...
 

Static Public Attributes

static constexpr bool simdEnabled = MT::simdEnabled
 Compilation flag for SIMD optimization.
 
static constexpr bool smpAssignable = MT::smpAssignable
 Compilation flag for SMP assignments.
 
static constexpr bool storageOrder
 Storage order of the matrix.
 

Detailed Description

template<typename PT, typename MT>
class blaze::DenseMatrixProxy< PT, MT >

Proxy backend for dense matrix types.

The DenseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a dense matrix and augments the Proxy interface by the complete interface required of dense matrices.

Member Function Documentation

◆ at()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Reference blaze::DenseMatrixProxy< PT, MT >::at ( size_t  i,
size_t  j 
) const
inline

Checked access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::invalid_argumentInvalid access to restricted element.
std::out_of_rangeInvalid matrix access index.

In contrast to the subscript operator this function always performs a check of the given access indices.

◆ begin()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Iterator blaze::DenseMatrixProxy< PT, MT >::begin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function returns a row/column iterator to the first element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first element of column i.

◆ capacity() [1/2]

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::capacity ( ) const
inline

Returns the maximum capacity of the represented matrix.

Returns
The capacity of the matrix.

◆ capacity() [2/2]

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::capacity ( size_t  i) const
inline

Returns the current capacity of the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The current capacity of row/column i.

This function returns the current capacity of the specified row/column. In case the storage order is set to rowMajor the function returns the capacity of row i, in case the storage flag is set to columnMajor the function returns the capacity of column i.

◆ cbegin()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::ConstIterator blaze::DenseMatrixProxy< PT, MT >::cbegin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.

This function returns a row/column iterator to the first element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first element of column i.

◆ cend()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::ConstIterator blaze::DenseMatrixProxy< PT, MT >::cend ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.

This function returns an row/column iterator just past the last element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last element of column i.

◆ clear()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::clear ( ) const
inline

Clearing the represented matrix.

Returns
void

This function clears the matrix to its default initial state.

◆ columns()

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::columns ( ) const
inline

Returns the current number of columns of the represented matrix.

Returns
The number of columns of the matrix.

◆ ctranspose()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::ctranspose ( ) const
inline

In-place conjugate transpose of the represented matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::invalid_argumentInvalid access to restricted element.

◆ data() [1/2]

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Pointer blaze::DenseMatrixProxy< PT, MT >::data ( ) const
inline

Low-level data access to matrix elements.

Returns
Pointer to the internal element storage.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function returns a pointer to the internal storage of the dense matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The matrix may use techniques such as padding to improve the alignment of the data. Whereas the number of elements within a row/column are given by the rows() and columns() member functions, respectively, the total number of elements including padding is given by the spacing() member function.

◆ data() [2/2]

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Pointer blaze::DenseMatrixProxy< PT, MT >::data ( size_t  i) const
inline

Low-level data access to matrix elements of row/column i.

Returns
Pointer to the internal element storage.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function returns a pointer to the internal storage for the elements in row/column i.

◆ end()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Iterator blaze::DenseMatrixProxy< PT, MT >::end ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function returns an row/column iterator just past the last element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last element of column i.

◆ extend()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::extend ( size_t  m,
size_t  n,
bool  preserve = true 
) const
inline

Extending the size of the represented matrix.

Parameters
mNumber of additional rows.
nNumber of additional columns.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function increases the matrix size by m rows and n columns. Depending on the type of the matrix, during this operation new dynamic memory may be allocated in case the capacity of the matrix is too small. Therefore this function potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true. However, note that depending on the type of the matrix new matrix elements may not initialized!

◆ nonZeros() [1/2]

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the represented matrix.

Returns
The number of non-zero elements in the matrix.

◆ nonZeros() [2/2]

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::nonZeros ( size_t  i) const
inline

Returns the number of non-zero elements in the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The number of non-zero elements of row/column i.

This function returns the current number of non-zero elements in the specified row/column. In case the storage order is set to rowMajor the function returns the number of non-zero elements in row i, in case the storage flag is set to columnMajor the function returns the number of non-zero elements in column i.

◆ operator()()

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Reference blaze::DenseMatrixProxy< PT, MT >::operator() ( size_t  i,
size_t  j 
) const
inline

Function call operator for the direct access to matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
Exceptions
std::invalid_argumentInvalid access to restricted element.

◆ operator~() [1/2]

BLAZE_ALWAYS_INLINE constexpr MatrixType& blaze::Matrix< PT , SO >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant matrices.

Returns
Reference of the actual type of the matrix.

◆ operator~() [2/2]

BLAZE_ALWAYS_INLINE constexpr const MatrixType& blaze::Matrix< PT , SO >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant matrices.

Returns
Constant reference of the actual type of the matrix.

◆ reserve()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reserve ( size_t  n) const
inline

Setting the minimum capacity of the represented matrix.

Parameters
nThe new minimum capacity of the matrix.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function increases the capacity of the dense matrix to at least n elements. The current values of the matrix elements are preserved.

◆ reset() [1/2]

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reset ( ) const
inline

Reset to the default initial value.

Returns
void

This function resets all elements of the matrix to the default initial values.

◆ reset() [2/2]

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reset ( size_t  i) const
inline

Reset the specified row/column to the default initial values.

Parameters
iThe index of the row/column.
Returns
void

This function resets the values in the specified row/column to their default value. In case the storage order is set to rowMajor the function resets the values in row i, in case the storage order is set to columnMajor the function resets the values in column i. Note that the capacity of the row/column remains unchanged.

◆ resize()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::resize ( size_t  m,
size_t  n,
bool  preserve = true 
) const
inline

Changing the size of the represented matrix.

Parameters
mThe new number of rows of the matrix.
nThe new number of columns of the matrix.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function resizes the matrix using the given size to $ m \times n $. Depending on the type of the matrix, during this operation new dynamic memory may be allocated in case the capacity of the matrix is too small. Note that this function may invalidate all existing views (submatrices, rows, columns, ...) on the matrix if it is used to shrink the matrix. Additionally, the resize operation potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true. However, note that depending on the type of the matrix new matrix elements may not initialized!

◆ rows()

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::rows ( ) const
inline

Returns the current number of rows of the represented matrix.

Returns
The number of rows of the matrix.

◆ scale()

template<typename PT , typename MT >
template<typename Other >
void blaze::DenseMatrixProxy< PT, MT >::scale ( const Other &  scalar) const
inline

Scaling of the matrix by the scalar value scalar ( $ A=B*s $).

Parameters
scalarThe scalar value for the matrix scaling.
Returns
void
Exceptions
std::invalid_argumentInvalid access to restricted element.

This function scales the matrix by applying the given scalar value scalar to each element of the matrix. For built-in and complex data types it has the same effect as using the multiplication assignment operator.

◆ spacing()

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::spacing ( ) const
inline

Returns the spacing between the beginning of two rows/columns of the represented matrix.

Returns
The spacing between the beginning of two rows/columns.

This function returns the spacing between the beginning of two rows/columns, i.e. the total number of elements of a row/column. In case the storage order is set to rowMajor the function returns the spacing between two rows, in case the storage flag is set to columnMajor the function returns the spacing between two columns.

◆ transpose()

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::transpose ( ) const
inline

In-place transpose of the represented matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::invalid_argumentInvalid access to restricted element.

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