agg_make_blocks

C++ Function Reference

1 Signature

void BigDataStatMeth::agg_make_blocks(hsize_t dim, hsize_t block_size, std::vector< hsize_t > &starts, std::vector< hsize_t > &sizes)

2 Description

Compute block start positions and sizes for a single dimension.

3 Parameters

  • dim (hsize_t): Total size of the dimension to iterate.
  • block_size (hsize_t): Nominal block size (>= 1).
  • starts (std::vector< hsize_t > &): Output: start offsets.
  • sizes (std::vector< hsize_t > &): Output: block sizes (last may be smaller).

4 Details

Fills starts and sizes so that all blocks together cover [0, dim) exactly, with no off-by-one. The last block may be smaller than block_size if dim is not an exact multiple.

5 Caller Graph

Function dependencies

6 Source Code

File: inst/include/hdf5Algebra/matrixAggregations.hppLines 66-75

inline void agg_make_blocks(hsize_t dim,
                             hsize_t block_size,
                             std::vector<hsize_t>& starts,
                             std::vector<hsize_t>& sizes)
{
    for (hsize_t off = 0; off < dim; off += block_size) {
        starts.push_back(off);
        sizes.push_back(std::min(block_size, dim - off));
    }
}

7 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = agg_make_blocks(...);