Classes | Public Types | Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
blaze::UniformMatrix< Type, SO > Class Template Reference

Efficient implementation of a uniform matrix.The UniformMatrix class template is the representation of an arbitrary sized uniform matrix with elements of arbitrary type. The type of the elements and the storage order of the matrix can be specified via the two template parameters: More...

#include <UniformMatrix.h>

Inherits blaze::DenseMatrix< UniformMatrix< Type, SO >, SO >.

Classes

struct  Rebind
 Rebind mechanism to obtain a UniformMatrix with different data/element type. More...
 
struct  Resize
 Resize mechanism to obtain a UniformMatrix with different fixed dimensions. More...
 

Public Types

using This = UniformMatrix< Type, SO >
 Type of this UniformMatrix instance.
 
using BaseType = DenseMatrix< This, SO >
 Base type of this UniformMatrix instance.
 
using ResultType = This
 Result type for expression template evaluations.
 
using OppositeType = UniformMatrix< Type,!SO >
 Result type with opposite storage order for expression template evaluations.
 
using TransposeType = UniformMatrix< Type,!SO >
 Transpose type for expression template evaluations.
 
using ElementType = Type
 Type of the matrix elements.
 
using SIMDType = SIMDTrait_t< ElementType >
 SIMD type of the matrix elements.
 
using ReturnType = const Type &
 Return type for expression template evaluations.
 
using CompositeType = const This &
 Data type for composite expression templates.
 
using Reference = const Type &
 Reference to a non-constant matrix value.
 
using ConstReference = const Type &
 Reference to a constant matrix value.
 
using Pointer = const Type *
 Pointer to a non-constant matrix value.
 
using ConstPointer = const Type *
 Pointer to a constant matrix value.
 
using Iterator = UniformIterator< const Type, aligned >
 Iterator over non-constant elements.
 
using ConstIterator = UniformIterator< const Type, aligned >
 Iterator over constant elements.
 
using MatrixType = MT
 Type of the matrix.
 

Public Member Functions

template<typename MT , bool SO2>
UniformMatrix< Type, SO > & operator= (const Matrix< MT, SO2 > &rhs)
 Assignment operator for different matrices. More...
 
template<typename MT , bool SO2>
UniformMatrix< Type, SO > & operator+= (const Matrix< MT, SO2 > &rhs)
 Addition assignment operator for the addition of a matrix ( $ A+=B $). More...
 
template<typename MT , bool SO2>
UniformMatrix< Type, SO > & operator-= (const Matrix< MT, SO2 > &rhs)
 Subtraction assignment operator for the subtraction of a matrix ( $ A-=B $). More...
 
template<typename MT , bool SO2>
UniformMatrix< Type, SO > & operator%= (const Matrix< MT, SO2 > &rhs)
 Schur product assignment operator for the multiplication of a matrix ( $ A\circ=B $). More...
 
template<typename MT , bool SO2>
UniformMatrix< Type, SO > & operator*= (const Matrix< MT, SO2 > &rhs)
 Multiplication assignment operator for the multiplication of a matrix ( $ A*=B $). More...
 
template<typename Other >
UniformMatrix< Type, SO > & scale (const Other &scalar)
 Scaling of the matrix by the scalar value scalar ( $ A=B*s $). More...
 
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...
 
Constructors
constexpr UniformMatrix () noexcept
 The default constructor for UniformMatrix.
 
constexpr UniformMatrix (size_t m, size_t n)
 Constructor for a matrix of size $ m \times n $. More...
 
constexpr UniformMatrix (size_t m, size_t n, const Type &init)
 Constructor for a homogenous initialization of all $ m \times n $ matrix elements. More...
 
template<typename MT , bool SO2>
 UniformMatrix (const Matrix< MT, SO2 > &m)
 Conversion constructor from different matrices. More...
 
 UniformMatrix (const UniformMatrix &m)=default
 
 UniformMatrix (UniformMatrix &&m)=default
 
Destructor
 ~UniformMatrix ()=default
 
Data access functions
constexpr ConstReference operator() (size_t i, size_t j) const noexcept
 2D-access to the matrix elements. More...
 
ConstReference at (size_t i, size_t j) const
 Checked access to the matrix elements. More...
 
constexpr ConstPointer data () const noexcept
 Low-level data access to the matrix elements. More...
 
constexpr ConstPointer data (size_t i) const noexcept
 Low-level data access to the matrix elements of row/column i. More...
 
constexpr ConstIterator begin (size_t i) const noexcept
 Returns an iterator to the first element of row/column i. More...
 
constexpr ConstIterator cbegin (size_t i) const noexcept
 Returns an iterator to the first element of row/column i. More...
 
constexpr ConstIterator end (size_t i) const noexcept
 Returns an iterator just past the last element of row/column i. More...
 
constexpr ConstIterator cend (size_t i) const noexcept
 Returns an iterator just past the last element of row/column i. More...
 
Assignment operators
constexpr UniformMatrixoperator= (const Type &rhs)
 Homogenous assignment to all matrix elements. More...
 
UniformMatrixoperator= (const UniformMatrix &)=default
 
UniformMatrixoperator= (UniformMatrix &&)=default
 
template<typename MT , bool SO2>
UniformMatrixoperator= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
UniformMatrixoperator+= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
UniformMatrixoperator-= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
UniformMatrixoperator%= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
UniformMatrixoperator*= (const Matrix< MT, SO2 > &rhs)
 
template<typename ST >
auto operator*= (ST rhs) -> EnableIf_t< IsNumeric_v< ST >, UniformMatrix & >
 Multiplication assignment operator for the multiplication between a matrix and a scalar value ( $ A*=s $). More...
 
template<typename ST >
auto operator/= (ST rhs) -> EnableIf_t< IsNumeric_v< ST >, UniformMatrix & >
 Division assignment operator for the division between a matrix and a scalar value ( $ A/=s $). More...
 
Utility functions
constexpr size_t rows () const noexcept
 Returns the current number of rows of the matrix. More...
 
constexpr size_t columns () const noexcept
 Returns the current number of columns of the matrix. More...
 
constexpr size_t spacing () const noexcept
 Returns the spacing between the beginning of two rows/columns. More...
 
constexpr size_t capacity () const noexcept
 Returns the maximum capacity of the matrix. More...
 
constexpr size_t capacity (size_t i) const noexcept
 Returns the current capacity of the specified row/column. More...
 
size_t nonZeros () const
 Returns the total number of non-zero elements in the matrix. More...
 
size_t nonZeros (size_t i) const
 Returns the number of non-zero elements in the specified row/column. More...
 
constexpr void reset ()
 Reset to the default initial values. More...
 
constexpr void clear ()
 Clearing the $ M \times N $ matrix. More...
 
constexpr void resize (size_t m, size_t n, bool preserve=true)
 Changing the size of the matrix. More...
 
constexpr void extend (size_t m, size_t n, bool preserve=true)
 Extending the size of the matrix. More...
 
constexpr void swap (UniformMatrix &m) noexcept
 Swapping the contents of two matrices. More...
 
Numeric functions
constexpr UniformMatrixtranspose ()
 In-place transpose of the matrix. More...
 
constexpr UniformMatrixctranspose ()
 In-place conjugate transpose of the matrix. More...
 
template<typename Other >
UniformMatrixscale (const Other &scalar)
 
Expression template evaluation functions
template<typename Other >
bool canAlias (const Other *alias) const noexcept
 Returns whether the matrix can alias with the given address alias. More...
 
template<typename Other >
bool isAliased (const Other *alias) const noexcept
 Returns whether the matrix is aliased with the given address alias. More...
 
bool isAligned () const noexcept
 Returns whether the matrix is properly aligned in memory. More...
 
bool canSMPAssign () const noexcept
 Returns whether the matrix can be used in SMP assignments. More...
 
BLAZE_ALWAYS_INLINE SIMDType load (size_t i, size_t j) const noexcept
 Load of a SIMD element of the matrix. More...
 
BLAZE_ALWAYS_INLINE SIMDType loada (size_t i, size_t j) const noexcept
 Aligned load of a SIMD element of the matrix. More...
 
BLAZE_ALWAYS_INLINE SIMDType loadu (size_t i, size_t j) const noexcept
 Unaligned load of a SIMD element of the matrix. More...
 

Static Public Attributes

static constexpr bool simdEnabled = IsVectorizable_v<Type>
 Compilation flag for SIMD optimization. More...
 
static constexpr bool smpAssignable = !IsSMPAssignable_v<Type>
 Compilation flag for SMP assignments. More...
 
static constexpr bool storageOrder = SO
 Storage order of the matrix.
 

Private Attributes

Member variables
size_t m_
 The current number of rows of the matrix.
 
size_t n_
 The current number of columns of the matrix.
 
Type value_
 The value of all elements of the uniform matrix.
 

Static Private Attributes

static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size
 The number of elements packed within a single SIMD element.
 

Detailed Description

template<typename Type, bool SO = defaultStorageOrder>
class blaze::UniformMatrix< Type, SO >

Efficient implementation of a uniform matrix.

The UniformMatrix class template is the representation of an arbitrary sized uniform matrix with elements of arbitrary type. The type of the elements and the storage order of the matrix can be specified via the two template parameters:

template< typename Type, bool SO >

Depending on the storage order, the matrix elements are either stored in a row-wise fashion or in a column-wise fashion. Given the 2x3 matrix

\[\left(\begin{array}{*{3}{c}} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{array}\right)\]


in case of row-major order the elements are stored in the order

\[\left(\begin{array}{*{6}{c}} 1 & 2 & 3 & 4 & 5 & 6. \\ \end{array}\right)\]

In case of column-major order the elements are stored in the order

\[\left(\begin{array}{*{6}{c}} 1 & 4 & 2 & 5 & 3 & 6. \\ \end{array}\right)\]

The use of UniformMatrix is very natural and intuitive. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of row-major and column-major dense and sparse matrices with fitting element types. The following example gives an impression of the use of UniformMatrix:

UniformMatrix<double,rowMajor> A( 2, 3 ); // Default initialized, row-major 2x3 uniform matrix
A = 1.0; // Assignment to all elements of the uniform matrix
UniformMatrix<float,columnMajor> B( 2, 3, 2.0F ); // Directly, uniformly initialized 2x3 matrix
CompressedMatrix<float> C( 2, 3 ); // Empty row-major sparse single precision matrix
UniformMatrix<double,rowMajor> D; // Creation of a new row-major matrix as a copy of A
D = A + B; // Matrix addition and assignment to a row-major matrix
D = A - C; // Matrix subtraction and assignment to a column-major matrix
D = A * B; // Matrix multiplication between two matrices of different element types
A *= 2.0; // In-place scaling of matrix
D = 2.0 * A; // Scaling of matrix A
D = A * 2.0; // Scaling of matrix A
D += A - B; // Addition assignment
D -= A + C; // Subtraction assignment
D *= A * B; // Multiplication assignment

Constructor & Destructor Documentation

◆ UniformMatrix() [1/3]

template<typename Type , bool SO>
constexpr blaze::UniformMatrix< Type, SO >::UniformMatrix ( size_t  m,
size_t  n 
)
inlineexplicit

Constructor for a matrix of size $ m \times n $.

Parameters
mThe number of rows of the matrix.
nThe number of columns of the matrix.

◆ UniformMatrix() [2/3]

template<typename Type , bool SO>
constexpr blaze::UniformMatrix< Type, SO >::UniformMatrix ( size_t  m,
size_t  n,
const Type &  init 
)
inlineexplicit

Constructor for a homogenous initialization of all $ m \times n $ matrix elements.

Parameters
mThe number of rows of the matrix.
nThe number of columns of the matrix.
initThe initial value of the matrix elements.

All matrix elements are initialized with the specified value.

◆ UniformMatrix() [3/3]

template<typename Type , bool SO>
template<typename MT , bool SO2>
blaze::UniformMatrix< Type, SO >::UniformMatrix ( const Matrix< MT, SO2 > &  m)
inline

Conversion constructor from different matrices.

Parameters
mMatrix to be copied.
Exceptions
std::invalid_argumentInvalid setup of uniform vector.

The matrix is sized according to the given uniform matrix and initialized as a copy of this matrix.

Member Function Documentation

◆ at()

template<typename Type , bool SO>
UniformMatrix< Type, SO >::ConstReference blaze::UniformMatrix< Type, SO >::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::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 Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstIterator blaze::UniformMatrix< Type, SO >::begin ( size_t  i) const
inlinenoexcept

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

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.

◆ canAlias()

template<typename Type , bool SO>
template<typename Other >
bool blaze::UniformMatrix< Type, SO >::canAlias ( const Other *  alias) const
inlinenoexcept

Returns whether the matrix can alias with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this matrix, false if not.

This function returns whether the given address can alias with the matrix. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.

◆ canSMPAssign()

template<typename Type , bool SO>
bool blaze::UniformMatrix< Type, SO >::canSMPAssign ( ) const
inlinenoexcept

Returns whether the matrix can be used in SMP assignments.

Returns
true in case the matrix can be used in SMP assignments, false if not.

This function returns whether the matrix can be used in SMP assignments. In contrast to the smpAssignable member enumeration, which is based solely on compile time information, this function additionally provides runtime information (as for instance the current number of rows and/or columns of the matrix).

◆ capacity() [1/2]

template<typename Type , bool SO>
constexpr size_t blaze::UniformMatrix< Type, SO >::capacity ( ) const
inlinenoexcept

Returns the maximum capacity of the matrix.

Returns
The capacity of the matrix.

◆ capacity() [2/2]

template<typename Type , bool SO>
constexpr size_t blaze::UniformMatrix< Type, SO >::capacity ( size_t  i) const
inlinenoexcept

Returns the current capacity of the specified row/column.

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 Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstIterator blaze::UniformMatrix< Type, SO >::cbegin ( size_t  i) const
inlinenoexcept

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

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 Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstIterator blaze::UniformMatrix< Type, SO >::cend ( size_t  i) const
inlinenoexcept

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

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 Type , bool SO>
constexpr void blaze::UniformMatrix< Type, SO >::clear ( )
inline

Clearing the $ M \times N $ matrix.

Returns
void

After the clear() function, the size of the matrix is 0.

◆ columns()

template<typename Type , bool SO>
constexpr size_t blaze::UniformMatrix< Type, SO >::columns ( ) const
inlinenoexcept

Returns the current number of columns of the matrix.

Returns
The number of columns of the matrix.

◆ ctranspose()

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO > & blaze::UniformMatrix< Type, SO >::ctranspose ( )
inline

In-place conjugate transpose of the matrix.

Returns
Reference to the transposed matrix.

◆ data() [1/2]

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstPointer blaze::UniformMatrix< Type, SO >::data ( ) const
inlinenoexcept

Low-level data access to the matrix elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the uniform matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The uniform 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 Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstPointer blaze::UniformMatrix< Type, SO >::data ( size_t  i) const
inlinenoexcept

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

Parameters
iThe row/column index.
Returns
Pointer to the internal element storage.

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

◆ end()

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstIterator blaze::UniformMatrix< Type, SO >::end ( size_t  i) const
inlinenoexcept

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

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.

◆ extend()

template<typename Type , bool SO>
constexpr void blaze::UniformMatrix< Type, SO >::extend ( size_t  m,
size_t  n,
bool  preserve = true 
)
inline

Extending the size of the 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

This function increases the matrix size by m rows and n columns. Note that this function potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true.

◆ isAliased()

template<typename Type , bool SO>
template<typename Other >
bool blaze::UniformMatrix< Type, SO >::isAliased ( const Other *  alias) const
inlinenoexcept

Returns whether the matrix is aliased with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this matrix, false if not.

This function returns whether the given address is aliased with the matrix. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.

◆ isAligned()

template<typename Type , bool SO>
bool blaze::UniformMatrix< Type, SO >::isAligned ( ) const
inlinenoexcept

Returns whether the matrix is properly aligned in memory.

Returns
true in case the matrix is aligned, false if not.

This function returns whether the matrix is guaranteed to be properly aligned in memory, i.e. whether the beginning and the end of each row/column of the matrix are guaranteed to conform to the alignment restrictions of the element type Type.

◆ load()

template<typename Type , bool SO>
BLAZE_ALWAYS_INLINE UniformMatrix< Type, SO >::SIMDType blaze::UniformMatrix< Type, SO >::load ( size_t  i,
size_t  j 
) const
noexcept

Load of a SIMD element of the matrix.

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
The loaded SIMD element.

This function performs a load of a specific SIMD element of the dense matrix. The row index must be smaller than the number of rows and the column index must be smaller then the number of columns. Additionally, the column index (in case of a row-major matrix) or the row index (in case of a column-major matrix) must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

◆ loada()

template<typename Type , bool SO>
BLAZE_ALWAYS_INLINE UniformMatrix< Type, SO >::SIMDType blaze::UniformMatrix< Type, SO >::loada ( size_t  i,
size_t  j 
) const
noexcept

Aligned load of a SIMD element of the matrix.

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
The loaded SIMD element.

This function performs an aligned load of a specific SIMD element of the dense matrix. The row index must be smaller than the number of rows and the column index must be smaller than the number of columns. Additionally, the column index (in case of a row-major matrix) or the row index (in case of a column-major matrix) must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

◆ loadu()

template<typename Type , bool SO>
BLAZE_ALWAYS_INLINE UniformMatrix< Type, SO >::SIMDType blaze::UniformMatrix< Type, SO >::loadu ( size_t  i,
size_t  j 
) const
noexcept

Unaligned load of a SIMD element of the matrix.

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
The loaded SIMD element.

This function performs an unaligned load of a specific SIMD element of the dense matrix. The row index must be smaller than the number of rows and the column index must be smaller than the number of columns. Additionally, the column index (in case of a row-major matrix) or the row index (in case of a column-major matrix) must be a multiple of the number of values inside the SIMD element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

◆ nonZeros() [1/2]

template<typename Type , bool SO>
size_t blaze::UniformMatrix< Type, SO >::nonZeros ( ) const
inline

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

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

◆ nonZeros() [2/2]

template<typename Type , bool SO>
size_t blaze::UniformMatrix< Type, SO >::nonZeros ( size_t  i) const
inline

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

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 Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::operator%= ( const Matrix< MT, SO2 > &  rhs)
inline

Schur product assignment operator for the multiplication of a matrix ( $ A\circ=B $).

Parameters
rhsThe right-hand side matrix for the Schur product.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator()()

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO >::ConstReference blaze::UniformMatrix< Type, SO >::operator() ( size_t  i,
size_t  j 
) const
inlinenoexcept

2D-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.

This function only performs an index check in case BLAZE_USER_ASSERT() is active. In contrast, the at() function is guaranteed to perform a check of the given access indices.

◆ operator*=() [1/2]

template<typename Type , bool SO>
template<typename ST >
auto blaze::UniformMatrix< Type, SO >::operator*= ( ST  scalar) -> EnableIf_t< IsNumeric_v<ST>, UniformMatrix& >
inline

Multiplication assignment operator for the multiplication between a matrix and a scalar value ( $ A*=s $).

Parameters
scalarThe right-hand side scalar value for the multiplication.
Returns
Reference to the matrix.

◆ operator*=() [2/2]

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::operator*= ( const Matrix< MT, SO2 > &  rhs)
inline

Multiplication assignment operator for the multiplication of a matrix ( $ A*=B $).

Parameters
rhsThe right-hand side matrix for the multiplication.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator+=()

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::operator+= ( const Matrix< MT, SO2 > &  rhs)
inline

Addition assignment operator for the addition of a matrix ( $ A+=B $).

Parameters
rhsThe right-hand side matrix to be added to the matrix.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator-=()

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::operator-= ( const Matrix< MT, SO2 > &  rhs)
inline

Subtraction assignment operator for the subtraction of a matrix ( $ A-=B $).

Parameters
rhsThe right-hand side matrix to be subtracted from the matrix.
Returns
Reference to the matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator/=()

template<typename Type , bool SO>
template<typename ST >
auto blaze::UniformMatrix< Type, SO >::operator/= ( ST  scalar) -> EnableIf_t< IsNumeric_v<ST>, UniformMatrix& >
inline

Division assignment operator for the division between a matrix and a scalar value ( $ A/=s $).

Parameters
scalarThe right-hand side scalar value for the division.
Returns
Reference to the matrix.

◆ operator=() [1/2]

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO > & blaze::UniformMatrix< Type, SO >::operator= ( const Type &  rhs)
inline

Homogenous assignment to all matrix elements.

Parameters
rhsScalar value to be assigned to all matrix elements.
Returns
Reference to the assigned matrix.

◆ operator=() [2/2]

template<typename Type, bool SO = defaultStorageOrder>
template<typename MT , bool SO2>
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::operator= ( const Matrix< MT, SO2 > &  rhs)
inline

Assignment operator for different matrices.

Parameters
rhsMatrix to be copied.
Returns
Reference to the assigned matrix.

The matrix is resized according to the given $ M \times N $ matrix and initialized as a copy of this matrix.

◆ operator~() [1/2]

template<typename MT, bool SO>
BLAZE_ALWAYS_INLINE constexpr MatrixType& blaze::Matrix< MT, SO >::operator~ ( )
inlinenoexceptinherited

Conversion operator for non-constant matrices.

Returns
Reference of the actual type of the matrix.

◆ operator~() [2/2]

template<typename MT, bool SO>
BLAZE_ALWAYS_INLINE constexpr const MatrixType& blaze::Matrix< MT, SO >::operator~ ( ) const
inlinenoexceptinherited

Conversion operator for constant matrices.

Returns
Constant reference of the actual type of the matrix.

◆ reset()

template<typename Type , bool SO>
constexpr void blaze::UniformMatrix< Type, SO >::reset ( )
inline

Reset to the default initial values.

Returns
void

◆ resize()

template<typename Type , bool SO>
void constexpr blaze::UniformMatrix< Type, SO >::resize ( size_t  m,
size_t  n,
bool  preserve = true 
)

Changing the size of the 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

This function resizes the matrix using the given size to $ m \times n $. 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.

◆ rows()

template<typename Type , bool SO>
constexpr size_t blaze::UniformMatrix< Type, SO >::rows ( ) const
inlinenoexcept

Returns the current number of rows of the matrix.

Returns
The number of rows of the matrix.

◆ scale()

template<typename Type, bool SO = defaultStorageOrder>
template<typename Other >
UniformMatrix<Type,SO>& blaze::UniformMatrix< Type, SO >::scale ( const Other &  scalar)
inline

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

Parameters
scalarThe scalar value for the matrix scaling.
Returns
Reference to the matrix.

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:

// ... Resizing and initialization
A *= 4; // Scaling of the matrix
A.scale( 4 ); // Same effect as above

◆ spacing()

template<typename Type , bool SO>
constexpr size_t blaze::UniformMatrix< Type, SO >::spacing ( ) const
inlinenoexcept

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

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.

◆ swap()

template<typename Type , bool SO>
constexpr void blaze::UniformMatrix< Type, SO >::swap ( UniformMatrix< Type, SO > &  m)
inlinenoexcept

Swapping the contents of two matrices.

Parameters
mThe matrix to be swapped.
Returns
void

◆ transpose()

template<typename Type , bool SO>
constexpr UniformMatrix< Type, SO > & blaze::UniformMatrix< Type, SO >::transpose ( )
inline

In-place transpose of the matrix.

Returns
Reference to the transposed matrix.

Member Data Documentation

◆ simdEnabled

template<typename Type, bool SO = defaultStorageOrder>
constexpr bool blaze::UniformMatrix< Type, SO >::simdEnabled = IsVectorizable_v<Type>
static

Compilation flag for SIMD optimization.

The simdEnabled compilation flag indicates whether expressions the matrix is involved in can be optimized via SIMD operations. In case the element type of the matrix is a vectorizable data type, the simdEnabled compilation flag is set to true, otherwise it is set to false.

◆ smpAssignable

template<typename Type, bool SO = defaultStorageOrder>
constexpr bool blaze::UniformMatrix< Type, SO >::smpAssignable = !IsSMPAssignable_v<Type>
static

Compilation flag for SMP assignments.

The smpAssignable compilation flag indicates whether the matrix can be used in SMP (shared memory parallel) assignments (both on the left-hand and right-hand side of the assignment).


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