|
tatami_stats
Matrix statistics for tatami
|
Local output buffers for running calculations. More...
#include <utils.hpp>
Public Member Functions | |
| template<typename Number_ , typename Index_ > | |
| LocalOutputBuffers (int thread, Number_ number, Index_ start, Index_ length, GetOutput_ outfun, Output_ fill) | |
| template<typename Number_ , typename Index_ > | |
| LocalOutputBuffers (int thread, Number_ number, Index_ start, Index_ length, GetOutput_ outfun) | |
| LocalOutputBuffers ()=default | |
| std::size_t | size () const |
| Output_ * | data (std::size_t i) |
| const Output_ * | data (std::size_t i) const |
| void | transfer () |
Local output buffers for running calculations.
Zero, one or more local output buffers to be created in each thread to avoid false sharing. This class is equivalent to a vector of LocalOutputBuffer instances, but is easier to initialize and more memory-efficient. In particular, no vector is created at all for the first thread, avoiding an unnecessary allocation in the serial case.
| Output_ | Type of the result. |
| GetOutput_ | Functor object that returns a pointer to the output buffer. |
|
inline |
| Number_ | Integer type of the number of buffers. |
| Index_ | Integer type of the start index and length. |
| thread | Identity of the thread, starting from zero to the total number of threads. |
| number | Number of output buffers. |
| start | Index of the first objective vector in the contiguous block for this thread. |
| length | Number of objective vectors in the contiguous block for this thread. |
| outfun | Function that accepts an std::size_t specifying the index of an output buffer in [0, number) and returns a Output_* pointer to that buffer. |
| fill | Initial value to fill the buffer. |
|
inline |
Overloaded constructor that sets the default fill = 0.
| Number_ | Integer type of the number of buffers. |
| Index_ | Integer type of the start index and length. |
| thread | Identity of the thread, starting from zero to the total number of threads. |
| number | Number of output buffers. |
| start | Index of the first objective vector in the contiguous block for this thread. |
| length | Number of objective vectors in the contiguous block for this thread. |
| outfun | Function that accepts an Index_ specifying the index of an output buffer in [0, number) and returns a Output_* pointer to that buffer. |
|
default |
Default constructor.
|
inline |
number in the constructor.
|
inline |
| i | Index of the output buffer. |
i-th output buffer to use in this thread. This contains at least length addressable elements (see the argument of the same name in the constructor). For thread = 0, this will be equal to outfun(i) + start.
|
inline |
| i | Index of the output buffer. |
i-th output buffer to use for this thread. This contains at least length addressable elements (see the argument of the same name in the constructor). For thread = 0, this will be equal to outfun(i) + start.
|
inline |
Transfer results from the local buffer to the global buffer (i.e., outfun(i) for i in [0, number) from the constructor). For thread = 0, this will be a no-op.