Blaze 3.9
Classes
UniformVector

Classes

class  blaze::UniformVector< Type, TF, Tag >
 Efficient implementation of a uniform vector. More...
 

UniformVector operators

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

Detailed Description

Function Documentation

◆ isDefault()

template<RelaxationFlag RF, typename Type , bool TF, typename Tag >
constexpr bool blaze::isDefault ( const UniformVector< Type, TF, Tag > &  v)
constexpr

Returns whether the given uniform vector is in default state.

Parameters
vThe uniform vector to be tested for its default state.
Returns
true in case the given vector's size is zero, false otherwise.

This function checks whether the uniform vector is in default (constructed) state, i.e. if it's size 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 vector.
Definition: UniformVector.h:186
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 TF, typename Tag >
constexpr bool blaze::isIntact ( const UniformVector< Type, TF, Tag > &  v)
constexprnoexcept

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

Parameters
vThe uniform vector to be tested.
Returns
true in case the given vector's invariants are intact, false otherwise.

This function checks whether the invariants of the uniform vector 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 TF, typename Tag >
constexpr void blaze::swap ( UniformVector< Type, TF, Tag > &  a,
UniformVector< Type, TF, Tag > &  b 
)
constexprnoexcept

Swapping the contents of two vectors.

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

◆ uniform()

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

Creating a uniform vector.

Parameters
nThe size of the vector.
initThe initial value of the vector elements.
Returns
A uniform vector of the given size.

This function creates a uniform vector of the given size. By default, the resulting uniform vector is a column vector, but it is possible to specify the transpose flag explicitly:

// Creates the uniform column vector ( 1, 1, 1, 1, 1 )
auto u1 = uniform( 5UL, 1 );
// Creates the uniform column vector ( 1.2, 1.2, 1.2 )
auto u2 = uniform<columnVector>( 3UL, 1.2 );
// Creates the uniform row vector ( 5U, 5U, 5U, 5U )
auto u3 = uniform<rowVector>( 4UL, 5U );
constexpr decltype(auto) uniform(size_t m, size_t n, T &&init)
Creating a uniform matrix.
Definition: UniformMatrix.h:1640
constexpr bool columnVector
Transpose flag for column vectors.
Definition: TransposeFlag.h:58
constexpr bool rowVector
Transpose flag for row vectors.
Definition: TransposeFlag.h:73