getOptimBlockSize
C++ Function Reference
1 Signature
size_t BigDataStatMeth::getOptimBlockSize(size_t fullSize, size_t blockSize, size_t iDesp, size_t currentSize)2 Description
Optimizes block size for edge cases.
3 Parameters
fullSize(size_t): Total size of dimensionblockSize(size_t): Current block sizeiDesp(size_t): Current displacementcurrentSize(size_t): Current size being processed
4 Returns
size_t Optimized block size
5 Details
fullSizeTotal size of dimension blockSizeCurrent block size iDespCurrent displacement currentSizeCurrent size being processed size_t Optimized block size Optimization strategy:Handles last block to avoid single element operationsAdjusts for matrix boundariesPrevents overflowOptimizes for performance
6 Caller Graph
7 Source Code
NoteImplementation
File: inst/include/Utilities/Utilities.hpp • Lines 299-317
inline size_t getOptimBlockSize( size_t fullSize, size_t blockSize, size_t iDesp, size_t currentSize )
{
try
{
if( iDesp + blockSize == fullSize - 1) {
currentSize = blockSize + 1;
} else if( iDesp + blockSize > fullSize ) {
currentSize = fullSize - iDesp;
} else {
currentSize = blockSize;
}
} catch(std::exception& ex) {
Rcpp::Rcout<< "c++ exception getOptimBlockSize: "<<ex.what()<< " \n";
}
return(currentSize);
}8 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = getOptimBlockSize(...);