Blaze 3.9
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT > Class Template Reference

Efficient implementation of a customizable matrix. More...

#include <CustomMatrix.h>

Inherits blaze::DenseMatrix< CustomMatrix< Type, AF, PF, SO, Tag, RT >, SO >.

Classes

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

Public Types

using This = CustomMatrix< Type, AF, PF, SO, Tag, RT >
 Type of this CustomMatrix instance.
 
using BaseType = DenseMatrix< This, SO >
 Base type of this CustomMatrix instance.
 
using ResultType = RT
 Result type for expression template evaluations.
 
using OppositeType = CustomOppositeType_t< RT >
 Result type with opposite storage order for expression template evaluations.
 
using TransposeType = CustomTransposeType_t< RT >
 Transpose type for expression template evaluations.
 
using ElementType = Type
 Type of the matrix elements.
 
using SIMDType = SIMDTrait_t< ElementType >
 SIMD type of the matrix elements.
 
using TagType = Tag
 Tag type of this CustomMatrix instance.
 
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, AF >
 Iterator over non-constant elements.
 
using ConstIterator = DenseIterator< const Type, AF >
 Iterator over constant elements.
 
using MatrixType = CustomMatrix< Type, AF, PF, SO, Tag, RT >
 Type of the matrix.
 

Public Member Functions

template<typename Other , size_t Rows, size_t Cols>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator= (const Other(&array)[Rows][Cols])
 Array assignment to all matrix elements. More...
 
template<typename Other , size_t Rows, size_t Cols>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator= (const std::array< std::array< Other, Cols >, Rows > &array)
 Array assignment to all matrix elements. More...
 
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator= (const Matrix< MT, SO2 > &rhs)
 Assignment operator for different matrices. More...
 
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator+= (const Matrix< MT, SO2 > &rhs)
 Addition assignment operator for the addition of a matrix ( $ A+=B $). More...
 
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator-= (const Matrix< MT, SO2 > &rhs)
 Subtraction assignment operator for the subtraction of a matrix ( $ A-=B $). More...
 
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator%= (const Matrix< MT, SO2 > &rhs)
 Schur product assignment operator for the multiplication of a matrix ( $ A\circ=B $). More...
 
template<typename Other >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & scale (const Other &scalar)
 Scaling of the matrix by the scalar value scalar ( $ A=B*s $). More...
 
Constructors
 CustomMatrix ()
 The default constructor for CustomMatrix.
 
 CustomMatrix (Type *ptr, size_t m, size_t n)
 Constructor for a matrix of size $ m \times n $. More...
 
 CustomMatrix (Type *ptr, size_t m, size_t n, size_t nn)
 Constructor for a matrix of size $ m \times n $. More...
 
 CustomMatrix (const CustomMatrix &m)
 The copy constructor for CustomMatrix. More...
 
 CustomMatrix (CustomMatrix &&m) noexcept
 The move constructor for CustomMatrix. More...
 
Destructor
 ~CustomMatrix ()
 The destructor for CustomMatrix.
 
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
CustomMatrixoperator= (const Type &set)
 Homogenous assignment to all matrix elements. More...
 
CustomMatrixoperator= (initializer_list< initializer_list< Type > > list)
 List assignment to all matrix elements. More...
 
template<typename Other , size_t Rows, size_t Cols>
CustomMatrixoperator= (const Other(&array)[Rows][Cols])
 
template<typename Other , size_t Rows, size_t Cols>
CustomMatrixoperator= (const std::array< std::array< Other, Cols >, Rows > &array)
 
CustomMatrixoperator= (const CustomMatrix &rhs)
 Copy assignment operator for CustomMatrix. More...
 
CustomMatrixoperator= (CustomMatrix &&rhs) noexcept
 Move assignment operator for CustomMatrix. More...
 
template<typename MT , bool SO2>
CustomMatrixoperator= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CustomMatrixoperator+= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CustomMatrixoperator-= (const Matrix< MT, SO2 > &rhs)
 
template<typename MT , bool SO2>
CustomMatrixoperator%= (const Matrix< MT, SO2 > &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...
 
size_t spacing () const noexcept
 Returns the spacing between the beginning of two rows/columns. More...
 
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 $ M \times N $ matrix. More...
 
void swap (CustomMatrix &m) noexcept
 Swapping the contents of two matrices. More...
 
Numeric functions
CustomMatrixtranspose ()
 In-place transpose of the matrix. More...
 
CustomMatrixctranspose ()
 In-place conjugate transpose of the matrix. More...
 
template<typename Other >
CustomMatrixscale (const Other &scalar)
 
Expression template evaluation functions
template<typename Other >
bool canAlias (const Other *alias) const noexcept
 Returns whether the matrix can alias with the given address alias. More...
 
template<typename Other >
bool isAliased (const Other *alias) const noexcept
 Returns whether the matrix is aliased with the given address alias. More...
 
bool isAligned () const noexcept
 Returns whether the matrix is properly aligned in memory. More...
 
bool canSMPAssign () const noexcept
 Returns whether the matrix can be used in SMP assignments. More...
 
BLAZE_ALWAYS_INLINE SIMDType load (size_t i, size_t j) const noexcept
 Load of a SIMD element of the matrix. More...
 
BLAZE_ALWAYS_INLINE SIMDType loada (size_t i, size_t j) const noexcept
 Aligned load of a SIMD element of the matrix. More...
 
BLAZE_ALWAYS_INLINE SIMDType loadu (size_t i, size_t j) const noexcept
 Unaligned load of a SIMD element of the matrix. More...
 
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 >
auto assign (const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedAssign_v< MT > >
 Default implementation of the assignment of a row-major dense matrix. More...
 
template<typename MT >
auto assign (const DenseMatrix< MT, SO > &rhs) -> EnableIf_t< VectorizedAssign_v< MT > >
 
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 >
auto addAssign (const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedAddAssign_v< MT > >
 Default implementation of the addition assignment of a row-major dense matrix. More...
 
template<typename MT >
auto addAssign (const DenseMatrix< MT, SO > &rhs) -> EnableIf_t< VectorizedAddAssign_v< MT > >
 
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 >
auto subAssign (const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedSubAssign_v< MT > >
 Default implementation of the subtraction assignment of a row-major dense matrix. More...
 
template<typename MT >
auto subAssign (const DenseMatrix< MT, SO > &rhs) -> EnableIf_t< VectorizedSubAssign_v< MT > >
 
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...
 
template<typename MT >
auto schurAssign (const DenseMatrix< MT, SO > &rhs) -> DisableIf_t< VectorizedSchurAssign_v< MT > >
 Default implementation of the Schur product assignment of a row-major dense matrix. More...
 
template<typename MT >
auto schurAssign (const DenseMatrix< MT, SO > &rhs) -> EnableIf_t< VectorizedSchurAssign_v< MT > >
 
template<typename MT >
void schurAssign (const DenseMatrix< MT,!SO > &rhs)
 Default implementation of the Schur product assignment of a column-major dense matrix. More...
 
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...
 
Conversion operators
BLAZE_ALWAYS_INLINE constexpr CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator~ () noexcept
 CRTP-based conversion operation for non-constant matrices. More...
 
BLAZE_ALWAYS_INLINE constexpr const CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator~ () const noexcept
 CRTP-based conversion operation for constant matrices. More...
 
constexpr CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator* () noexcept
 CRTP-based conversion operation for non-constant matrices. More...
 
constexpr const CustomMatrix< Type, AF, PF, SO, Tag, RT > & operator* () const noexcept
 CRTP-based conversion operation for constant matrices. More...
 

Static Public Attributes

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

Private Attributes

Member variables
size_t m_
 The current number of rows of the matrix.
 
size_t n_
 The current number of columns of the matrix.
 
size_t nn_
 The number of elements between two rows.
 
Type * v_
 The custom array of elements. More...
 

Resource management functions

static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size
 The number of elements packed within a single SIMD element.
 
void reset (Type *ptr, size_t m, size_t n)
 Resets the custom matrix and replaces the array of elements with the given array. More...
 
void reset (Type *ptr, size_t m, size_t n, size_t nn)
 Resets the custom matrix and replaces the array of elements with the given array. More...
 

Detailed Description

template<typename Type, AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag, typename RT>
class blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >

Efficient implementation of a customizable matrix.

The CustomMatrix class template provides the functionality to represent an external array of elements of arbitrary type and a fixed size as a native Blaze dense matrix data structure. Thus in contrast to all other dense matrix types a custom matrix does not perform any kind of memory allocation by itself, but it is provided with an existing array of element during construction. A custom matrix can therefore be considered an alias to the existing array.

The type of the elements, the properties of the given array of elements, the storage order, and the group tag of the matrix can be specified via the following five template parameters:

namespace blaze {
template< typename Type, AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag >
} // namespace blaze
CustomMatrix()
The default constructor for CustomMatrix.
Definition: CustomMatrix.h:742

The following examples give an impression of several possible types of custom matrices:

// Definition of a custom row-major matrix for unaligned, unpadded integer arrays
using UnalignedUnpadded = CustomMatrix<int,unaligned,unpadded,rowMajor>;
// Definition of a custom column-major matrix for unaligned but padded 'float' arrays
using UnalignedPadded = CustomMatrix<float,unaligned,padded,columnMajor>;
// Definition of a custom row-major matrix for aligned, unpadded 'double' arrays
using AlignedUnpadded = CustomMatrix<double,aligned,unpadded,rowMajor>;
// Definition of a custom column-major matrix for aligned, padded 'complex<double>' arrays
using AlignedPadded = CustomMatrix<complex<double>,aligned,padded,columnMajor>;
Efficient implementation of a customizable matrix.
Definition: CustomMatrix.h:423
@ padded
Flag for padded vectors and matrices.
Definition: PaddingFlag.h:79
@ unpadded
Flag for unpadded vectors and matrices.
Definition: PaddingFlag.h:78
@ unaligned
Flag for unaligned vectors and matrices.
Definition: AlignmentFlag.h:64
@ aligned
Flag for aligned vectors and matrices.
Definition: AlignmentFlag.h:65
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99


Special Properties of Custom Matrices

In comparison with the remaining Blaze dense matrix types CustomMatrix has several special characteristics. All of these result from the fact that a custom matrix is not performing any kind of memory allocation, but instead is given an existing array of elements. The following sections discuss all of these characteristics:

  1. Memory Management
  2. Copy Operations
  3. Alignment
  4. Padding


Memory Management

The CustomMatrix class template acts as an adaptor for an existing array of elements. As such it provides everything that is required to use the array just like a native Blaze dense matrix data structure. However, this flexibility comes with the price that the user of a custom matrix is responsible for the resource management.

The following examples give an impression of several possible custom matrices:

// Definition of a 3x4 custom row-major matrix with unaligned, unpadded and externally
// managed integer array. Note that the std::vector must be guaranteed to outlive the
// custom matrix!
std::vector<int> vec( 12UL );
CustomMatrix<int,unaligned,unpadded> A( &vec[0], 3UL, 4UL );
// Definition of a custom 8x12 matrix for an aligned and padded integer array of
// capacity 128 (including 8 padding elements per row). Note that the std::unique_ptr
// must be guaranteed to outlive the custom matrix!
std::unique_ptr<int[],Deallocate> memory( allocate<int>( 128UL ) );
CustomMatrix<int,aligned,padded> B( memory.get(), 8UL, 12UL, 16UL );
T * allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:158
Deallocate policy class.
Definition: Deallocate.h:65


Copy Operations

As with all dense matrices it is possible to copy construct a custom matrix:

using CustomType = CustomMatrix<int,unaligned,unpadded>;
std::vector<int> vec( 6UL, 10 ); // Vector of 6 integers of the value 10
CustomType A( &vec[0], 2UL, 3UL ); // Represent the std::vector as Blaze dense matrix
a[1] = 20; // Also modifies the std::vector
CustomType B( a ); // Creating a copy of vector a
b[2] = 20; // Also affects matrix A and the std::vector

It is important to note that a custom matrix acts as a reference to the specified array. Thus the result of the copy constructor is a new custom matrix that is referencing and representing the same array as the original custom matrix.

In contrast to copy construction, just as with references, copy assignment does not change which array is referenced by the custom matrices, but modifies the values of the array:

std::vector<int> vec2( 6UL, 4 ); // Vector of 6 integers of the value 4
CustomType C( &vec2[0], 2UL, 3UL ); // Represent the std::vector as Blaze dense matrix
A = C; // Copy assignment: Set all values of matrix A and B to 4.


Alignment

In case the custom matrix is specified as aligned the passed array must adhere to some alignment restrictions based on the alignment requirements of the used data type and the used instruction set (SSE, AVX, ...). The restriction applies to the first element of each row/column: In case of a row-major matrix the first element of each row must be properly aligned, in case of a column-major matrix the first element of each column must be properly aligned. For instance, if a row-major matrix is used and AVX is active the first element of each row must be 32-bit aligned:

// Allocation of 32-bit aligned memory
std::unique_ptr<int[],Deallocate> memory( allocate<int>( 40UL ) );
CustomMatrix<int,aligned,padded,rowMajor> A( memory.get(), 5UL, 6UL, 8UL );
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71

In the example, the row-major matrix has six columns. However, since with AVX eight integer values are loaded together the matrix is padded with two additional elements. This guarantees that the first element of each row is 32-bit aligned. In case the alignment requirements are violated, a std::invalid_argument exception is thrown.


Padding

Adding padding elements to the end of an array can have a significant impact on performance. For instance, assuming that AVX is available, then two aligned, padded, 3x3 double precision matrices can be added via three SIMD addition operations:

using CustomType = CustomMatrix<double,aligned,padded>;
std::unique_ptr<double[],Deallocate> memory1( allocate<double>( 12UL ) );
std::unique_ptr<double[],Deallocate> memory2( allocate<double>( 12UL ) );
std::unique_ptr<double[],Deallocate> memory3( allocate<double>( 12UL ) );
// Creating padded custom 3x3 matrix with an additional padding element in each row
CustomType A( memory1.get(), 3UL, 3UL, 4UL );
CustomType B( memory2.get(), 3UL, 3UL, 4UL );
CustomType C( memory3.get(), 3UL, 3UL, 4UL );
// ... Initialization
C = A + B; // AVX-based matrix addition

In this example, maximum performance is possible. However, in case no padding elements are inserted a scalar addition has to be used:

using CustomType = CustomMatrix<double,aligned,unpadded>;
std::unique_ptr<double[],Deallocate> memory1( allocate<double>( 9UL ) );
std::unique_ptr<double[],Deallocate> memory2( allocate<double>( 9UL ) );
std::unique_ptr<double[],Deallocate> memory3( allocate<double>( 9UL ) );
// Creating unpadded custom 3x3 matrix
CustomType A( memory1.get(), 3UL, 3UL );
CustomType B( memory2.get(), 3UL, 3UL );
CustomType C( memory3.get(), 3UL, 3UL );
// ... Initialization
C = A + B; // Scalar matrix addition

Note that the construction of padded and unpadded aligned matrices looks identical. However, in case of padded matrices, Blaze will zero initialize the padding element and use them in all computations in order to achieve maximum performance. In case of an unpadded matrix Blaze will ignore the elements with the downside that it is not possible to load a complete row to an AVX register, which makes it necessary to fall back to a scalar addition.

The number of padding elements is required to be sufficient with respect to the available instruction set: In case of an aligned padded custom matrix the added padding elements must guarantee that the total number of elements in each row/column is a multiple of the SIMD vector width. In case of an unaligned padded matrix the number of padding elements can be greater or equal the number of padding elements of an aligned padded custom matrix. In case the padding is insufficient with respect to the available instruction set, a std::invalid_argument exception is thrown.


Arithmetic Operations

The use of custom matrices in arithmetic operations is designed to be as natural and intuitive as possible. All operations (addition, subtraction, multiplication, scaling, ...) can be expressed similar to a text book representation. Also, custom matrices can be combined with all other dense and sparse vectors and matrices. The following example gives an impression of the use of CustomMatrix:

// Non-initialized custom 2x3 row-major matrix. All given arrays are considered to be
// unaligned and unpadded. The memory is managed via a 'std::vector'.
std::vector<double> memory1( 6UL );
CustomMatrix<double,unaligned,unpadded> A( memory1.data(), 2UL, 3UL );
A(0,0) = 1.0; A(0,1) = 2.0; A(0,2) = 3.0; // Initialization of the first row
A(1,0) = 4.0; A(1,1) = 5.0; A(1,2) = 6.0; // Initialization of the second row
// Non-initialized custom 2x3 row-major matrix with padding elements. All given arrays are
// required to be properly aligned and padded. The memory is managed via a 'std::unique_ptr'.
std::unique_ptr<double[],Deallocate> memory2( allocate<double>( 16UL ) );
CustomMatrix<double,aligned,padded> B( memory2.get(), 2UL, 3UL, 8UL );
B(0,0) = 1.0; B(0,1) = 3.0; B(0,2) = 5.0; // Initialization of the first row
B(1,0) = 2.0; B(1,1) = 4.0; B(1,2) = 6.0; // Initialization of the second row
CompressedMatrix<float> C( 2, 3 ); // Empty row-major sparse single precision matrix
DynamicMatrix<float> D( 3, 2, 4.0F ); // Directly, homogeneously initialized single precision 3x2 matrix
DynamicMatrix<double,rowMajor> E( A ); // Creation of a new row-major matrix as a copy of A
DynamicMatrix<double,columnMajor> F; // Creation of a default column-major matrix
E = A + B; // Matrix addition and assignment to a row-major matrix
F = A - C; // Matrix subtraction and assignment to a column-major matrix
F = A * D; // Matrix multiplication between two matrices of different element types
A *= 2.0; // In-place scaling of matrix A
E = 2.0 * B; // Scaling of matrix B
F = D * 2.0; // Scaling of matrix D
E += A - B; // Addition assignment
E -= A + C; // Subtraction assignment
F *= A * D; // Multiplication assignment
Efficient implementation of a compressed matrix.
Definition: CompressedMatrix.h:239

Constructor & Destructor Documentation

◆ CustomMatrix() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::CustomMatrix ( Type *  ptr,
size_t  m,
size_t  n 
)
inline

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

Parameters
ptrThe array of elements to be used by the matrix.
mThe number of rows of the array of elements.
nThe number of columns of the array of elements.
Exceptions
std::invalid_argumentInvalid setup of custom matrix.

This constructor creates an unpadded custom matrix of size $ m \times n $. The construction fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...).

In all failure cases a std::invalid_argument exception is thrown.

Note
This constructor is NOT available for padded custom matrices!
The custom matrix does NOT take responsibility for the given array of elements!

◆ CustomMatrix() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::CustomMatrix ( Type *  ptr,
size_t  m,
size_t  n,
size_t  nn 
)
inline

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

Parameters
ptrThe array of elements to be used by the matrix.
mThe number of rows of the array of elements.
nThe number of columns of the array of elements.
nnThe total number of elements between two rows/columns.
Exceptions
std::invalid_argumentInvalid setup of custom matrix.

This constructor creates a custom matrix of size $ m \times n $. The construction fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...);
  • ... the specified spacing nn is insufficient for the given data type Type and the available instruction set.

In all failure cases a std::invalid_argument exception is thrown.

Note
The custom matrix does NOT take responsibility for the given array of elements!

◆ CustomMatrix() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::CustomMatrix ( const CustomMatrix< Type, AF, PF, SO, Tag, RT > &  m)
inline

The copy constructor for CustomMatrix.

Parameters
mMatrix to be copied.

The copy constructor initializes the custom matrix as an exact copy of the given custom matrix.

◆ CustomMatrix() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::CustomMatrix ( CustomMatrix< Type, AF, PF, SO, Tag, RT > &&  m)
inlinenoexcept

The move constructor for CustomMatrix.

Parameters
mThe matrix to be moved into this instance.

Member Function Documentation

◆ addAssign() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
auto blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::addAssign ( const DenseMatrix< MT, SO > &  rhs) -> DisableIf_t< VectorizedAddAssign_v<MT> >
inline

Default implementation of the addition assignment of a row-major dense matrix.

SIMD optimized implementation of the addition assignment of a row-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be added.
Returns
void

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.

◆ addAssign() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::addAssign ( const DenseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the addition assignment of a column-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be added.
Returns
void

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.

◆ addAssign() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::addAssign ( const SparseMatrix< MT, SO > &  rhs)
inline

Default implementation of the addition assignment of a row-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be added.
Returns
void

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.

◆ addAssign() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::addAssign ( const SparseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the addition assignment of a column-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be added.
Returns
void

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.

◆ assign() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
auto blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::assign ( const DenseMatrix< MT, SO > &  rhs) -> DisableIf_t< VectorizedAssign_v<MT> >
inline

Default implementation of the assignment of a row-major dense matrix.

SIMD optimized implementation of the assignment of a row-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be assigned.
Returns
void

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.

◆ assign() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::assign ( const DenseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the assignment of a column-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be assigned.
Returns
void

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.

◆ assign() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::assign ( const SparseMatrix< MT, SO > &  rhs)
inline

Default implementation of the assignment of a row-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be assigned.
Returns
void

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.

◆ assign() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::assign ( const SparseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the assignment of a column-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be assigned.
Returns
void

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.

◆ at() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Reference blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::at ( size_t  i,
size_t  j 
)
inline

Checked access to the matrix elements.

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

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

◆ at() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstReference blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::at ( size_t  i,
size_t  j 
) const
inline

Checked access to the matrix elements.

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

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

◆ begin() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstIterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::begin ( size_t  i) const
inlinenoexcept

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

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

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

◆ begin() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Iterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::begin ( size_t  i)
inlinenoexcept

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

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

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

◆ canAlias()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename Other >
bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::canAlias ( const Other *  alias) const
inlinenoexcept

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

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

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

◆ canSMPAssign()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::canSMPAssign
inlinenoexcept

Returns whether the matrix can be used in SMP assignments.

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

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

◆ capacity() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::capacity
inlinenoexcept

Returns the maximum capacity of the matrix.

Returns
The capacity of the matrix.

◆ capacity() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::capacity ( size_t  i) const
inlinenoexcept

Returns the current capacity of the specified row/column.

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

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

◆ cbegin()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstIterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::cbegin ( size_t  i) const
inlinenoexcept

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

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

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

◆ cend()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstIterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::cend ( size_t  i) const
inlinenoexcept

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

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

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

◆ clear()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::clear
inline

Clearing the $ M \times N $ matrix.

Returns
void

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

◆ columns()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::columns
inlinenoexcept

Returns the current number of columns of the matrix.

Returns
The number of columns of the matrix.

◆ ctranspose()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::ctranspose
inline

In-place conjugate transpose of the matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::logic_errorImpossible transpose operation.

In case the matrix is not a square matrix, a std::logic_error exception is thrown.

◆ data() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstPointer blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::data
inlinenoexcept

Low-level data access to the matrix elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the 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.

◆ data() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Pointer blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::data
inlinenoexcept

Low-level data access to the matrix elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the 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.

◆ data() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstPointer blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::data ( size_t  i) const
inlinenoexcept

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

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

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

◆ data() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Pointer blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::data ( size_t  i)
inlinenoexcept

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

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

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

◆ end() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstIterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::end ( size_t  i) const
inlinenoexcept

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

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

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

◆ end() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Iterator blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::end ( size_t  i)
inlinenoexcept

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

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

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

◆ isAliased()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename Other >
bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::isAliased ( const Other *  alias) const
inlinenoexcept

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

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

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

◆ isAligned()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::isAligned
inlinenoexcept

Returns whether the matrix is properly aligned in memory.

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

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

◆ load()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE CustomMatrix< Type, AF, PF, SO, Tag, RT >::SIMDType blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::load ( size_t  i,
size_t  j 
) const
noexcept

Load of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
Returns
The loaded SIMD element.

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

◆ loada()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE CustomMatrix< Type, AF, PF, SO, Tag, RT >::SIMDType blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::loada ( size_t  i,
size_t  j 
) const
noexcept

Aligned load of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
Returns
The loaded SIMD element.

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

◆ loadu()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE CustomMatrix< Type, AF, PF, SO, Tag, RT >::SIMDType blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::loadu ( size_t  i,
size_t  j 
) const
noexcept

Unaligned load of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
Returns
The loaded SIMD element.

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

◆ nonZeros() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::nonZeros
inline

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

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

This function returns the number of non-zero elements in the matrix (i.e. the elements that compare unequal to their default value). Note that the number of non-zero elements is always less than or equal to the total number of elements in the matrix.

◆ nonZeros() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::nonZeros ( size_t  i) const
inline

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

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

This function returns the current number of non-zero elements in the specified row/column (i.e. the elements that compare unequal to their default value). In case the storage order is set to rowMajor the function returns the number of non-zero elements in row i, in case the storage flag is set to columnMajor the function returns the number of non-zero elements in column i.

◆ operator%=()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator%= ( const Matrix< MT, SO2 > &  rhs)
inline

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

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

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

◆ operator()() [1/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::ConstReference blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator() ( size_t  i,
size_t  j 
) const
inlinenoexcept

2D-access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.

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

◆ operator()() [2/2]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT >::Reference blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator() ( size_t  i,
size_t  j 
)
inlinenoexcept

2D-access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.

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

◆ operator*() [1/2]

BLAZE_ALWAYS_INLINE constexpr const CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::Matrix< CustomMatrix< Type, AF, PF, SO, Tag, RT > , SO >::operator*
constexprnoexceptinherited

CRTP-based conversion operation for constant matrices.

Returns
Constant reference of the actual type of the matrix.

This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a constant reference to the actual type MT.

◆ operator*() [2/2]

BLAZE_ALWAYS_INLINE constexpr CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::Matrix< CustomMatrix< Type, AF, PF, SO, Tag, RT > , SO >::operator*
constexprnoexceptinherited

CRTP-based conversion operation for non-constant matrices.

Returns
Mutable reference of the actual type of the matrix.

This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a mutable reference to the actual type MT.

◆ operator+=()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator+= ( const Matrix< MT, SO2 > &  rhs)
inline

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

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

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

◆ operator-=()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator-= ( const Matrix< MT, SO2 > &  rhs)
inline

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

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

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

◆ operator=() [1/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( const CustomMatrix< Type, AF, PF, SO, Tag, RT > &  rhs)
inline

Copy assignment operator for CustomMatrix.

Parameters
rhsMatrix to be copied.
Returns
Reference to the assigned matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

The matrix is initialized as a copy of the given matrix. In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator=() [2/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT , bool SO2>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( const Matrix< MT, SO2 > &  rhs)
inline

Assignment operator for different matrices.

Parameters
rhsMatrix to be copied.
Returns
Reference to the assigned matrix.
Exceptions
std::invalid_argumentMatrix sizes do not match.

The matrix is initialized as a copy of the given matrix. In case the current sizes of the two matrices don't match, a std::invalid_argument exception is thrown.

◆ operator=() [3/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename Other , size_t Rows, size_t Cols>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( const Other(&)  array[Rows][Cols])
inline

Array assignment to all matrix elements.

Parameters
arrayStatic array for the assignment.
Returns
Reference to the assigned matrix.
Exceptions
std::invalid_argumentInvalid array size.

This assignment operator offers the option to directly set all elements of the matrix:

const int array[9] = { 0, 0, 0,
0, 0, 0,
0, 0, 0 };
const int init[3][3] = { { 1, 2, 3 },
{ 4, 5 },
{ 7, 8, 9 } };
A = init;

The matrix is assigned the values from the given static array. Missing values are initialized with default values (as e.g. the value 6 in the example). Note that the size of the static array must match the size of the custom matrix. Otherwise a std::invalid_argument exception is thrown. Also note that after the assignment array will have the same entries as init.

◆ operator=() [4/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename Other , size_t Rows, size_t Cols>
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( const std::array< std::array< Other, Cols >, Rows > &  array)
inline

Array assignment to all matrix elements.

Parameters
arrayThe given std::array for the assignment.
Returns
Reference to the assigned matrix.
Exceptions
std::invalid_argumentInvalid array size.

This assignment operator offers the option to directly set all elements of the matrix:

const int array[9] = { 0, 0, 0,
0, 0, 0,
0, 0, 0 };
const std::array<std::array<int,3UL>,3UL> init{ { { 1, 2, 3 },
{ 4, 5 },
{ 7, 8, 9 } } };
A = init;

The matrix is assigned the values from the given std::array. Missing values are initialized with default values (as e.g. the value 6 in the example). Note that the size of the std::array must match the size of the custom matrix. Otherwise a std::invalid_argument exception is thrown. Also note that after the assignment array will have the same entries as init.

◆ operator=() [5/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( const Type &  rhs)
inline

Homogenous assignment to all matrix elements.

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

◆ operator=() [6/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( CustomMatrix< Type, AF, PF, SO, Tag, RT > &&  rhs)
inlinenoexcept

Move assignment operator for CustomMatrix.

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

◆ operator=() [7/7]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::operator= ( initializer_list< initializer_list< Type > >  list)
inline

List assignment to all matrix elements.

Parameters
listThe initializer list.
Exceptions
std::invalid_argumentInvalid assignment to static matrix.

This assignment operator offers the option to directly assign to all elements of the matrix by means of an initializer list:

const int array[9] = { 0, 0, 0,
0, 0, 0,
0, 0, 0 };
A = { { 1, 2, 3 },
{ 4, 5 },
{ 7, 8, 9 } };

The matrix 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.

◆ operator~() [1/2]

BLAZE_ALWAYS_INLINE constexpr const CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::Matrix< CustomMatrix< Type, AF, PF, SO, Tag, RT > , SO >::operator~
constexprnoexceptinherited

CRTP-based conversion operation for constant matrices.

Parameters
matrixThe matrix to be downcast.
Returns
Constant reference of the actual type of the matrix.

This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a constant reference to the actual type MT.

◆ operator~() [2/2]

BLAZE_ALWAYS_INLINE constexpr CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::Matrix< CustomMatrix< Type, AF, PF, SO, Tag, RT > , SO >::operator~
constexprnoexceptinherited

CRTP-based conversion operation for non-constant matrices.

Parameters
matrixThe matrix to be downcast.
Returns
Mutable reference of the actual type of the matrix.

This operator performs the CRTP-based type-safe downcast to the actual type MT of the matrix. It will return a mutable reference to the actual type MT.

◆ reset() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::reset
inline

Reset to the default initial values.

Returns
void

◆ reset() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::reset ( size_t  i)
inline

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

Parameters
iThe index of the row/column.
Returns
void

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

◆ reset() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::reset ( Type *  ptr,
size_t  m,
size_t  n 
)
inline

Resets the custom matrix and replaces the array of elements with the given array.

Parameters
ptrThe array of elements to be used by the matrix.
mThe number of rows of the array of elements.
nThe number of columns of the array of elements.
Returns
void
Exceptions
std::invalid_argumentInvalid setup of custom matrix.

This function resets the custom matrix to the given array of elements of size $ m \times n $. The function fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...).

In all failure cases a std::invalid_argument exception is thrown.

Note
This function is NOT available for padded custom matrices!
In case a deleter was specified, the previously referenced array will only be destroyed when the last custom matrix referencing the array goes out of scope.
The custom matrix does NOT take responsibility for the new array of elements!

◆ reset() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::reset ( Type *  ptr,
size_t  m,
size_t  n,
size_t  nn 
)
inline

Resets the custom matrix and replaces the array of elements with the given array.

Parameters
ptrThe array of elements to be used by the matrix.
mThe number of rows of the array of elements.
nThe number of columns of the array of elements.
nnThe total number of elements between two rows/columns.
Returns
void
Exceptions
std::invalid_argumentInvalid setup of custom matrix.

This function resets the custom matrix to the given array of elements of size $ m \times n $. The function fails if ...

  • ... the passed pointer is nullptr;
  • ... the alignment flag AF is set to aligned, but the passed pointer is not properly aligned according to the available instruction set (SSE, AVX, ...).

In all failure cases a std::invalid_argument exception is thrown.

Note
In case a deleter was specified, the previously referenced array will only be destroyed when the last custom matrix referencing the array goes out of scope.
The custom matrix does NOT take responsibility for the new array of elements!

◆ rows()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::rows
inlinenoexcept

Returns the current number of rows of the matrix.

Returns
The number of rows of the matrix.

◆ scale()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename Other >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::scale ( const Other &  scalar)
inline

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

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

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

using blaze::unaliged;
CustomMatrix<int,unaligned,unpadded> A( ... );
A *= 4; // Scaling of the matrix
A.scale( 4 ); // Same effect as above
Efficient implementation of a customizable vector.
Definition: CustomVector.h:407

◆ schurAssign() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
auto blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::schurAssign ( const DenseMatrix< MT, SO > &  rhs) -> DisableIf_t< VectorizedSchurAssign_v<MT> >
inline

Default implementation of the Schur product assignment of a row-major dense matrix.

SIMD optimized implementation of the Schur product assignment of a row-major dense matrix.

Parameters
rhsThe right-hand side dense matrix for the Schur product.
Returns
void

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.

◆ schurAssign() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::schurAssign ( const DenseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the Schur product assignment of a column-major dense matrix.

Parameters
rhsThe right-hand side dense matrix for the Schur product.
Returns
void

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.

◆ schurAssign() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::schurAssign ( const SparseMatrix< MT, SO > &  rhs)
inline

Default implementation of the Schur product assignment of a row-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix for the Schur product.
Returns
void

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.

◆ schurAssign() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::schurAssign ( const SparseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the Schur product assignment of a column-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix for the Schur product.
Returns
void

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.

◆ spacing()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
size_t blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::spacing
inlinenoexcept

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

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

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

◆ store()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::store ( size_t  i,
size_t  j,
const SIMDType value 
)
noexcept

Store of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
valueThe SIMD element to be stored.
Returns
void

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.

◆ storea()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::storea ( size_t  i,
size_t  j,
const SIMDType value 
)
noexcept

Aligned store of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
valueThe SIMD element to be stored.
Returns
void

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.

◆ storeu()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::storeu ( size_t  i,
size_t  j,
const SIMDType value 
)
noexcept

Unaligned store of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
valueThe SIMD element to be stored.
Returns
void

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.

◆ stream()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
BLAZE_ALWAYS_INLINE void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::stream ( size_t  i,
size_t  j,
const SIMDType value 
)
noexcept

Aligned, non-temporal store of a SIMD element of the matrix.

Parameters
iAccess index for the row. The index has to be in the range [0..M-1].
jAccess index for the column. The index has to be in the range [0..N-1].
valueThe SIMD element to be stored.
Returns
void

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.

◆ subAssign() [1/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
auto blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::subAssign ( const DenseMatrix< MT, SO > &  rhs) -> DisableIf_t< VectorizedSubAssign_v<MT> >
inline

Default implementation of the subtraction assignment of a row-major dense matrix.

SIMD optimized implementation of the subtraction assignment of a row-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be subtracted.
Returns
void

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.

◆ subAssign() [2/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::subAssign ( const DenseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the subtraction assignment of a column-major dense matrix.

Parameters
rhsThe right-hand side dense matrix to be subtracted.
Returns
void

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.

◆ subAssign() [3/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::subAssign ( const SparseMatrix< MT, SO > &  rhs)
inline

Default implementation of the subtraction assignment of a row-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be subtracted.
Returns
void

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.

◆ subAssign() [4/4]

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
template<typename MT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::subAssign ( const SparseMatrix< MT,!SO > &  rhs)
inline

Default implementation of the subtraction assignment of a column-major sparse matrix.

Parameters
rhsThe right-hand side sparse matrix to be subtracted.
Returns
void

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.

◆ swap()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
void blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::swap ( CustomMatrix< Type, AF, PF, SO, Tag, RT > &  m)
inlinenoexcept

Swapping the contents of two matrices.

Parameters
mThe matrix to be swapped.
Returns
void

◆ transpose()

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
CustomMatrix< Type, AF, PF, SO, Tag, RT > & blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::transpose
inline

In-place transpose of the matrix.

Returns
Reference to the transposed matrix.
Exceptions
std::logic_errorImpossible transpose operation.

In case the matrix is not a square matrix, a std::logic_error exception is thrown.

Member Data Documentation

◆ simdEnabled

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
constexpr bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::simdEnabled = IsVectorizable_v<Type>
staticconstexpr

Compilation flag for SIMD optimization.

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

◆ smpAssignable

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
constexpr bool blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::smpAssignable = !IsSMPAssignable_v<Type>
staticconstexpr

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).

◆ v_

template<typename Type , AlignmentFlag AF, PaddingFlag PF, bool SO, typename Tag , typename RT >
Type* blaze::CustomMatrix< Type, AF, PF, SO, Tag, RT >::v_
private

The custom array of 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

\[\left(\begin{array}{*{5}{c}} 0 & 1 & 2 & \cdots & N-1 \\ N & N+1 & N+2 & \cdots & 2 \cdot N-1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ M \cdot N-N & M \cdot N-N+1 & M \cdot N-N+2 & \cdots & M \cdot N-1 \\ \end{array}\right)\]

.


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