NumberArray Class

The NumberArray class contains static methods that act on arrays of numbers.

Methods

Name Description
constructor(): NumberArray    
cloneWithStartAndEndMultiplicity(knots: undefined | number[], target0: number, target1: number): number[] Static Return a copy of the knots array, with multiplicity of first and last knots raised or lowered to expectedMultiplicity.  
copy2d(source: number[][]): number[][] Static Copy number[][].  
copy3d(source: number[][][]): number[][][] Static Copy number[][][].  
create(source: Float64Array | number[]): number[] Static Copy numbers from variant sources to number[].  
createArrayWithMaxStepSize(low: number, high: number, step: number): number[] Static Return an array with indicated start and end points, maximum step size internally  
isAlmostEqual(dataA: undefined | Float64Array | number[], dataB: undefined | Float64Array | number[], tolerance: number = Geometry.smallMetricDistance): boolean Static Return true if arrays have identical counts and entries equal within tolerance  
isCoordinateInArray(x: number, data: undefined | number[]): boolean Static test if coordinate x appears (to tolerance by Geometry.isSameCoordinate) in this array of numbers  
isExactEqual(dataA: undefined | any[] | Float64Array, dataB: undefined | any[] | Float64Array): boolean Static Return true if arrays have identical counts and equal entries (using !== comparison)  
linearCombination(data: number[], scales: number[]): number Static Compute the linear combination s of the numbers and scales.  
linearCombinationOfColors(colors: number[], scales: number[]): number Static Compute the linear combination s of the colors and scales.  
maxAbsArray(values: number[]): number Static Return the max absolute value in a array of numbers.  
maxAbsDiff(dataA: Float64Array | number[], dataB: Float64Array | number[]): number Static Return the max absolute difference between corresponding entries in two arrays of numbers  
maxAbsDiffFloat64(dataA: Float64Array, dataB: Float64Array): number Static Return the max absolute difference between corresponding entries in two Float64Array  
maxAbsTwo(a1: number, a2: number): number Static return the max absolute value of a pair of numbers  
pack(source: number[] | number[][] | number[][][]): Float64Array Static Copy numbers from 1d/2d/3d array to Float64Array.  
preciseSum(data: number[]): number Static return the sum of values in an array, The summation is done with correction terms which  
sum(data: Float64Array | number[]): number Static return the sum of numbers in an array.  
unpack2d(source: Float64Array, numPerBlock: number): undefined | number[][] Static Copy numbers from Float64Array to number[][].  
unpack3d(source: Float64Array, numPerRow: number, numPerBlock: number): undefined | number[][][] Static Copy numbers from Float64Array to number[][][].  

Defined in

Last Updated: 28 March, 2024