![]() |
Efficient implementation of a dynamic matrix.The DynamicMatrix class template is the representation of an arbitrary sized matrix with
dynamically allocated 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 <DynamicMatrix.h>
Inherits blaze::DenseMatrix< DynamicMatrix< Type, SO >, SO >.
Classes | |
struct | Rebind |
Rebind mechanism to obtain a DynamicMatrix with different data/element type. More... | |
Public Types | |
enum | { vectorizable = IsVectorizable<Type>::value } |
Compilation flag for intrinsic optimization. More... | |
enum | { smpAssignable = !IsSMPAssignable<Type>::value } |
Compilation flag for SMP assignments. More... | |
typedef DynamicMatrix< Type, SO > | This |
Type of this DynamicMatrix instance. | |
typedef This | ResultType |
Result type for expression template evaluations. | |
typedef DynamicMatrix< Type,!SO > | OppositeType |
Result type with opposite storage order for expression template evaluations. | |
typedef DynamicMatrix< Type,!SO > | TransposeType |
Transpose type for expression template evaluations. | |
typedef Type | ElementType |
Type of the matrix elements. | |
typedef IT::Type | IntrinsicType |
Intrinsic type of the matrix elements. | |
typedef const Type & | ReturnType |
Return type for expression template evaluations. | |
typedef const This & | CompositeType |
Data type for composite expression templates. | |
typedef Type & | Reference |
Reference to a non-constant matrix value. | |
typedef const Type & | ConstReference |
Reference to a constant matrix value. | |
typedef Type * | Pointer |
Pointer to a non-constant matrix value. | |
typedef const Type * | ConstPointer |
Pointer to a constant matrix value. | |
typedef DenseIterator< Type > | Iterator |
Iterator over non-constant elements. | |
typedef DenseIterator< const Type > | ConstIterator |
Iterator over constant elements. | |
typedef MT | MatrixType |
Type of the matrix. | |
Public Member Functions | |
template<typename Other , size_t M, size_t N> | |
DynamicMatrix< Type, SO > & | operator= (const Other(&array)[M][N]) |
Array assignment to all matrix elements. More... | |
template<typename MT , bool SO2> | |
DynamicMatrix< Type, SO > & | operator= (const Matrix< MT, SO2 > &rhs) |
Assignment operator for different matrices. More... | |
template<typename MT , bool SO2> | |
DynamicMatrix< Type, SO > & | operator+= (const Matrix< MT, SO2 > &rhs) |
Addition assignment operator for the addition of a matrix ( ![]() | |
template<typename MT , bool SO2> | |
DynamicMatrix< Type, SO > & | operator-= (const Matrix< MT, SO2 > &rhs) |
Subtraction assignment operator for the subtraction of a matrix ( ![]() | |
template<typename MT , bool SO2> | |
DynamicMatrix< Type, SO > & | operator*= (const Matrix< MT, SO2 > &rhs) |
Multiplication assignment operator for the multiplication of a matrix ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DynamicMatrix< Type, SO > >::Type & | operator*= (Other rhs) |
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DynamicMatrix< Type, SO > >::Type & | operator/= (Other rhs) |
Division assignment operator for the division of a matrix by a scalar value ( ![]() | |
template<typename Other > | |
DynamicMatrix< Type, SO > & | scale (const Other &scalar) |
Scaling of the matrix by the scalar value scalar ( ![]() | |
template<typename MT > | |
DisableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedAssign< MT > >::Type | assign (const DenseMatrix< MT, SO > &rhs) |
Default implementation of the assignment of a row-major dense matrix. More... | |
template<typename MT > | |
EnableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedAssign< MT > >::Type | assign (const DenseMatrix< MT, SO > &rhs) |
Intrinsic optimized implementation of the assignment of a row-major dense matrix. More... | |
template<typename MT > | |
DisableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedAddAssign< MT > >::Type | addAssign (const DenseMatrix< MT, SO > &rhs) |
Default implementation of the addition assignment of a row-major dense matrix. More... | |
template<typename MT > | |
EnableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedAddAssign< MT > >::Type | addAssign (const DenseMatrix< MT, SO > &rhs) |
Intrinsic optimized implementation of the addition assignment of a row-major dense matrix. More... | |
template<typename MT > | |
DisableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedSubAssign< MT > >::Type | subAssign (const DenseMatrix< MT, SO > &rhs) |
Default implementation of the subtraction assignment of a row-major dense matrix. More... | |
template<typename MT > | |
EnableIf< typename DynamicMatrix< Type, SO > ::BLAZE_TEMPLATE VectorizedSubAssign< MT > >::Type | subAssign (const DenseMatrix< MT, SO > &rhs) |
Intrinsic optimized implementation of the subtraction assignment of a row-major dense matrix. More... | |
BLAZE_ALWAYS_INLINE MatrixType & | operator~ () |
Conversion operator for non-constant matrices. More... | |
BLAZE_ALWAYS_INLINE const MatrixType & | operator~ () const |
Conversion operator for constant matrices. More... | |
Constructors | |
DynamicMatrix () | |
The default constructor for DynamicMatrix. | |
DynamicMatrix (size_t m, size_t n) | |
Constructor for a matrix of size ![]() | |
DynamicMatrix (size_t m, size_t n, const Type &init) | |
Constructor for a homogenous initialization of all ![]() | |
template<typename Other > | |
DynamicMatrix (size_t m, size_t n, const Other *array) | |
Array initialization of all matrix elements. More... | |
template<typename Other , size_t M, size_t N> | |
DynamicMatrix (const Other(&array)[M][N]) | |
Array initialization of all matrix elements. More... | |
DynamicMatrix (const DynamicMatrix &m) | |
The copy constructor for DynamicMatrix. More... | |
template<typename MT , bool SO2> | |
DynamicMatrix (const Matrix< MT, SO2 > &m) | |
Conversion constructor from different matrices. More... | |
Destructor | |
~DynamicMatrix () | |
The destructor for DynamicMatrix. | |
Data access functions | |
Reference | operator() (size_t i, size_t j) |
2D-access to the matrix elements. More... | |
ConstReference | operator() (size_t i, size_t j) const |
2D-access to the matrix elements. More... | |
Pointer | data () |
Low-level data access to the matrix elements. More... | |
ConstPointer | data () const |
Low-level data access to the matrix elements. More... | |
Pointer | data (size_t i) |
Low-level data access to the matrix elements of row/column i. More... | |
ConstPointer | data (size_t i) const |
Low-level data access to the matrix elements of row/column i. More... | |
Iterator | begin (size_t i) |
Returns an iterator to the first element of row/column i. More... | |
ConstIterator | begin (size_t i) const |
Returns an iterator to the first element of row/column i. More... | |
ConstIterator | cbegin (size_t i) const |
Returns an iterator to the first element of row/column i. More... | |
Iterator | end (size_t i) |
Returns an iterator just past the last element of row/column i. More... | |
ConstIterator | end (size_t i) const |
Returns an iterator just past the last element of row/column i. More... | |
ConstIterator | cend (size_t i) const |
Returns an iterator just past the last element of row/column i. More... | |
Assignment operators | |
template<typename Other , size_t M, size_t N> | |
DynamicMatrix & | operator= (const Other(&array)[M][N]) |
DynamicMatrix & | operator= (Type set) |
Homogenous assignment to all matrix elements. More... | |
DynamicMatrix & | operator= (const DynamicMatrix &rhs) |
Copy assignment operator for DynamicMatrix. More... | |
template<typename MT , bool SO2> | |
DynamicMatrix & | operator= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
DynamicMatrix & | operator+= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
DynamicMatrix & | operator-= (const Matrix< MT, SO2 > &rhs) |
template<typename MT , bool SO2> | |
DynamicMatrix & | operator*= (const Matrix< MT, SO2 > &rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DynamicMatrix >::Type & | operator*= (Other rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DynamicMatrix >::Type & | operator/= (Other rhs) |
Expression template evaluation functions | |
template<typename Other > | |
bool | canAlias (const Other *alias) const |
Returns whether the matrix can alias with the given address alias. More... | |
template<typename Other > | |
bool | isAliased (const Other *alias) const |
Returns whether the matrix is aliased with the given address alias. More... | |
bool | isAligned () const |
Returns whether the matrix is properly aligned in memory. More... | |
bool | canSMPAssign () const |
Returns whether the matrix can be used in SMP assignments. More... | |
IntrinsicType | load (size_t i, size_t j) const |
Aligned load of an intrinsic element of the matrix. More... | |
IntrinsicType | loadu (size_t i, size_t j) const |
Unaligned load of an intrinsic element of the matrix. More... | |
void | store (size_t i, size_t j, const IntrinsicType &value) |
Aligned store of an intrinsic element of the matrix. More... | |
void | storeu (size_t i, size_t j, const IntrinsicType &value) |
Unaligned store of an intrinsic element of the matrix. More... | |
void | stream (size_t i, size_t j, const IntrinsicType &value) |
Aligned, non-temporal store of an intrinsic element of the matrix. More... | |
template<typename MT > | |
DisableIf< VectorizedAssign < MT > >::Type | assign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
EnableIf< VectorizedAssign< MT > >::Type | assign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
void | assign (const DenseMatrix< MT,!SO > &rhs) |
Default implementation of the assignment of a column-major dense matrix. More... | |
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 > | |
DisableIf< VectorizedAddAssign < MT > >::Type | addAssign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
EnableIf< VectorizedAddAssign < MT > >::Type | addAssign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
void | addAssign (const DenseMatrix< MT,!SO > &rhs) |
Default implementation of the addition assignment of a column-major dense matrix. More... | |
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 > | |
DisableIf< VectorizedSubAssign < MT > >::Type | subAssign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
EnableIf< VectorizedSubAssign < MT > >::Type | subAssign (const DenseMatrix< MT, SO > &rhs) |
template<typename MT > | |
void | subAssign (const DenseMatrix< MT,!SO > &rhs) |
Default implementation of the subtraction assignment of a column-major dense matrix. More... | |
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... | |
Private Types | |
typedef IntrinsicTrait< Type > | IT |
Intrinsic trait for the matrix element type. | |
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. | |
size_t | nn_ |
The alignment adjusted number of columns. | |
size_t | capacity_ |
The maximum capacity of the matrix. | |
Type *BLAZE_RESTRICT | v_ |
The dynamically allocated matrix elements. More... | |
Utility functions | |
size_t | rows () const |
Returns the current number of rows of the matrix. More... | |
size_t | columns () const |
Returns the current number of columns of the matrix. More... | |
size_t | spacing () const |
Returns the spacing between the beginning of two rows/columns. More... | |
size_t | capacity () const |
Returns the maximum capacity of the matrix. More... | |
size_t | capacity (size_t i) const |
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 ![]() | |
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 | reserve (size_t elements) |
Setting the minimum capacity of the matrix. More... | |
DynamicMatrix & | transpose () |
Transposing the matrix. More... | |
template<typename Other > | |
DynamicMatrix & | scale (const Other &scalar) |
void | swap (DynamicMatrix &m) |
Swapping the contents of two matrices. More... | |
size_t | adjustColumns (size_t minColumns) const |
Adjusting the number columns of the matrix according to its data type Type. More... | |
Efficient implementation of a dynamic matrix.
The DynamicMatrix class template is the representation of an arbitrary sized matrix with dynamically allocated elements of arbitrary type. The type of the elements and the storage order of the matrix can be specified via the two 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 DynamicMatrix is very natural and intuitive. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combination of row-major and column-major dense and sparse matrices with fitting element types. The following example gives an impression of the use of DynamicMatrix:
anonymous enum |
Compilation flag for intrinsic optimization.
The vectorizable compilation flag indicates whether expressions the matrix is involved in can be optimized via intrinsics. In case the element type of the matrix is a vectorizable data type, the vectorizable compilation flag is set to true, otherwise it is set to false.
anonymous enum |
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 |
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. |
Note: This constructor is only responsible to allocate the required dynamic memory. No element initialization is performed!
|
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. |
All matrix elements are initialized with the specified value.
|
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. |
This constructor offers the option to directly initialize the elements of the matrix with a dynamic array:
The matrix is sized accoring to the given size of the array and initialized with the values from the given array. 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 accoring 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 DynamicMatrix.
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. |
|
inline |
Default implementation of the addition assignment of a column-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 |
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 |
Intrinsic optimized 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.
|
inlineprivate |
Adjusting the number columns of the matrix according to its data type Type.
minColumns | The minimum necessary number of columns. |
|
inline |
Default implementation of the assignment of a column-major 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 |
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 row-major 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 |
Intrinsic optimized implementation of the assignment of a row-major 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 |
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.
|
inline |
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.
|
inline |
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.
|
inline |
Returns whether the matrix can be used in SMP assignments.
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).
|
inline |
Returns the maximum capacity of the matrix.
|
inline |
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.
|
inline |
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.
|
inline |
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 |
|
inline |
Returns the current number of columns of the matrix.
|
inline |
Low-level data access to the matrix elements.
This function returns a pointer to the internal storage of the dynamic matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The dynamic 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.
|
inline |
Low-level data access to the matrix elements.
This function returns a pointer to the internal storage of the dynamic matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The dynamic 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.
|
inline |
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.
|
inline |
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.
|
inline |
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 |
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. 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, new matrix elements are not initialized!
|
inline |
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.
|
inline |
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.
|
inline |
Aligned load of an intrinsic 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 intrinsic 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 intrinsic 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 |
Unaligned load of an intrinsic 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 intrinsic 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 intrinsic 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.
|
inline |
2D-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 ![]() |
|
inline |
2D-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 ![]() |
|
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.
rhs | Scalar value to be assigned to all matrix elements. |
|
inline |
Copy assignment operator for DynamicMatrix.
rhs | Matrix to be copied. |
The matrix is resized according to the given matrix and initialized as a copy of this matrix.
|
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 resized accoring to the size of the array and assigned the values of 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. |
The matrix is resized according to the given matrix and initialized as a copy of this matrix.
|
inlineinherited |
Conversion operator for non-constant matrices.
|
inlineinherited |
Conversion operator for constant matrices.
|
inline |
Setting the minimum capacity of the matrix.
elements | The new minimum capacity of the dense matrix. |
This function increases the capacity of the dense matrix to at least elements elements. The current values of the matrix elements are preserved.
|
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::DynamicMatrix< Type, 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 . 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, 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:
|
inline |
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. |
|
inline |
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.
|
inline |
Aligned store of an intrinsic 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 intrinsic element to be stored. |
This function performs an aligned store of a specific intrinsic 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 intrinsic 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 |
Unaligned store of an intrinsic 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 intrinsic element to be stored. |
This function performs an unaligned store of a specific intrinsic 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 intrinsic 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 |
Aligned, non-temporal store of an intrinsic 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 intrinsic element to be stored. |
This function performs an aligned, non-temporal store of a specific intrinsic 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 intrinsic 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 column-major 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 |
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 row-major 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 |
Intrinsic optimized implementation of the subtraction assignment of a row-major 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 |
Swapping the contents of two matrices.
m | The matrix to be swapped. |
no-throw | guarantee. |
|
inline |
Transposing the matrix.
|
private |
The dynamically allocated matrix elements.
Access to the matrix elements is gained via the subscript or function call operator. In case of row-major order the memory layout of the elements is
.