agg_block_size
C++ Function Reference
1 Signature
hsize_t BigDataStatMeth::agg_block_size(Rcpp::Nullable< int > wsize, hsize_t iterated, hsize_t fixed)2 Description
Choose a block size for aggregation.
3 Parameters
wsize(Rcpp::Nullable< int >): User-supplied block size (Nullable).iterated(hsize_t): Size of the dimension being blocked (must be > 0).fixed(hsize_t): Size of the dimension that is always read completely.
4 Returns
Block size in [1, iterated].
5 Details
If the user supplied wsize, it is used directly (clamped to [1, iterated]). Otherwise the block size is set so that one block occupies at most MAXELEMSINBLOCK elements (fixed_dim × block_size).
6 Caller Graph
7 Source Code
NoteImplementation
File: inst/include/hdf5Algebra/matrixAggregations.hpp • Lines 89-106
inline hsize_t agg_block_size(Rcpp::Nullable<int> wsize,
hsize_t iterated,
hsize_t fixed)
{
hsize_t bs;
if (wsize.isNotNull()) {
bs = static_cast<hsize_t>(std::max(1, Rcpp::as<int>(wsize)));
} else {
// Default: one block holds at most MAXELEMSINBLOCK elements
bs = (fixed > 0)
? std::max(static_cast<hsize_t>(1),
static_cast<hsize_t>(
std::ceil(static_cast<double>(MAXELEMSINBLOCK) / fixed)))
: iterated;
}
// Never exceed the actual dimension
return std::min(bs, iterated);
}8 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = agg_block_size(...);