This overview covers the different vector classes that are used in CSTK to represent sensor data and basic containers for various algorithms.
Every type of data processing needs a basic component to represent input, output, or intermediate data. Four basic types of vectors are available in CSTK, where each class satisfies special needs that an algorithm or an application might have. The typical requirements of code that is both flexible and high in performance, remain a priority.
The BinVector class is designed for binary data, such as the input from tilt switches, pressure switches, or light barriers. Containing only a bit per value, the memory usage is considerably less than a vector of boolean values. Typically a boolean type needs to be stored in one byte to represent one bit, while with the BinVector class the bits are grouped together in one byte. When the number of bits to store is not a multiple of eight, the last byte of the memory is only used in part.
The BinVector class is ideal when lots of binary sensors need to be processed and modelled in algorithms such as the Sparse Distributed Memory by Kanerva. The latest source for BinVector can be found in the CVS under cstk_base/vector, and an example is located in examples/cstk_base/vector.
BVector is a template class, where with each vector initialization the type of its elements can be specified. The BVector class is designed to contain one sensor's output data that is viewed over a certain time interval, which makes it suitable for storing a (sliding) window over a continuous input stream.
The BVector class contains various functions that process its time series, such as histograms, autocorrelation, and the basic statistics. The latest source for BVector can be found in the CVS under cstk_base/vector, and an example is located in examples/cstk_base/vector.
KVector is a vector architecture that contains unsigned eight bit values. It is specialized for embedded devices with low resources. The same could be realized with BVector and DVector, however BVector is a bit slower due to the template implementation and DVector would need more memory due to the pointer architecture.
The DVector architecture is the most flexible and generic one; It is designed for sensor readings of different types of sensors that do not need the same types of memory. Each element's type can be exclusively specified, which is made possible by a pointer architecture: The vector itself is implemented as an array of pointers, which point to the real memory locations that contain the data, and the data spaces' types hence can can be specified separatly for each element. Since this vector can provide a memory entry for a multi-sensor device at a specific point in time, it is the one that is used most often. Most algorithms described in the following sections are therefore using the DVector architecture for input and output.