GrowableBlockedArray Class

Array of contiguous doubles, indexed by block number and index within block.

  • This is essentially a rectangular matrix (two dimensional array), with each block being a row of the matrix.

Methods

Name Description
constructor(blockSize: number, initialBlocks: number = 8, growthFactor?: number): GrowableBlockedArray Construct an array whose contents are in blocked (row-major) order, possibly with extra capacity.  
addBlock(newData: number[]): void Add a new block of data.  
blockCapacity(): number Return the capacity in blocks (not doubles)  
blockIndexToDoubleIndex(blockIndex: number): number Protected convert a block index to the simple index to the underlying Float64Array.  
checkedComponent(blockIndex: number, componentIndex: number): undefined | number Access a single double at offset within a block, with index checking and return undefined if indexing is invalid.  
clear(): void clear the block count to zero, but maintain the allocated memory  
clone(): GrowableBlockedArray Make a copy of the (active) blocks in this array.  
component(blockIndex: number, componentIndex: number): number Access a single double at offset within a block.  
copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): { count: number, offset: number } Protected Copy data from source array.  
distanceBetweenBlocks(blockIndexA: number, blockIndexB: number): number Return the distance (hypotenuse=sqrt(summed squares)) between indicated blocks  
distanceBetweenSubBlocks(blockIndexA: number, blockIndexB: number, iBegin: number, iEnd: number): number Return the distance (hypotenuse=sqrt(summed squares)) between block entries iBegin <= i < iEnd of indicated blocks  
ensureBlockCapacity(blockCapacity: number, applyGrowthFactor: boolean = true): void ensure capacity (in blocks, not doubles)  
getWithinBlock(blockIndex: number, indexWithinBlock: number): number Return a single value indexed within a block.  
newBlockIndex(): number Protected Return the starting index of a block of (zero-initialized) doubles at the end.  
popBlock(): void reduce the block count by one.  
sortIndicesLexical(compareBlocks: BlockComparisonFunction = ...): Uint32Array Return an array of block indices sorted per compareLexicalBlock function  
compareLexicalBlock(data: Float64Array, blockSize: number, ia: number, ib: number): number Static compare two blocks in simple lexical order.  

Properties

Name Type Description
_blockSize Protected number number of numbers per block in the array.  
_data Protected Float64Array underlying contiguous, oversized buffer.  
_growthFactor Protected number multiplier used by ensureBlockCapacity to expand requested reallocation size  
_inUse Protected number Number of blocks (matrix rows) in use.  
length Accessor ReadOnly number computed property: length (in blocks, not doubles)  
numBlocks Accessor ReadOnly number computed property: length (in blocks, not doubles)  
numPerBlock Accessor ReadOnly number property: number of data values per block  

Defined in

Last Updated: 15 March, 2024