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): GrowableBlockedArray    
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  
component(blockIndex: number, componentIndex: number): number Access a single double at offset within a block.  
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): 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 = GrowableBlockedArray.compareLexicalBlock): 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.  
_inUse Protected number Number of blocks (matrix rows) in use.  
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: 11 June, 2024