Blaze  3.6
Classes | Functions
UniformVector

Classes

class  blaze::UniformVector< Type, TF >
 Efficient implementation of a uniform vector.The UniformVector class template is the representation of an arbitrary sized uniform vector with elements of arbitrary type. The type of the elements and the transpose flag of the vector can be specified via the two template parameters: More...
 

Functions

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

UniformVector operators

template<typename Type , bool TF>
constexpr void blaze::reset (UniformVector< Type, TF > &v)
 Resetting the given uniform vector. More...
 
template<typename Type , bool TF>
constexpr void blaze::clear (UniformVector< Type, TF > &v)
 Clearing the given uniform vector. More...
 
template<bool RF, typename Type , bool TF>
constexpr bool blaze::isDefault (const UniformVector< Type, TF > &v)
 Returns whether the given uniform vector is in default state. More...
 
template<typename Type , bool TF>
constexpr bool blaze::isIntact (const UniformVector< Type, TF > &v) noexcept
 Returns whether the invariants of the given uniform vector are intact. More...
 
template<typename Type , bool TF>
constexpr void blaze::swap (UniformVector< Type, TF > &a, UniformVector< Type, TF > &b) noexcept
 Swapping the contents of two vectors. More...
 

Detailed Description

Function Documentation

◆ clear()

template<typename Type , bool TF>
constexpr void blaze::clear ( UniformVector< Type, TF > &  v)
inline

Clearing the given uniform vector.

Parameters
vThe uniform vector to be cleared.
Returns
void

◆ isDefault()

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

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

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>
constexpr bool blaze::isIntact ( const UniformVector< Type, TF > &  v)
inlinenoexcept

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

◆ reset()

template<typename Type , bool TF>
constexpr void blaze::reset ( UniformVector< Type, TF > &  v)
inline

Resetting the given uniform vector.

Parameters
vThe uniform vector to be resetted.
Returns
void

◆ swap()

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

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 >
decltype(auto) constexpr blaze::uniform ( size_t  n,
T &&  init 
)
inline

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