![]() |
Efficient implementation of a dynamically sized matrix with static memory.The HybridMatrix class template combines the flexibility of a dynamically sized matrix with the efficiency and performance of a fixed-size matrix. It is implemented as a crossing between the blaze::StaticMatrix and the blaze::DynamicMatrix class templates: Similar to the static matrix it uses static stack memory instead of dynamically allocated memory and similar to the dynamic matrix it can be resized (within the extend of the static memory). The type of the elements, the maximum number of rows and columns and the storage order of the matrix can be specified via the four template parameters: More...
#include <HybridMatrix.h>
Inherits blaze::DenseMatrix< HybridMatrix< Type, M, N, SO >, SO >.
Classes | |
struct | Rebind |
Rebind mechanism to obtain a HybridMatrix with different data/element type. More... | |
struct | Resize |
Resize mechanism to obtain a HybridMatrix with different fixed dimensions. More... | |
Public Types | |
enum | : bool { simdEnabled = IsVectorizable<Type>::value } |
Compilation flag for SIMD optimization. More... | |
enum | : bool { smpAssignable = false } |
Compilation flag for SMP assignments. More... | |
using | This = HybridMatrix< Type, M, N, SO > |
Type of this HybridMatrix instance. | |
using | BaseType = DenseMatrix< This, SO > |
Base type of this HybridMatrix instance. | |
using | ResultType = This |
Result type for expression template evaluations. | |
using | OppositeType = HybridMatrix< Type, M, N,!SO > |
Result type with opposite storage order for expression template evaluations. | |
using | TransposeType = HybridMatrix< Type, N, M,!SO > |
Transpose type for expression template evaluations. | |
using | ElementType = Type |
Type of the matrix elements. | |
using | SIMDType = SIMDTrait_< 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 = Type & |
Reference to a non-constant matrix value. | |
using | ConstReference = const Type & |
Reference to a constant matrix value. | |
using | Pointer = Type * |
Pointer to a non-constant matrix value. | |
using | ConstPointer = const Type * |
Pointer to a constant matrix value. | |
using | Iterator = DenseIterator< Type, usePadding > |
Iterator over non-constant elements. | |
using | ConstIterator = DenseIterator< const Type, usePadding > |
Iterator over constant elements. | |
using | MatrixType = MT |
Type of the matrix. | |
Public Member Functions | |
template<typename Other , size_t Rows, size_t Cols> | |
HybridMatrix< Type, M, N, SO > & | operator= (const Other(&array)[Rows][Cols]) |
Array assignment to all matrix elements. More... | |
template<typename MT , bool SO2> | |
HybridMatrix< Type, M, N, SO > & | operator= (const Matrix< MT, SO2 > &rhs) |
Assignment operator for different matrices. More... | |
template<typename MT , bool SO2> | |
HybridMatrix< Type, M, N, SO > & | operator+= (const Matrix< MT, SO2 > &rhs) |
Addition assignment operator for the addition of a matrix ( ![]() | |
template<typename MT , bool SO2> | |
HybridMatrix< Type, M, N, SO > & | operator-= (const Matrix< MT, SO2 > &rhs) |
Subtraction assignment operator for the subtraction of a matrix ( ![]() | |
template<typename MT , bool SO2> | |
HybridMatrix< Type, M, N, SO > & | operator%= (const Matrix< MT, SO2 > &rhs) |
Schur product assignment operator for the multiplication of a matrix ( ![]() | |
template<typename MT , bool SO2> | |
HybridMatrix< Type, M, N, SO > & | operator*= (const Matrix< MT, SO2 > &rhs) |
Multiplication assignment operator for the multiplication of a matrix ( ![]() | |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, HybridMatrix< Type, M, N, SO > > & | operator*= (Other rhs) |
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( ![]() | |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, HybridMatrix< Type, M, N, SO > > & | operator/= (Other rhs) |
Division assignment operator for the division of a matrix by a scalar value ( ![]() | |
template<typename Other > | |
HybridMatrix< Type, M, N, SO > & | scale (const Other &scalar) |
Scaling of the matrix by the scalar value scalar ( ![]() | |
template<typename MT , bool SO2> | |
DisableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedAssign< MT > > | assign (const DenseMatrix< MT, SO2 > &rhs) |
Default implementation of the assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
EnableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedAssign< MT > > | assign (const DenseMatrix< MT, SO2 > &rhs) |
SIMD optimized implementation of the assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedAddAssign< MT > > | addAssign (const DenseMatrix< MT, SO2 > &rhs) |
Default implementation of the addition assignment of a row-major dense matrix. More... | |
template<typename MT , bool SO2> | |
EnableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedAddAssign< MT > > | addAssign (const DenseMatrix< MT, SO2 > &rhs) |
SIMD optimized implementation of the addition assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedSubAssign< MT > > | subAssign (const DenseMatrix< MT, SO2 > &rhs) |
Default implementation of the subtraction assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
EnableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedSubAssign< MT > > | subAssign (const DenseMatrix< MT, SO2 > &rhs) |
SIMD optimized implementation of the subtraction assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedSchurAssign< MT > > | schurAssign (const DenseMatrix< MT, SO2 > &rhs) |
Default implementation of the Schur product assignment of a dense matrix. More... | |
template<typename MT , bool SO2> | |
EnableIf_< typename HybridMatrix< Type, M, N, SO >::BLAZE_TEMPLATE VectorizedSchurAssign< MT > > | schurAssign (const DenseMatrix< MT, SO2 > &rhs) |
SIMD optimized implementation of the Schur product assignment of a dense matrix. More... | |
BLAZE_ALWAYS_INLINE MatrixType & | operator~ () noexcept |
Conversion operator for non-constant matrices. More... | |
BLAZE_ALWAYS_INLINE const MatrixType & | operator~ () const noexcept |
Conversion operator for constant matrices. More... | |
Constructors | |
HybridMatrix () | |
The default constructor for HybridMatrix. More... | |
HybridMatrix (size_t m, size_t n) | |
Constructor for a matrix of size ![]() | |
HybridMatrix (size_t m, size_t n, const Type &init) | |
Constructor for a homogenous initialization of all ![]() | |
HybridMatrix (initializer_list< initializer_list< Type > > list) | |
List initialization of all matrix elements. More... | |
template<typename Other > | |
HybridMatrix (size_t m, size_t n, const Other *array) | |
Array initialization of all matrix elements. More... | |
template<typename Other , size_t Rows, size_t Cols> | |
HybridMatrix (const Other(&array)[Rows][Cols]) | |
Array initialization of all matrix elements. More... | |
HybridMatrix (const HybridMatrix &m) | |
The copy constructor for HybridMatrix. More... | |
template<typename MT , bool SO2> | |
HybridMatrix (const Matrix< MT, SO2 > &m) | |
Conversion constructor from different matrices. More... | |
Data access functions | |
Reference | operator() (size_t i, size_t j) noexcept |
2D-access to the matrix elements. More... | |
ConstReference | operator() (size_t i, size_t j) const noexcept |
2D-access to the matrix elements. More... | |
Reference | at (size_t i, size_t j) |
Checked access to the matrix elements. More... | |
ConstReference | at (size_t i, size_t j) const |
Checked access to the matrix elements. More... | |
Pointer | data () noexcept |
Low-level data access to the matrix elements. More... | |
ConstPointer | data () const noexcept |
Low-level data access to the matrix elements. More... | |
Pointer | data (size_t i) noexcept |
Low-level data access to the matrix elements of row/column i. More... | |
ConstPointer | data (size_t i) const noexcept |
Low-level data access to the matrix elements of row/column i. More... | |
Iterator | begin (size_t i) noexcept |
Returns an iterator to the first element of row/column i. More... | |
ConstIterator | begin (size_t i) const noexcept |
Returns an iterator to the first element of row/column i. More... | |
ConstIterator | cbegin (size_t i) const noexcept |
Returns an iterator to the first element of row/column i. More... | |
Iterator | end (size_t i) noexcept |
Returns an iterator just past the last element of row/column i. More... | |
ConstIterator | end (size_t i) const noexcept |
Returns an iterator just past the last element of row/column i. More... | |
ConstIterator | cend (size_t i) const noexcept |
Returns an iterator just past the last element of row/column i. More... | |
Assignment operators | |
HybridMatrix & | operator= (const Type &set) |
Homogenous assignment to all matrix elements. More... | |
HybridMatrix & | operator= (initializer_list< initializer_list< Type > > list) |
List assignment to all matrix elements. More... | |
template<typename Other , size_t Rows, size_t Cols> | |
HybridMatrix & | operator= (const Other(&array)[Rows][Cols]) |
HybridMatrix & | operator= (const HybridMatrix &rhs) |
Copy assignment operator for HybridMatrix. More... | |
template<typename MT , bool SO2> | |
HybridMatrix & | operator= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
HybridMatrix & | operator+= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
HybridMatrix & | operator-= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
HybridMatrix & | operator%= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
HybridMatrix & | operator*= (const Matrix< MT, SO2 > &rhs) |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, HybridMatrix > & | operator*= (Other rhs) |
template<typename Other > | |
EnableIf_< IsNumeric< Other >, HybridMatrix > & | operator/= (Other rhs) |
Utility functions | |
size_t | rows () const noexcept |
Returns the current number of rows of the matrix. More... | |
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. More... | |
constexpr size_t | capacity () const noexcept |
Returns the maximum capacity of the matrix. More... | |
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... | |
void | reset () |
Reset to the default initial values. More... | |
void | reset (size_t i) |
Reset the specified row/column to the default initial values. More... | |
void | clear () |
Clearing the hybrid matrix. More... | |
void | resize (size_t m, size_t n, bool preserve=true) |
Changing the size of the matrix. More... | |
void | extend (size_t m, size_t n, bool preserve=true) |
Extending the size of the matrix. More... | |
void | swap (HybridMatrix &m) noexcept |
Swapping the contents of two hybrid matrices. More... | |
Numeric functions | |
HybridMatrix & | transpose () |
In-place transpose of the matrix. More... | |
HybridMatrix & | ctranspose () |
In-place conjugate transpose of the matrix. More... | |
template<typename Other > | |
HybridMatrix & | scale (const Other &scalar) |
Debugging functions | |
bool | isIntact () const noexcept |
Returns whether the invariants of the hybrid matrix are intact. More... | |
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... | |
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... | |
BLAZE_ALWAYS_INLINE void | store (size_t i, size_t j, const SIMDType &value) noexcept |
Store of a SIMD element of the matrix. More... | |
BLAZE_ALWAYS_INLINE void | storea (size_t i, size_t j, const SIMDType &value) noexcept |
Aligned store of a SIMD element of the matrix. More... | |
BLAZE_ALWAYS_INLINE void | storeu (size_t i, size_t j, const SIMDType &value) noexcept |
Unaligned store of a SIMD element of the matrix. More... | |
BLAZE_ALWAYS_INLINE void | stream (size_t i, size_t j, const SIMDType &value) noexcept |
Aligned, non-temporal store of a SIMD element of the matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< VectorizedAssign< MT > > | assign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
EnableIf_< VectorizedAssign< MT > > | assign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT > | |
void | assign (const SparseMatrix< MT, SO > &rhs) |
Default implementation of the assignment of a row-major sparse matrix. More... | |
template<typename MT > | |
void | assign (const SparseMatrix< MT,!SO > &rhs) |
Default implementation of the assignment of a column-major sparse matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< VectorizedAddAssign< MT > > | addAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
EnableIf_< VectorizedAddAssign< MT > > | addAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT > | |
void | addAssign (const SparseMatrix< MT, SO > &rhs) |
Default implementation of the addition assignment of a row-major sparse matrix. More... | |
template<typename MT > | |
void | addAssign (const SparseMatrix< MT,!SO > &rhs) |
Default implementation of the addition assignment of a column-major sparse matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< VectorizedSubAssign< MT > > | subAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
EnableIf_< VectorizedSubAssign< MT > > | subAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT > | |
void | subAssign (const SparseMatrix< MT, SO > &rhs) |
Default implementation of the subtraction assignment of a row-major sparse matrix. More... | |
template<typename MT > | |
void | subAssign (const SparseMatrix< MT,!SO > &rhs) |
Default implementation of the subtraction assignment of a column-major sparse matrix. More... | |
template<typename MT , bool SO2> | |
DisableIf_< VectorizedSchurAssign< MT > > | schurAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
EnableIf_< VectorizedSchurAssign< MT > > | schurAssign (const DenseMatrix< MT, SO2 > &rhs) |
template<typename MT > | |
void | schurAssign (const SparseMatrix< MT, SO > &rhs) |
Default implementation of the Schur product assignment of a row-major sparse matrix. More... | |
template<typename MT > | |
void | schurAssign (const SparseMatrix< MT,!SO > &rhs) |
Default implementation of the Schur product assignment of a column-major sparse matrix. More... | |
Static Public Member Functions | |
Memory functions | |
static void * | operator new (std::size_t size) |
Class specific implementation of operator new. More... | |
static void * | operator new[] (std::size_t size) |
Class specific implementation of operator new[]. More... | |
static void * | operator new (std::size_t size, const std::nothrow_t &) |
Class specific implementation of the no-throw operator new. More... | |
static void * | operator new[] (std::size_t size, const std::nothrow_t &) |
Class specific implementation of the no-throw operator new[]. More... | |
static void | operator delete (void *ptr) |
Class specific implementation of operator delete. More... | |
static void | operator delete[] (void *ptr) |
Class specific implementation of operator delete[]. More... | |
static void | operator delete (void *ptr, const std::nothrow_t &) |
Class specific implementation of no-throw operator delete. More... | |
static void | operator delete[] (void *ptr, const std::nothrow_t &) |
Class specific implementation of no-throw operator delete[]. More... | |
Private Attributes | |
Member variables | |
AlignedArray< Type, M *NN > | v_ |
The statically allocated matrix elements. More... | |
size_t | m_ |
The current number of rows of the matrix. | |
size_t | n_ |
The current number of columns of the matrix. | |
Efficient implementation of a dynamically sized matrix with static memory.
The HybridMatrix class template combines the flexibility of a dynamically sized matrix with the efficiency and performance of a fixed-size matrix. It is implemented as a crossing between the blaze::StaticMatrix and the blaze::DynamicMatrix class templates: Similar to the static matrix it uses static stack memory instead of dynamically allocated memory and similar to the dynamic matrix it can be resized (within the extend of the static memory). The type of the elements, the maximum number of rows and columns and the storage order of the matrix can be specified via the four template parameters:
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
in case of row-major order the elements are stored in the order
In case of column-major order the elements are stored in the order
The use of HybridMatrix 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 HybridMatrix:
anonymous enum : bool |
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.
anonymous enum : bool |
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).
|
inlineexplicit |
The default constructor for HybridMatrix.
The size of a default constructed HybridMatrix is initially set to 0.
|
inlineexplicit |
Constructor for a matrix of size . No element initialization is performed!
m | The number of rows of the matrix. |
n | The number of columns of the matrix. |
std::invalid_argument | Invalid number of rows for hybrid matrix. |
std::invalid_argument | Invalid number of columns for hybrid matrix. |
This constructor creates a hybrid matrix of size , but leaves the elements uninitialized. In case m is larger than the maximum allowed number of rows (i.e. m > M) or n is larger than the maximum allowed number of columns a std::invalid_argument exception is thrown.
|
inlineexplicit |
Constructor for a homogenous initialization of all matrix elements.
m | The number of rows of the matrix. |
n | The number of columns of the matrix. |
init | The initial value of the matrix elements. |
std::invalid_argument | Invalid number of rows for hybrid matrix. |
std::invalid_argument | Invalid number of columns for hybrid matrix. |
This constructor creates a hybrid matrix of size and initializes all matrix elements with the specified value. In case m is larger than the maximum allowed number of rows (i.e. m > M) or n is larger than the maximum allowed number of columns a std::invalid_argument exception is thrown.
|
inlineexplicit |
List initialization of all matrix elements.
list | The initializer list. |
std::invalid_argument | Invalid number of rows for hybrid matrix. |
std::invalid_argument | Invalid number of columns for hybrid matrix. |
This constructor provides the option to explicitly initialize the elements of the matrix by means of an initializer list:
The matrix is sized according to the size of the initializer list and all its elements are initialized by the values of the given initializer list. Missing values are initialized as default (as e.g. the value 6 in the example). Note that in case the size of the top-level initializer list exceeds the number of rows or the size of any nested list exceeds the number of columns, a std::invalid_argument exception is thrown.
|
inlineexplicit |
Array initialization of all matrix elements.
m | The number of rows of the matrix. |
n | The number of columns of the matrix. |
array | Dynamic array for the initialization. |
std::invalid_argument | Invalid number of rows for hybrid matrix. |
std::invalid_argument | Invalid number of columns for hybrid matrix. |
This constructor offers the option to directly initialize the elements of the matrix with a dynamic array:
The matrix is sized according to the given size of the array and initialized with the values from the given array. In case m is larger than the maximum allowed number of rows (i.e. m > M) or n is larger than the maximum allowed number of columns a std::invalid_argument exception is thrown. Note that it is expected that the given array has at least m by n elements. Providing an array with less elements results in undefined behavior!
|
inlineexplicit |
Array initialization of all matrix elements.
array | ![]() |
This constructor offers the option to directly initialize the elements of the matrix with a static array:
The matrix is sized according to the size of the array and initialized with the values from the given array. Missing values are initialized with default values (as e.g. the value 6 in the example).
|
inline |
The copy constructor for HybridMatrix.
m | Matrix to be copied. |
The copy constructor is explicitly defined due to the required dynamic memory management and in order to enable/facilitate NRV optimization.
|
inline |
Conversion constructor from different matrices.
m | Matrix to be copied. |
std::invalid_argument | Invalid setup of hybrid matrix. |
|
inline |
Default implementation of the addition assignment of a row-major sparse matrix.
rhs | The right-hand side sparse matrix to be added. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the addition assignment of a column-major sparse matrix.
rhs | The right-hand side sparse matrix to be added. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the addition assignment of a row-major dense matrix.
rhs | The right-hand side dense matrix to be added. |
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. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the addition assignment of a dense matrix.
rhs | The right-hand side dense matrix to be added. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the assignment of a row-major sparse matrix.
rhs | The right-hand side sparse matrix to be assigned. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the assignment of a column-major sparse matrix.
rhs | The right-hand side sparse matrix to be assigned. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the assignment of a dense matrix.
rhs | The right-hand side dense matrix to be assigned. |
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. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the assignment of a dense matrix.
rhs | The right-hand side dense matrix to be assigned. |
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. Instead of using this function use the assignment operator.
|
inline |
Checked access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
std::out_of_range | Invalid matrix access index. |
In contrast to the subscript operator this function always performs a check of the given access indices.
|
inline |
Checked access to the matrix elements.
i | Access index for the row. The index has to be in the range ![]() |
j | Access index for the column. The index has to be in the range ![]() |
std::out_of_range | Invalid matrix access index. |
In contrast to the subscript operator this function always performs a check of the given access indices.
|
inlinenoexcept |
Returns an iterator to the first element of row/column i.
i | The row/column index. |
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.
|
inlinenoexcept |
Returns an iterator to the first element of row/column i.
i | The row/column index. |
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.
|
inlinenoexcept |
Returns whether the matrix can alias with the given address alias.
alias | The alias to be checked. |
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.
|
inlinenoexcept |
Returns the maximum capacity of the matrix.
|
inlinenoexcept |
Returns the current capacity of the specified row/column.
i | The index of the row/column. |
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.
|
inlinenoexcept |
Returns an iterator to the first element of row/column i.
i | The row/column index. |
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.
|
inlinenoexcept |
Returns an iterator just past the last element of row/column i.
i | The row/column index. |
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.
|
inline |
|
inlinenoexcept |
Returns the current number of columns of the matrix.
|
inline |
In-place conjugate transpose of the matrix.
std::logic_error | Impossible transpose operation. |
This function transposes the hybrid matrix in-place. Note that this function can only be used on hybrid matrices whose current dimensions allow an in-place transpose operation. In case the current number of rows is larger than the maximum number of columns or if the current number of columns is larger than the maximum number of rows, an std::logic_error is thrown.
|
inlinenoexcept |
Low-level data access to the matrix elements.
This function returns a pointer to the internal storage of the hybrid matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The hybrid 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.
|
inlinenoexcept |
Low-level data access to the matrix elements.
This function returns a pointer to the internal storage of the hybrid matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The hybrid 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.
|
inlinenoexcept |
Low-level data access to the matrix elements of row/column i.
i | The row/column index. |
This function returns a pointer to the internal storage for the elements in row/column i.
|
inlinenoexcept |
Low-level data access to the matrix elements of row/column i.
i | The row/column index. |
This function returns a pointer to the internal storage for the elements in row/column i.
|
inlinenoexcept |
Returns an iterator just past the last element of row/column i.
i | The row/column index. |
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.
|
inlinenoexcept |
Returns an iterator just past the last element of row/column i.
i | The row/column index. |
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.
|
inline |
Extending the size of the matrix.
m | Number of additional rows. |
n | Number of additional columns. |
preserve | true if the old values of the matrix should be preserved, false if not. |
This function increases the matrix size by m rows and n columns. In case the resulting number of rows or columns is larger than the maximum number of rows or columns (i.e. if m > M or n > N) a std::invalid_argument exception is thrown. During this operation, all matrix elements are potentially changed. In order to preserve the old matrix values, the preserve flag can be set to true.
Note that new matrix elements are not initialized!
|
inlinenoexcept |
Returns whether the matrix is aliased with the given address alias.
alias | The alias to be checked. |
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.
|
inlinenoexcept |
Returns whether the matrix is properly aligned in memory.
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.
|
inlinenoexcept |
Returns whether the invariants of the hybrid matrix are intact.
This function checks whether the invariants of the hybrid matrix are intact, i.e. if its state is valid. In case the invariants are intact, the function returns true, else it will return false.
|
noexcept |
Load of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
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.
|
noexcept |
Aligned load of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
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.
|
noexcept |
Unaligned load of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
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.
|
inline |
Returns the total number of non-zero elements in the matrix.
|
inline |
Returns the number of non-zero elements in the specified row/column.
i | The index of the row/column. |
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.
|
inlinestatic |
Class specific implementation of operator delete.
ptr | The memory to be deallocated. |
|
inlinestatic |
Class specific implementation of no-throw operator delete.
ptr | The memory to be deallocated. |
|
inlinestatic |
Class specific implementation of operator delete[].
ptr | The memory to be deallocated. |
|
inlinestatic |
Class specific implementation of no-throw operator delete[].
ptr | The memory to be deallocated. |
|
inlinestatic |
Class specific implementation of operator new.
size | The total number of bytes to be allocated. |
std::bad_alloc | Allocation failed. |
This class-specific implementation of operator new provides the functionality to allocate dynamic memory based on the alignment restrictions of the HybridMatrix class template.
|
inlinestatic |
Class specific implementation of the no-throw operator new.
size | The total number of bytes to be allocated. |
std::bad_alloc | Allocation failed. |
This class-specific implementation of operator new provides the functionality to allocate dynamic memory based on the alignment restrictions of the HybridMatrix class template.
|
inlinestatic |
Class specific implementation of operator new[].
size | The total number of bytes to be allocated. |
std::bad_alloc | Allocation failed. |
This class-specific implementation of operator new provides the functionality to allocate dynamic memory based on the alignment restrictions of the HybridMatrix class template.
|
inlinestatic |
Class specific implementation of the no-throw operator new[].
size | The total number of bytes to be allocated. |
std::bad_alloc | Allocation failed. |
This class-specific implementation of operator new provides the functionality to allocate dynamic memory based on the alignment restrictions of the HybridMatrix class template.
|
inline |
Schur product assignment operator for the multiplication of a matrix ( ).
rhs | The right-hand side matrix for the Schur product. |
std::invalid_argument | Matrix sizes do not match. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.
|
inlinenoexcept |
2D-access to the matrix elements.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
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.
|
inlinenoexcept |
2D-access to the matrix elements.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
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.
|
inline |
Multiplication assignment operator for the multiplication of a matrix ( ).
rhs | The right-hand side matrix for the multiplication. |
std::invalid_argument | Matrix sizes do not match. |
In case the current sizes of the two given matrices don't match, a std::invalid_argument is thrown.
|
inline |
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( ).
rhs | The right-hand side scalar value for the multiplication. |
|
inline |
Addition assignment operator for the addition of a matrix ( ).
rhs | The right-hand side matrix to be added to the matrix. |
std::invalid_argument | Matrix sizes do not match. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.
|
inline |
Subtraction assignment operator for the subtraction of a matrix ( ).
rhs | The right-hand side matrix to be subtracted from the matrix. |
std::invalid_argument | Matrix sizes do not match. |
In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.
|
inline |
Division assignment operator for the division of a matrix by a scalar value ( ).
rhs | The right-hand side scalar value for the division. |
|
inline |
Homogenous assignment to all matrix elements.
set | Scalar value to be assigned to all matrix elements. |
|
inline |
List assignment to all matrix elements.
list | The initializer list. |
std::invalid_argument | Invalid number of rows for hybrid matrix. |
std::invalid_argument | Invalid number of columns for hybrid matrix. |
This assignment operator offers the option to directly assign to all elements of the matrix by means of an initializer list:
The matrix is resized according to the given initializer list and all its elements are assigned the values from the given initializer list. Missing values are initialized as default (as e.g. the value 6 in the example). Note that in case the size of the top-level initializer list exceeds the number of rows or the size of any nested list exceeds the number of columns, a std::invalid_argument exception is thrown.
|
inline |
Copy assignment operator for HybridMatrix.
rhs | Matrix to be copied. |
Explicit definition of a copy assignment operator for performance reasons.
|
inline |
Array assignment to all matrix elements.
array | ![]() |
This assignment operator offers the option to directly set all elements of the matrix:
The matrix is assigned the values from the given array. Missing values are initialized with default values (as e.g. the value 6 in the example).
|
inline |
Assignment operator for different matrices.
rhs | Matrix to be copied. |
std::invalid_argument | Invalid assignment to hybrid matrix. |
This constructor initializes the matrix as a copy of the given matrix. In case the number of rows of the given matrix is not M or the number of columns is not N, a std::invalid_argument exception is thrown.
|
inlinenoexceptinherited |
Conversion operator for non-constant matrices.
|
inlinenoexceptinherited |
Conversion operator for constant matrices.
|
inline |
Reset to the default initial values.
|
inline |
Reset the specified row/column to the default initial values.
i | The index of the row/column. |
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.
void blaze::HybridMatrix< Type, M, N, SO >::resize | ( | size_t | m, |
size_t | n, | ||
bool | preserve = true |
||
) |
Changing the size of the matrix.
m | The new number of rows of the matrix. |
n | The new number of columns of the matrix. |
preserve | true if the old values of the matrix should be preserved, false if not. |
This function resizes the matrix using the given size to . In case the given number of rows m is larger than the maximum number of rows (i.e. if m > M) or in case the given number of columns n is larger than the maximum number of column (i.e. if n > N) a std::invalid_argument exception is thrown. Note that this function may invalidate all existing views (submatrices, rows, columns, ...) on the matrix if it is used to shrink the matrix. Additionally, during this operation all matrix elements are potentially changed. In order to preserve the old matrix values, the preserve flag can be set to true.
Note that in case the number of rows or columns is increased new matrix elements are not initialized! The following example illustrates the resize operation of a matrix to a
matrix. The new, uninitialized elements are marked with x:
|
inlinenoexcept |
Returns the current number of rows of the matrix.
|
inline |
Scaling of the matrix by the scalar value scalar ( ).
scalar | The scalar value for the matrix scaling. |
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:
|
inline |
Default implementation of the Schur product assignment of a row-major sparse matrix.
rhs | The right-hand side sparse matrix for the Schur product. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the Schur product assignment of a column-major sparse matrix.
rhs | The right-hand side sparse matrix for the Schur product. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the Schur product assignment of a dense matrix.
rhs | The right-hand side dense matrix for the Schur product |
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. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the Schur product assignment of a dense matrix.
rhs | The right-hand side dense matrix for the Schur product. |
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. Instead of using this function use the assignment operator.
|
inlinenoexcept |
Returns the spacing between the beginning of two rows.
This function returns the spacing between the beginning of two rows, i.e. the total number of elements of a row.
|
noexcept |
Store of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
value | The SIMD element to be stored. |
This function performs a store 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.
|
noexcept |
Aligned store of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
value | The SIMD element to be stored. |
This function performs an aligned store 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.
|
noexcept |
Unaligned store of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
value | The SIMD element to be stored. |
This function performs an unaligned store 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.
|
noexcept |
Aligned, non-temporal store of a SIMD element of the matrix.
i | Access index for the row. The index has to be in the range [0..M-1]. |
j | Access index for the column. The index has to be in the range [0..N-1]. |
value | The SIMD element to be stored. |
This function performs an aligned, non-temporal store 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.
|
inline |
Default implementation of the subtraction assignment of a row-major sparse matrix.
rhs | The right-hand side sparse matrix to be subtracted. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the subtraction assignment of a column-major sparse matrix.
rhs | The right-hand side sparse matrix to be subtracted. |
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. Instead of using this function use the assignment operator.
|
inline |
Default implementation of the subtraction assignment of a dense matrix.
rhs | The right-hand side dense matrix to be subtracted. |
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. Instead of using this function use the assignment operator.
|
inline |
SIMD optimized implementation of the subtraction assignment of a dense matrix.
rhs | The right-hand side dense matrix to be subtracted. |
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. Instead of using this function use the assignment operator.
|
inlinenoexcept |
Swapping the contents of two hybrid matrices.
m | The matrix to be swapped. |
|
inline |
In-place transpose of the matrix.
std::logic_error | Impossible transpose operation. |
This function transposes the hybrid matrix in-place. Note that this function can only be used on hybrid matrices whose current dimensions allow an in-place transpose operation. In case the current number of rows is larger than the maximum number of columns or if the current number of columns is larger than the maximum number of rows, an std::logic_error is thrown.
|
private |
The statically allocated matrix elements.
Access to the matrix elements is gained via the function call operator. In case of row-major order the memory layout of the elements is
.