Blaze 3.9
Classes

Classes

class  blaze::UniformMatrix< Type, SO, Tag >
 Efficient implementation of a uniform matrix. More...
 

UniformMatrix operators

template<RelaxationFlag RF, typename Type , bool SO, typename Tag >
constexpr bool blaze::isDefault (const UniformMatrix< Type, SO, Tag > &m)
 Returns whether the given uniform matrix is in default state. More...
 
template<typename Type , bool SO, typename Tag >
constexpr bool blaze::isIntact (const UniformMatrix< Type, SO, Tag > &m) noexcept
 Returns whether the invariants of the given uniform matrix are intact. More...
 
template<typename Type , bool SO, typename Tag >
constexpr void blaze::swap (UniformMatrix< Type, SO, Tag > &a, UniformMatrix< Type, SO, Tag > &b) noexcept
 Swapping the contents of two uniform matrices. More...
 
template<bool SO = defaultStorageOrder, typename T >
constexpr decltype(auto) blaze::uniform (size_t m, size_t n, T &&init)
 Creating a uniform matrix. More...
 

Detailed Description

Function Documentation

◆ isDefault()

template<RelaxationFlag RF, typename Type , bool SO, typename Tag >
constexpr bool blaze::isDefault ( const UniformMatrix< Type, SO, Tag > &  m)
constexpr

Returns whether the given uniform 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 uniform 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( A ) ) { ... }
Efficient implementation of a uniform matrix.
Definition: UniformMatrix.h:197
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169

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

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

◆ isIntact()

template<typename Type , bool SO, typename Tag >
constexpr bool blaze::isIntact ( const UniformMatrix< Type, SO, Tag > &  m)
constexprnoexcept

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

Parameters
mThe uniform 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 uniform 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( A ) ) { ... }
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207

◆ swap()

template<typename Type , bool SO, typename Tag >
constexpr void blaze::swap ( UniformMatrix< Type, SO, Tag > &  a,
UniformMatrix< Type, SO, Tag > &  b 
)
constexprnoexcept

Swapping the contents of two uniform matrices.

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

◆ uniform()

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

Creating a uniform matrix.

Parameters
mThe number of rows of the uniform matrix.
nThe number of columns of the uniform matrix.
initThe initial value of the matrix elements.
Returns
A uniform matrix of the given size.

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

// Creates the uniform row-major matrix
// ( 1, 1, 1, 1, 1 )
// ( 1, 1, 1, 1, 1 )
auto U1 = uniform( 2UL, 5UL, 1 );
// Creates the uniform row-major matrix
// ( 1.2, 1.2 )
// ( 1.2, 1.2 )
// ( 1.2, 1.2 )
auto U2 = uniform<rowMajor>( 3UL, 2UL, 1.2 );
// Creates the uniform column-major matrix
// ( 5U, 5U, 5U, 5U, 5U, 5U, 5U )
// ( 5U, 5U, 5U, 5U, 5U, 5U, 5U )
auto U3 = uniform<columnMajor>( 2UL, 7UL, 5U );
constexpr decltype(auto) uniform(size_t m, size_t n, T &&init)
Creating a uniform matrix.
Definition: UniformMatrix.h:1640
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99