Store the accumulators in a block-max array as originally used in IOQP.
More...
#include <accumulator_block_max.h>
|
|
template<typename ACCUMULATOR_TYPE > |
| static void | unittest_example (ACCUMULATOR_TYPE &instance) |
| | Unit test a single 2D accumulator instance making sure its correct.
|
| |
|
static void | unittest (void) |
| | Unit test this class.
|
| |
|
|
static constexpr size_t | maximum_number_of_blocks = NUMBER_OF_ACCUMULATORS |
| |
|
static constexpr size_t | maximum_number_of_accumulators_allocated = NUMBER_OF_ACCUMULATORS + NUMBER_OF_ACCUMULATORS / 2 |
| | The numner of accumulators that were actually allocated (so that the last block is a full block)
|
| |
|
|
template<typename A , size_t B, typename C > |
| class | accumulator_block_max |
| |
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
class JASS::accumulator_block_max< ELEMENT, NUMBER_OF_ACCUMULATORS, typename >
Store the accumulators in a block-max array as originally used in IOQP.
- Template Parameters
-
| ELEMENT | The type of accumulator being used (default is uint16_t) |
| NUMBER_OF_ACCUMULATORS | The maxium number of documents allowed in any index |
◆ add()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
add value to a given accumulator. i.e. accumulator[which] += value;
- Parameters
-
| which | [in] Which accumulator to add to |
| value | [in] The value to add |
◆ get_index()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
Given a pointer to an accumulator, return the acumulator index.
- Parameters
-
| return | a value such that get_index(&accumulator[x]) == x |
◆ init()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
| void JASS::accumulator_block_max< ELEMENT, NUMBER_OF_ACCUMULATORS, typename >::init |
( |
size_t |
number_of_accumulators, |
|
|
size_t |
preferred_width = 0 |
|
) |
| |
|
inline |
Initialise this object before first use.
- Parameters
-
| number_of_accumulators | [in] The numnber of elements in the array being managed. |
| preferred_width | [in] The preferred width of each block, where the actual width is 2^preferred_width (if possible) |
◆ operator[]()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
Return a reference to the given accumulator.
The only valid way to access the accumulators is through this interface. It ensures the accumulator has been initialised before the first time it is returned to the caller.
- Parameters
-
| which | [in] The accumulator to return. |
- Returns
- The accumulator.
◆ size()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
Return the number of accumulators in the array.
Return the number of accumulators in the array which may be fewer than have been allocated.
- Returns
- Size of the accumulator array.
◆ which_block()
template<typename ELEMENT, size_t NUMBER_OF_ACCUMULATORS, typename = typename std::enable_if<std::is_arithmetic<ELEMENT>::value, ELEMENT>::type>
Return the id of the block to use.
- Parameters
-
| element | [in] The accumulator number. |
- Returns
- The block number.
The documentation for this class was generated from the following file: