Blaze  3.6
Classes | Functions

Classes

class  blaze::ZeroMatrix< Type, SO >
 Efficient implementation of an $ M \times N $ zero matrix.The ZeroMatrix class template is the representation of an immutable, arbitrary sized zero matrix with $ M \cdot N $ 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...
 

Functions

template<typename T , bool SO = defaultStorageOrder>
decltype(auto) constexpr blaze::zero (size_t m, size_t n) noexcept
 Creating a zero matrix. More...
 
template<typename MT , bool SO>
ZeroMatrix< ElementType_t< MT >, SO > blaze::declzero (const Matrix< MT, SO > &m)
 Declares the given matrix expression m as zero matrix. More...
 

ZeroMatrix operators

template<typename Type , bool SO>
constexpr void blaze::reset (ZeroMatrix< Type, SO > &m) noexcept
 Resetting the given zero matrix. More...
 
template<typename Type , bool SO>
constexpr void blaze::reset (ZeroMatrix< Type, SO > &m, size_t i) noexcept
 Reset the specified row/column of the given zero matrix. More...
 
template<typename Type , bool SO>
constexpr void blaze::clear (ZeroMatrix< Type, SO > &m) noexcept
 Clearing the given zero matrix. More...
 
template<bool RF, typename Type , bool SO>
constexpr bool blaze::isDefault (const ZeroMatrix< Type, SO > &m) noexcept
 Returns whether the given zero matrix is in default state. More...
 
template<typename Type , bool SO>
constexpr bool blaze::isIntact (const ZeroMatrix< Type, SO > &m) noexcept
 Returns whether the invariants of the given zero matrix are intact. More...
 
template<typename Type , bool SO>
constexpr void blaze::swap (ZeroMatrix< Type, SO > &a, ZeroMatrix< Type, SO > &b) noexcept
 Swapping the contents of two zero matrices. More...
 

Detailed Description

Function Documentation

◆ clear()

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

Clearing the given zero matrix.

Parameters
mThe zero matrix to be cleared.
Returns
void

◆ declzero()

template<typename MT , bool SO>
ZeroMatrix<ElementType_t<MT>,SO> blaze::declzero ( const Matrix< MT, SO > &  m)
inline

Declares the given matrix expression m as zero matrix.

Parameters
mThe input matrix.
Returns
The redeclared matrix.

The declzero function declares the given dense or sparse matrix expression m as zero matrix. The following example demonstrates the use of the declzero function:

// ... Resizing and initialization
B = declzero( A );

◆ isDefault()

template<bool RF, typename Type , bool SO>
constexpr bool blaze::isDefault ( const ZeroMatrix< Type, SO > &  m)
inlinenoexcept

Returns whether the given zero matrix is in default state.

Parameters
mThe matrix to be tested for its default state.
Returns
true in case the given matrix's rows and columns are zero, false otherwise.

This function checks whether the zero matrix is in default (constructed) state, i.e. if it's number of rows and columns is 0. In case it is in default state, the function returns true, else it will return false. The following example demonstrates the use of the isDefault() function:

// ... Resizing and initialization
if( isDefault( Z ) ) { ... }

Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):

if( isDefault<relaxed>( Z ) ) { ... }

◆ isIntact()

template<typename Type , bool SO>
constexpr bool blaze::isIntact ( const ZeroMatrix< Type, SO > &  m)
inlinenoexcept

Returns whether the invariants of the given zero matrix are intact.

Parameters
mThe zero matrix to be tested.
Returns
true in case the given matrix's invariants are intact, false otherwise.

This function checks whether the invariants of the zero matrix are intact, i.e. if its state is valid. In case the invariants are intact, the function returns true, else it will return false. The following example demonstrates the use of the isIntact() function:

// ... Resizing and initialization
if( isIntact( Z ) ) { ... }

◆ reset() [1/2]

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

Resetting the given zero matrix.

Parameters
mThe zero matrix to be resetted.
Returns
void

◆ reset() [2/2]

template<typename Type , bool SO>
constexpr void blaze::reset ( ZeroMatrix< Type, SO > &  m,
size_t  i 
)
inlinenoexcept

Reset the specified row/column of the given zero matrix.

Parameters
mThe matrix to be resetted.
iThe index of the row/column to be resetted.
Returns
void

This function resets the values in the specified row/column of the given zero matrix to their default value. In case the given matrix is a rowMajor matrix the function resets the values in row i, if it is a columnMajor matrix the function resets the values in column i.

◆ swap()

template<typename Type , bool SO>
constexpr void blaze::swap ( ZeroMatrix< Type, SO > &  a,
ZeroMatrix< Type, SO > &  b 
)
inlinenoexcept

Swapping the contents of two zero matrices.

Parameters
aThe first matrix to be swapped.
bThe second matrix to be swapped.
Returns
void

◆ zero()

template<typename T , bool SO = defaultStorageOrder>
decltype(auto) constexpr blaze::zero ( size_t  m,
size_t  n 
)
inlinenoexcept

Creating a zero matrix.

Parameters
mThe number of rows of the zero matrix.
nThe number of columns of the zero matrix.
Returns
A zero matrix of the given size.

This function creates a zero matrix of the given element type and size. By default, the resulting zero matrix is a row-major matrix, but it is possible to specify the storage order explicitly:

// Creates the row-major zero matrix
// ( 0 0 0 0 0 )
// ( 0 0 0 0 0 )
auto Z1 = zero<int>( 2UL, 5UL );
// Creates the row-major zero matrix
// ( 0.0 0.0 )
// ( 0.0 0.0 )
// ( 0.0 0.0 )
auto Z2 = zero<double,rowMajor>( 3UL, 2UL );
// Creates the column-major zero matrix
// ( 0U 0U 0U 0U 0U 0U 0U )
// ( 0U 0U 0U 0U 0U 0U 0U )
auto Z3 = zero<unsigned int,columnMajor>( 2UL, 7UL );