Modules | Classes | Macros | Typedefs | Functions
Utility module

Modules

 Algorithms
 
 Assertions
 
 Compile time constraints
 
 Meta-Programming Language
 
 Random number generation
 
 Serialization
 
 Singleton
 
 Thread parallelization
 
 Time measurement
 
 Type lists
 
 Type traits
 
 Value traits
 

Classes

class  blaze::AlignedAllocator< Type >
 Allocator for type-specific aligned memory.The AlignedAllocator class template represents an implementation of the allocator concept of the standard library for the allocation of type-specific, aligned, uninitialized memory. The allocator performs its allocation via the blaze::allocate() and blaze::deallocate() functions to guarantee properly aligned memory based on the alignment restrictions of the specified type Type. For instance, in case the given type is a fundamental, built-in data type and in case SSE vectorization is possible, the returned memory is guaranteed to be at least 16-byte aligned. In case AVX is active, the memory is even guaranteed to be at least 32-byte aligned. More...
 
class  blaze::AlignedArray< Type, N, Alignment >
 Implementation of a static array with a fixed alignment.The AlignedArray class template represents a static array with a guaranteed, fixed alignment. The type of the array elements, the number of elements and the alignment of the array can be specified via the three template parameters: More...
 
struct  blaze::DisableIf< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
struct  blaze::EmptyType
 Empty data type for utility purposes. More...
 
struct  blaze::EnableIf< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
class  blaze::FunctionTrace
 RAII object for function tracing.The FunctionTrace class is an auxiliary helper class for the tracing of function calls. It is implemented as a wrapper around std::cerr and is responsible for the atomicity of the output of trace information. More...
 
struct  blaze::IntegralConstant< T, N >
 Generic wrapper for a compile time constant integral value.The IntegralConstant class template represents a generic wrapper for a compile time constant integral value. The value of an IntegralConstant can be accessed via the nested value (which is guaranteed to be of type T), the type can be accessed via the nested type definition ValueType. More...
 
struct  blaze::Limits< Type >
 Numerical limits of built-in data types.The Limits class provides numerical limits for the following built-in data types: More...
 
class  blaze::MemoryPool< Type, Blocksize >
 Memory pool for small objects.The memory pool efficiently improves the performance of dynamic memory allocations for small objects. By allocating a large block of memory that can be dynamically assigned to small objects, the memory allocation is reduced from a few hundred cycles to only a few cycles.
The memory pool is build from memory blocks of type Block, which hold the memory for a specified number of objects. The memory of these blocks is managed as a single free list. More...
 
class  blaze::NonCopyable
 Base class for non-copyable class instances.The NonCopyable class is intended to work as a base class for non-copyable classes. Both the copy constructor and the copy assignment operator are explicitly deleted in order to prohibit copy operations of the derived classes.
. More...
 
class  blaze::NonCreatable
 Base class for non-creatable (static) classes.The NonCreatable class is intended to work as a base class for non-creatable classes, i.e. classes that cannot be instantiated and exclusively offer static functions/data. Both the standard as well as the copy constructor and the copy assignment operator are declared private and left undefinded in order to prohibit the instantiation of objects of derived classes.
. More...
 
class  blaze::NullType
 Utility type for generic codes.The NullType class represents an invalid or terminating data type for generic codes. For instance, the TypeList class uses the NullType as terminating data type for the type list. More...
 
struct  blaze::ArrayDelete
 Array-delete policy class.The ArrayDelete policy functor class applies an array delete operation to the given argument. Note that the array delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply an ArrayDelete functor to a pointer to an array of objects of incomplete type results in a compile time error! More...
 
struct  blaze::Deallocate
 Deallocate policy class.The Deallocate deletion policy is the according deletion policy for arrays allocated via the blaze::allocate function. It uses deallocate to free the resource. Note that the delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply a PtrDelete functor to a pointer to an object of incomplete type results in a compile time error! More...
 
struct  blaze::DefaultDelete< Type >
 Default C++ deletion policy class.The DefaultDelete deletion policy is the standard delete for resources allocated via the new operator. It uses delete or array delete (depending on the template argument) to free the resource: More...
 
struct  blaze::NoDelete
 No-delete policy class. More...
 
struct  blaze::PtrDelete
 Pointer-delete policy class.The PtrDelete policy functor class applies a delete operation to the given argument. Note that the delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply a PtrDelete functor to a pointer to an object of incomplete type results in a compile time error! More...
 
class  blaze::SmallArray< T, N, A >
 Implementation of a dynamic array with small array optimization.The SmallArray class template is a hybrid data structure between a static array and a dynamic array. It provides static, in-place memory for up to N elements of type T, but can grow beyond this size by allocating dynamic memory via its allocator of type A. More...
 
class  blaze::UnsignedValue< T >
 Implementation of a wrapper for built-in unsigned integral values.This class wraps a value of built-in unsigned integral type in order to be able to extract non-negative unsigned integral values from an input stream. More...
 
class  blaze::complex
 Complex data type of the Blaze library. More...
 
class  blaze::initializer_list
 Initializer list type of the Blaze library. More...
 
class  blaze::size_t
 Size type of the Blaze library. More...
 
class  blaze::ptrdiff_t
 Pointer difference type of the Blaze library. More...
 
class  blaze::int8_t
 8-bit signed integer type of the Blaze library. More...
 
class  blaze::uint8_t
 8-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int16_t
 16-bit signed integer type of the Blaze library. More...
 
class  blaze::uint16_t
 16-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int32_t
 32-bit signed integer type of the Blaze library. More...
 
class  blaze::uint32_t
 32-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int64_t
 64-bit signed integer type of the Blaze library. More...
 
class  blaze::uint64_t
 64-bit unsigned integer type of the Blaze library. More...
 

Macros

#define BLAZE_THROW(EXCEPTION)   throw EXCEPTION
 Macro for the error reporting mechanism of the Blaze library.This macro encapsulates the default, general way of the Blaze library to report errors of any kind by throwing an exception. Also, since under certain conditions and environments it may be desirable to replace exceptions by a different error reporting mechanism this macro provides an opportunity to customize the error reporting approach. More...
 
#define BLAZE_THROW_BAD_ALLOC   BLAZE_THROW( std::bad_alloc() )
 Macro for the emission of a std::bad_alloc exception.This macro encapsulates the default way of Blaze to throw a std::bad_alloc exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)   BLAZE_THROW( std::logic_error( MESSAGE ) )
 Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Blaze to throw a std::logic_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)   BLAZE_THROW( std::invalid_argument( MESSAGE ) )
 Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way of Blaze to throw a std::invalid_argument exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_LENGTH_ERROR(MESSAGE)   BLAZE_THROW( std::length_error( MESSAGE ) )
 Macro for the emission of a std::length_error exception.This macro encapsulates the default way of Blaze to throw a std::length_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)   BLAZE_THROW( std::out_of_range( MESSAGE ) )
 Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Blaze to throw a std::out_of_range exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_RUNTIME_ERROR(MESSAGE)   BLAZE_THROW( std::runtime_error( MESSAGE ) )
 Macro for the emission of a std::runtime_error exception.This macro encapsulates the default way of Blaze to throw a std::runtime_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_OVERFLOW_ERROR(MESSAGE)   BLAZE_THROW( std::overflow_error( MESSAGE ) )
 Macro for the emission of a std::overflow_error exception.This macro encapsulates the default way of Blaze to throw a std::overflow_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_THROW_UNDERFLOW_ERROR(MESSAGE)   BLAZE_THROW( std::underflow_error( MESSAGE ) )
 Macro for the emission of a std::underflow_error exception.This macro encapsulates the default way of Blaze to throw a std::underflow_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior. More...
 
#define BLAZE_FUNCTION_TRACE
 Function trace macro.This macro can be used to reliably trace function calls. In case function tracing is activated, function traces are written to the console via std::cerr. The following short example demonstrates how the function trace macro is used: More...
 

Typedefs

template<bool Condition, typename T = void>
using blaze::DisableIf_t = typename DisableIf< Condition, T >::Type
 Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenient shortcut to access the nested Type of the DisableIf class template. For instance, given the type T the following two type definitions are identical: More...
 
template<bool Condition, typename T = void>
using blaze::EnableIf_t = typename EnableIf< Condition, T >::Type
 Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient shortcut to access the nested Type of the EnableIf class template. For instance, given the type T the following two type definitions are identical: More...
 
using blaze::FalseType = BoolConstant< false >
 Type/value traits base class.The FalseType class is used as base class for type traits and value traits that evaluate to false.
 
template<bool B>
using blaze::BoolConstant = IntegralConstant< bool, B >
 Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents a generic wrapper for a compile time constant boolean value. The value of a BoolConstant can be accessed via the nested value (which is guaranteed to be of type bool), the type can be accessed via the nested type definition ValueType. More...
 
template<bool Condition, typename T1 , typename T2 >
using blaze::If_t = typename If< Condition, T1, T2 >::Type
 Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenient shortcut to access the nested Type of the If class template. For instance, given the types C, T1, and T2 the following two type definitions are identical: More...
 
using blaze::TrueType = BoolConstant< true >
 Type traits base class.The TrueType class is used as base class for type traits and value traits that evaluate to true.
 
using blaze::byte_t = unsigned char
 Byte data type of the Blaze library.The byte data type is guaranteed to be an integral data type of size 1.
 
using blaze::large_t = int64_t
 The largest available signed integer data type.
 
using blaze::ularge_t = uint64_t
 The largest available unsigned integer data type.
 
using blaze::id_t = ularge_t
 Unsigned integer data type for integral IDs.
 

Functions

template<typename T >
BLAZE_ALWAYS_INLINE bool blaze::checkAlignment (const T *address)
 Checks the alignment of the given address. More...
 
template<typename T >
constexpr AddConst_t< T > & blaze::as_const (T &v) noexcept
 Adding 'const' to the given lvalue. More...
 
template<typename T >
void blaze::as_const (const T &&)=delete
 Overload of the as_const() function for rvalues.This overload of the as_const() function disables its use on rvalues. This prevents potential misuse as in for instance the following example: More...
 
template<typename T , size_t N>
constexpr size_t blaze::dimensionof (T(&a)[N])
 Static evaluation of array dimensions. More...
 
template<typename T >
EnableIf_t< IsBuiltin_v< T >, T *> blaze::allocate (size_t size)
 Aligned array allocation for built-in data types. More...
 
template<typename T >
EnableIf_t< IsBuiltin_v< T > > blaze::deallocate (T *address) noexcept
 Deallocation of memory for built-in data types. More...
 
template<typename T >
BLAZE_ALWAYS_INLINE size_t blaze::misalignment (const T *address)
 Computes the misalignment of the given address. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::cend (SmallArray< T, N, A > &sa)
 Returns an iterator just past the last element of the given small array. More...
 
template<typename... Args>
constexpr void blaze::UNUSED_PARAMETER (const Args &...)
 Suppression of unused parameter warnings. More...
 

Checked delete operations

template<typename T >
void blaze::checkedDelete (T *ptr)
 Type-checked delete operation. More...
 
template<typename T >
void blaze::checkedArrayDelete (T *ptr)
 Type-checked delete[] operation. More...
 

Numeric cast operators

template<typename To , typename From >
To blaze::numeric_cast (From from)
 Checked conversion of values of numeric type. More...
 

Pointer cast operators

template<typename To , typename From >
To * blaze::static_pointer_cast (From *ptr)
 Static cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::dynamic_pointer_cast (From *ptr)
 Dynamic cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::const_pointer_cast (From *ptr)
 Const cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::reinterpret_pointer_cast (From *ptr)
 Reinterpret cast for pointer types. More...
 

Smart pointer cast operators

template<typename To , template< typename > class S, typename From >
S< To > blaze::static_pointer_cast (S< From > ptr)
 Static cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::dynamic_pointer_cast (S< From > ptr)
 Dynamic cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::const_pointer_cast (S< From > ptr)
 Const cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::reinterpret_pointer_cast (S< From > ptr)
 Reinterpret cast for smart pointers. More...
 

SmallArray operators

template<typename T1 , size_t N1, typename A1 , typename T2 , size_t N2, typename A2 >
bool blaze::operator== (const SmallArray< T1, N1, A1 > &lhs, const SmallArray< T2, N2, A2 > &rhs)
 Equality operator for the comparison of two dense arrays. More...
 
template<typename T1 , size_t N1, typename A1 , typename T2 , size_t N2, typename A2 >
bool blaze::operator!= (const SmallArray< T1, N1, A1 > &lhs, const SmallArray< T2, N2, A2 > &rhs)
 Inequality operator for the comparison of two dense arrays. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::Iterator blaze::begin (SmallArray< T, N, A > &sa)
 Returns an iterator to the first element of the given small array. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::begin (const SmallArray< T, N, A > &sa)
 Returns an iterator to the first element of the given small array. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::cbegin (const SmallArray< T, N, A > &sa)
 Returns an iterator to the first element of the given small array. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::Iterator blaze::end (SmallArray< T, N, A > &sa)
 Returns an iterator just past the last element of the given small array. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::end (const SmallArray< T, N, A > &sa)
 Returns an iterator just past the last element of the given small array. More...
 
template<typename T , size_t N, typename A >
void blaze::clear (SmallArray< T, N, A > &sa)
 Clearing the given small array. More...
 
template<typename T , size_t N, typename A >
void blaze::swap (SmallArray< T, N, A > &a, SmallArray< T, N, A > &b) noexcept(IsNothrowMoveConstructible_v< T >)
 Swapping the contents of two small arrays. More...
 
template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::cend (const SmallArray< T, N, A > &sa)
 

Time functions

std::string blaze::getDate ()
 Creating a formated date string in the form YYYY-MM-DD. More...
 
std::string blaze::getTime ()
 Creating a formated time and date string. More...
 
double blaze::getWcTime ()
 Returns the current wall clock time in seconds. More...
 
double blaze::getCpuTime ()
 Returns the current CPU time in seconds. More...
 

Detailed Description

Macro Definition Documentation

◆ BLAZE_FUNCTION_TRACE

#define BLAZE_FUNCTION_TRACE

Function trace macro.This macro can be used to reliably trace function calls. In case function tracing is activated, function traces are written to the console via std::cerr. The following short example demonstrates how the function trace macro is used:

int main( int argc, char** argv )
{
// ...
}

The macro should be used as the very first statement inside the function in order to guarantee that writing the function trace is the very first and last action of the function call.
Function tracing can be enabled or disabled via the BLAZE_USE_FUNCTION_TRACES macro. If function tracing is activated, trace information of the following form will be written to std::cerr:

+ [Thread 0] Entering function 'int main()' in file 'TraceDemo.cpp'
- [Thread 0] Leaving function 'int main()' in file 'TraceDemo.cpp'

In case function tracing is deactivated, all function trace functionality is completely removed from the code, i.e. no function traces are logged and no overhead results from the BLAZE_FUNCTION_TRACE macro.

◆ BLAZE_THROW

#define BLAZE_THROW (   EXCEPTION)    throw EXCEPTION

Macro for the error reporting mechanism of the Blaze library.This macro encapsulates the default, general way of the Blaze library to report errors of any kind by throwing an exception. Also, since under certain conditions and environments it may be desirable to replace exceptions by a different error reporting mechanism this macro provides an opportunity to customize the error reporting approach.

The macro excepts a single argument, which specifies the exception to be thrown:

#define BLAZE_THROW( EXCEPTION ) \
throw EXCEPTION

In order to customize the error reporing mechanism all that needs to be done is to define the macro prior to including any Blaze header file. This will cause the Blaze specific mechanism to be overridden. The following example demonstrates this by replacing exceptions by a call to a log() function and a direct call to abort:

#define BLAZE_THROW( EXCEPTION ) \
log( "..." ); \
abort()
#include <blaze/Blaze.h>
Note
It is possible to execute several statements instead of executing a single statement to throw an exception. Also note that it is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the error reporting mechanism via this macro can have a significant effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_BAD_ALLOC

#define BLAZE_THROW_BAD_ALLOC   BLAZE_THROW( std::bad_alloc() )

Macro for the emission of a std::bad_alloc exception.This macro encapsulates the default way of Blaze to throw a std::bad_alloc exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

#define BLAZE_THROW_BAD_ALLOC \
BLAZE_THROW( std::bad_alloc() )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::bad_alloc by a custom exception type:

class BadAlloc
{
public:
BadAlloc();
// ...
};
#define BLAZE_THROW_BAD_ALLOC \
throw BadAlloc()
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_INVALID_ARGUMENT

#define BLAZE_THROW_INVALID_ARGUMENT (   MESSAGE)    BLAZE_THROW( std::invalid_argument( MESSAGE ) )

Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way of Blaze to throw a std::invalid_argument exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_INVALID_ARGUMENT( MESSAGE ) \
BLAZE_THROW( std::invalid_argument( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::invalid_argument by a custom exception type:

class InvalidArgument
{
public:
InvalidArgument();
explicit InvalidArgument( const std::string& message );
// ...
};
#define BLAZE_THROW_INVALID_ARGUMENT( MESSAGE ) \
throw InvalidArgument( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_LENGTH_ERROR

#define BLAZE_THROW_LENGTH_ERROR (   MESSAGE)    BLAZE_THROW( std::length_error( MESSAGE ) )

Macro for the emission of a std::length_error exception.This macro encapsulates the default way of Blaze to throw a std::length_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_LENGTH_ERROR( MESSAGE ) \
BLAZE_THROW( std::length_error( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::length_error by a custom exception type:

class LengthError
{
public:
LengthError();
explicit LengthError( const std::string& message );
// ...
};
#define BLAZE_THROW_LENGTH_ERROR( MESSAGE ) \
throw LengthError( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_LOGIC_ERROR

#define BLAZE_THROW_LOGIC_ERROR (   MESSAGE)    BLAZE_THROW( std::logic_error( MESSAGE ) )

Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Blaze to throw a std::logic_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_LOGIC_ERROR( MESSAGE ) \
BLAZE_THROW( std::logic_error( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::logic_error by a custom exception type:

class LogicError
{
public:
LogicError();
explicit LogicError( const std::string& message );
// ...
};
#define BLAZE_THROW_LOGIC_ERROR( MESSAGE ) \
throw LogicError( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_OUT_OF_RANGE

#define BLAZE_THROW_OUT_OF_RANGE (   MESSAGE)    BLAZE_THROW( std::out_of_range( MESSAGE ) )

Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Blaze to throw a std::out_of_range exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_OUT_OF_RANGE( MESSAGE ) \
BLAZE_THROW( std::out_of_range( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::out_of_range by a custom exception type:

class OutOfRange
{
public:
OutOfRange();
explicit OutOfRange( const std::string& message );
// ...
};
#define BLAZE_THROW_OUT_OF_RANGE( MESSAGE ) \
throw OutOfRange( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_OVERFLOW_ERROR

#define BLAZE_THROW_OVERFLOW_ERROR (   MESSAGE)    BLAZE_THROW( std::overflow_error( MESSAGE ) )

Macro for the emission of a std::overflow_error exception.This macro encapsulates the default way of Blaze to throw a std::overflow_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_OVERFLOW_ERROR( MESSAGE ) \
BLAZE_THROW( std::overflow_error( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::overflow_error by a custom exception type:

class OverflowError
{
public:
OverflowError();
explicit OverflowError( const std::string& message );
// ...
};
#define BLAZE_THROW_OVERFLOW_ERROR( MESSAGE ) \
throw OverflowError( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_RUNTIME_ERROR

#define BLAZE_THROW_RUNTIME_ERROR (   MESSAGE)    BLAZE_THROW( std::runtime_error( MESSAGE ) )

Macro for the emission of a std::runtime_error exception.This macro encapsulates the default way of Blaze to throw a std::runtime_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_RUNTIME_ERROR( MESSAGE ) \
BLAZE_THROW( std::runtime_error( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::runtime_error by a custom exception type:

class RuntimeError
{
public:
RuntimeError();
explicit RuntimeError( const std::string& message );
// ...
};
#define BLAZE_THROW_RUNTIME_ERROR( MESSAGE ) \
throw RuntimeError( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

◆ BLAZE_THROW_UNDERFLOW_ERROR

#define BLAZE_THROW_UNDERFLOW_ERROR (   MESSAGE)    BLAZE_THROW( std::underflow_error( MESSAGE ) )

Macro for the emission of a std::underflow_error exception.This macro encapsulates the default way of Blaze to throw a std::underflow_error exception. Also, since it may be desirable to replace the type of exception by a custom exception type this macro provides an opportunity to customize the behavior.

The macro excepts a single argument, which specifies the message of the exception:

#define BLAZE_THROW_UNDERFLOW_ERROR( MESSAGE ) \
BLAZE_THROW( std::underflow_error( MESSAGE ) )

In order to customize the type of exception all that needs to be done is to define the macro prior to including any Blaze header file. This will override the Blaze default behavior. The following example demonstrates this by replacing std::underflow_error by a custom exception type:

class UnderflowError
{
public:
UnderflowError();
explicit UnderflowError( const std::string& message );
// ...
};
#define BLAZE_THROW_UNDERFLOW_ERROR( MESSAGE ) \
throw UnderflowError( MESSAGE )
#include <blaze/Blaze.h>
Note
It is recommended to define the macro such that a subsequent semicolon is required!
Warning
This macro is provided with the intention to assist in adapting Blaze to special conditions and environments. However, the customization of the type of exception via this macro may have an effect on the library. Thus be advised to use the macro with due care!

Typedef Documentation

◆ BoolConstant

template<bool B>
using blaze::BoolConstant = typedef IntegralConstant<bool,B>

Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents a generic wrapper for a compile time constant boolean value. The value of a BoolConstant can be accessed via the nested value (which is guaranteed to be of type bool), the type can be accessed via the nested type definition ValueType.

using namespace blaze;
BoolConstant<true>::value // Evaluates to true

◆ DisableIf_t

template<bool Condition, typename T = void>
using blaze::DisableIf_t = typedef typename DisableIf<Condition,T>::Type

Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenient shortcut to access the nested Type of the DisableIf class template. For instance, given the type T the following two type definitions are identical:

using Type1 = typename DisableIf< IsBuiltin_v<T> >::Type;
using Type2 = DisableIf_t< IsBuiltin_v<T> >;

◆ EnableIf_t

template<bool Condition, typename T = void>
using blaze::EnableIf_t = typedef typename EnableIf<Condition,T>::Type

Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient shortcut to access the nested Type of the EnableIf class template. For instance, given the type T the following two type definitions are identical:

using Type1 = typename EnableIf< IsBuiltin_v<T> >::Type;
using Type2 = EnableIf_t< IsBuiltin_v<T> >;

◆ If_t

template<bool Condition, typename T1 , typename T2 >
using blaze::If_t = typedef typename If<Condition,T1,T2>::Type

Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenient shortcut to access the nested Type of the If class template. For instance, given the types C, T1, and T2 the following two type definitions are identical:

using Type1 = typename If< IsBuiltin_v<C>, T1, T2 >::Type;
using Type2 = If_t< IsBuiltin_v<C>, T1, T2 >;

Function Documentation

◆ allocate()

template<typename T >
EnableIf_t< IsBuiltin_v<T>, T* > blaze::allocate ( size_t  size)

Aligned array allocation for built-in data types.

Parameters
sizeThe number of elements of the given type to allocate.
Returns
Pointer to the first element of the aligned array.
Exceptions
std::bad_allocAllocation failed.

The allocate() function provides the functionality to allocate memory based on the alignment restrictions of the given built-in data type. For instance, in case SSE vectorization is possible, the returned memory is guaranteed to be at least 16-byte aligned. In case AVX is active, the memory is even guaranteed to be at least 32-byte aligned.

Examples:

// Guaranteed to be 16-byte aligned (32-byte aligned in case AVX is used)
double* dp = allocate<double>( 10UL );

◆ as_const() [1/2]

template<typename T >
constexpr AddConst_t<T>& blaze::as_const ( T &  v)
inlinenoexcept

Adding 'const' to the given lvalue.

Parameters
vThe given lvalue.
Returns
The const-qualified lvalue.

This function adds the 'const' qualifier to the given lvalue.

◆ as_const() [2/2]

template<typename T >
void blaze::as_const ( const T &&  )
delete

Overload of the as_const() function for rvalues.This overload of the as_const() function disables its use on rvalues. This prevents potential misuse as in for instance the following example:

for( const auto&& value : as_const( getTemporary() ) )
{
// ...
}

◆ begin() [1/2]

template<typename T , size_t N, typename A >
SmallArray< T, N, A >::Iterator blaze::begin ( SmallArray< T, N, A > &  sa)
inline

Returns an iterator to the first element of the given small array.

Parameters
saThe given small array.
Returns
Iterator to the first element of the given small array.

◆ begin() [2/2]

template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::begin ( const SmallArray< T, N, A > &  sa)
inline

Returns an iterator to the first element of the given small array.

Parameters
saThe given small array.
Returns
Iterator to the first element of the given small array.

◆ cbegin()

template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::cbegin ( const SmallArray< T, N, A > &  sa)
inline

Returns an iterator to the first element of the given small array.

Parameters
saThe given small array.
Returns
Iterator to the first element of the given small array.

◆ cend()

template<typename T , size_t N, typename A >
SmallArray<T,N,A>::ConstIterator blaze::cend ( SmallArray< T, N, A > &  sa)
inline

Returns an iterator just past the last element of the given small array.

Parameters
saThe given small array.
Returns
Iterator just past the last element of the given small array.

◆ checkAlignment()

template<typename T >
BLAZE_ALWAYS_INLINE bool blaze::checkAlignment ( const T *  address)

Checks the alignment of the given address.

Parameters
addressThe address to be checked.
Returns
true in case the address is properly aligned, false if it is not.

This function performs an alignment check on the given address. For instance, for fundamental data types that can be vectorized via SSE or AVX instructions, the proper alignment is 16 or 32 bytes, respectively. In case the given address is properly aligned, the function returns true, otherwise it returns false.

◆ checkedArrayDelete()

template<typename T >
void blaze::checkedArrayDelete ( T *  ptr)

Type-checked delete[] operation.

Parameters
ptrThe pointer to the array to be deleted.
Returns
void

This function frees the given pointer resource via delete[]. Note that the delete[] operation is NOT permitted for incomplete types (i.e. declared but undefined data types). The attempt to use this function for a pointer to an array of objects of incomplete type results in a compile time error!

◆ checkedDelete()

template<typename T >
void blaze::checkedDelete ( T *  ptr)

Type-checked delete operation.

Parameters
ptrThe pointer to be deleted.
Returns
void

This function frees the given pointer resource via delete. Note that the delete operation is NOT permitted for incomplete types (i.e. declared but undefined data types). The attempt to use this function for a pointer to an object of incomplete type results in a compile time error!

◆ clear()

template<typename T , size_t N, typename A >
void blaze::clear ( SmallArray< T, N, A > &  sa)
inline

Clearing the given small array.

Parameters
saThe small array to be cleared.
Returns
void

◆ const_pointer_cast() [1/2]

template<typename To , typename From >
To * blaze::const_pointer_cast ( From *  ptr)
inline

Const cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The const_pointer_cast function is used exactly as the built-in const_cast operator but for pointer types.

class A { ... };
const A* a1; // Pointer to a constant A object
A* a2 = const_pointer_cast<A>( a1 ); // Const cast to a pointer to a non-constant A object

◆ const_pointer_cast() [2/2]

template<typename To , template< typename > class S, typename From >
S< To > blaze::const_pointer_cast ( S< From >  ptr)
inline

Const cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The const_pointer_cast function is used exactly as the built-in const_cast operator but for smart pointers.

class A { ... };
using APtr = SharedPtr<A>;
using ConstAPtr = SharedPtr<const A>;
ConstAPtr a1; // Smart pointer to a constant A object
APtr a2 = const_pointer_cast<A>( a1 ); // Const cast to a smart pointer to a non-constant A object

◆ deallocate()

template<typename T >
EnableIf_t< IsBuiltin_v<T> > blaze::deallocate ( T *  address)
noexcept

Deallocation of memory for built-in data types.

Parameters
addressThe address of the first element of the array to be deallocated.
Returns
void

This function deallocates the given memory that was previously allocated via the allocate() function.

◆ dimensionof()

template<typename T , size_t N>
constexpr size_t blaze::dimensionof ( T(&)  a[N])
inline

Static evaluation of array dimensions.

Parameters
aReference to a static array of type T and size N.
Returns
Dimension of the static array.

The dimensionof function is a safe way to evaluate the size of an array. The function only works for array arguments and fails for pointers and user-defined class types.

int ai[ 42 ];
int* pi( ai );
std::vector<int> vi( 42 );
dimensionof( ai ); // Returns the size of the integer array (42)
dimensionof( pi ); // Fails to compile!
dimensionof( vi ); // Fails to compile!

◆ dynamic_pointer_cast() [1/2]

template<typename To , typename From >
To * blaze::dynamic_pointer_cast ( From *  ptr)
inline

Dynamic cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The dynamic_pointer_cast function is used exactly as the built-in dynamic_cast operator but for pointer types. As in case with the built-in dynamic_cast 0 is returned if the runtime type conversion doesn't succeed.

class B { ... };
class D : public B { ... };
B* b = ...; // Base pointer
D* d = dynamic_pointer_cast<D>( b ); // Dynamic down-cast

◆ dynamic_pointer_cast() [2/2]

template<typename To , template< typename > class S, typename From >
S< To > blaze::dynamic_pointer_cast ( S< From >  ptr)
inline

Dynamic cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The dynamic_pointer_cast function is used exactly as the built-in dynamic_cast operator but for smart pointers. As in case with the built-in dynamic_cast 0 is returned if the runtime type conversion doesn't succeed.

class B { ... };
class D : public B { ... };
using BPtr = SharedPtr<B>;
using DPtr = SharedPtr<D>;
BPtr b = ...; // Base smart pointer
DPtr d = dynamic_pointer_cast<D>( b ); // Dynamic down-cast

◆ end() [1/2]

template<typename T , size_t N, typename A >
SmallArray< T, N, A >::Iterator blaze::end ( SmallArray< T, N, A > &  sa)
inline

Returns an iterator just past the last element of the given small array.

Parameters
saThe given small array.
Returns
Iterator just past the last element of the given small array.

◆ end() [2/2]

template<typename T , size_t N, typename A >
SmallArray< T, N, A >::ConstIterator blaze::end ( const SmallArray< T, N, A > &  sa)
inline

Returns an iterator just past the last element of the given small array.

Parameters
saThe given small array.
Returns
Iterator just past the last element of the given small array.

◆ getCpuTime()

double blaze::getCpuTime ( )
inline

Returns the current CPU time in seconds.

Returns
The current CPU time in seconds.

◆ getDate()

std::string blaze::getDate ( )
inline

Creating a formated date string in the form YYYY-MM-DD.

Returns
Formated date string

◆ getTime()

std::string blaze::getTime ( )
inline

Creating a formated time and date string.

Returns
Formated time and date string in the format WEEKDAY DAY.MONTH YEAR, HOUR:MINUTES

◆ getWcTime()

double blaze::getWcTime ( )
inline

Returns the current wall clock time in seconds.

Returns
The current wall clock time in seconds.

◆ misalignment()

template<typename T >
BLAZE_ALWAYS_INLINE size_t blaze::misalignment ( const T *  address)

Computes the misalignment of the given address.

Parameters
addressThe address to be checked.
Returns
The number of bytes the given address is misaligned.

This function computes the misalignment of the given address with respect to the given data type Type and the available instruction set (SSE, AVX, ...). It returns the number of bytes the address is larger than the next smaller properly aligned address.

◆ numeric_cast()

template<typename To , typename From >
To blaze::numeric_cast ( From  from)
inline

Checked conversion of values of numeric type.

Parameters
fromThe numeric value to be converted.
Returns
The converted value.
Exceptions
std::overflow_errorInvalid numeric cast (overflow).
std::underflow_errorInvalid numeric cast (underflow).

This function converts the given numeric value from to the specified type To. In case a loss of range is detected, either a std::underflow_error or std::overflow_error exception is thrown.

Examples:

// Triggers a std::overflow_error exception
try {
const short b( blaze::numeric_cast<short>( a ) );
}
catch( std::overflow_error& ) {}
// Triggers a std::underflow_error exception
try {
const int a( -1 );
const unsigned int b( blaze::numeric_cast<unsigned int>( a ) );
}
catch( std::underflow_error& ) {}

◆ operator!=()

template<typename T1 , size_t N1, typename A1 , typename T2 , size_t N2, typename A2 >
bool blaze::operator!= ( const SmallArray< T1, N1, A1 > &  lhs,
const SmallArray< T2, N2, A2 > &  rhs 
)
inline

Inequality operator for the comparison of two dense arrays.

Parameters
lhsThe left-hand side small array for the comparison.
rhsThe right-hand side small array for the comparison.
Returns
true if the two arrays are not equal, false if they are equal.

◆ operator==()

template<typename T1 , size_t N1, typename A1 , typename T2 , size_t N2, typename A2 >
bool blaze::operator== ( const SmallArray< T1, N1, A1 > &  lhs,
const SmallArray< T2, N2, A2 > &  rhs 
)
inline

Equality operator for the comparison of two dense arrays.

Parameters
lhsThe left-hand side small array for the comparison.
rhsThe right-hand side small array for the comparison.
Returns
true if the two arrays are equal, false if not.

◆ reinterpret_pointer_cast() [1/2]

template<typename To , typename From >
To * blaze::reinterpret_pointer_cast ( From *  ptr)
inline

Reinterpret cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The reinterpret_pointer_cast function is used exactly as the built-in reinterpret_cast operator but for pointer types.

class A { ... };
unsigned char* raw = new unsigned char[ sizeof(A)*10 ]; // Allocation of raw memory
A* a = reinterpret_pointer_cast<A>( raw ); // Reinterpretation cast

◆ reinterpret_pointer_cast() [2/2]

template<typename To , template< typename > class S, typename From >
S< To > blaze::reinterpret_pointer_cast ( S< From >  ptr)
inline

Reinterpret cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The reinterpret_pointer_cast function is used exactly as the built-in reinterpret_cast operator but for smart pointers.

◆ static_pointer_cast() [1/2]

template<typename To , typename From >
To * blaze::static_pointer_cast ( From *  ptr)
inline

Static cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The static_pointer_cast function is used exactly as the built-in static_cast operator but for pointer types.

class B { ... };
class D : public B { ... };
B* b = new D(); // Base pointer to a derived class object
D* d = static_pointer_cast<D>( b ); // Static down-cast

◆ static_pointer_cast() [2/2]

template<typename To , template< typename > class S, typename From >
S< To > blaze::static_pointer_cast ( S< From >  ptr)
inline

Static cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The static_pointer_cast function is used exactly as the built-in static_cast operator but for smart pointers.

class B { ... };
class D : public B { ... };
using BPtr = SharedPtr<B>;
using DPtr = SharedPtr<D>;
BPtr b = BPtr( new D() ); // Base smart pointer to a derived class object
DPtr d = static_pointer_cast<D>( b ); // Static down-cast

◆ swap()

template<typename T , size_t N, typename A >
void blaze::swap ( SmallArray< T, N, A > &  a,
SmallArray< T, N, A > &  b 
)
inlinenoexcept

Swapping the contents of two small arrays.

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

This function swaps the contents of two small arrays. Please note that this function is only guaranteed to not throw an exception if the move constructor of the underlying data type T is guaranteed to be noexcept.

◆ UNUSED_PARAMETER()

template<typename... Args>
constexpr void blaze::UNUSED_PARAMETER ( const Args &  ...)
inline

Suppression of unused parameter warnings.

Returns
void

The UNUSED_PARAMETER function provides the functionality to suppress warnings about any number of unused parameters. Usually this problem occurs in case a parameter is given a name but is not used within the function:

void f( int x )
{} // x is not used within f. This may result in an unused parameter warning.

A possible solution is to keep the parameter unnamed:

void f( int )
{} // No warning about unused parameter is issued

However, there are situations where is approach is not possible, as for instance in case the variable must be documented via Doxygen. For these cases, the UNUSED_PARAMETER class can be used to suppress the warnings:

void f( int x )
{
UNUSED_PARAMETER( x ); // Suppresses the unused parameter warnings
}