Basics of the C++ implementation

Back to TIM Core implementation

Integers and reals

The Pastel library defines the type aliases integer and real to work as abstractions for the corresponding mathematical concepts. In TIM, instead of making the underlying computation type a template parameter, we have chosen to use the real type throughout. We believe this simplifies the library while not making it substantially less generic. The real type can be chosen library-wide a float, a double, or a long double based on the desired configuration. For the precompiled software we used the double type. The integer type is an alias for the int type.

Iterators and iterator ranges

TIM uses iterator ranges to abstract away the differences between different kinds of containers, as well as to make up for an efficient implementation. An iterator range is essentially a triple (b, e, d) where b and e form an iterator range [b, e[ and d is the distance between e and b. Apart from making the interface of functions compact, iterator ranges also offer a form of concept-based overloading, compared to non-restricted templates when using only iterators. Whenever a template function parametrizes an iterator range, the types of the iterators are named in the form DereferencedType_Iterator. Here is an example function template declaration from TIM:

template <
    ranges::forward_range Signal_Range, 
    typename Real_OutputIterator>
integer temporalDifferentialEntropyKl(
    const Signal_Range& signalSet,
    integer timeWindowRadius,
    Real_OutputIterator result,
    integer kNearest = 1);

Iterator ranges do not always make sense for output. For example, if the output of the function is varying in number of writes, as with the above function, then no fixed-size iterator range does. Therefore, outputs are always specified with a single output iterator. Whenever a template function parametrizes an output iterator, the type is named in the form DereferencedType_OutputIterator.

You can read more about special iterators and iterator ranges from the Pastel library’s documentation.

Files

Dll-keywords for the TIM library

Type definitions for the TIM library

Simply imports the type definitions of the Pastel library