From 3df751bcf194b82f1d9748c108e3679a3b67529d Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 10:30:11 -0400 Subject: [PATCH 1/6] move bubleify to devDependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cebe62..197179e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "array-bounds": "^1.0.1", "array-normalize": "^1.1.4", "binary-search-bounds": "^2.0.4", - "bubleify": "^2.0.0", "clamp": "^1.0.1", "defined": "^1.0.0", "dtype": "^2.0.0", @@ -55,6 +54,7 @@ }, "devDependencies": { "almost-equal": "^1.1.0", + "bubleify": "^2.0.0", "canvas-fit": "^1.5.0", "gauss-random": "^1.0.1", "math-float64-bits": "^1.0.1", From ed8e40a3890a0e8a9380087fb03555848e6edbc6 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 10:30:57 -0400 Subject: [PATCH 2/6] uninstall unused array-normalize module --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 197179e..f4fbfb1 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "license": "MIT", "dependencies": { "array-bounds": "^1.0.1", - "array-normalize": "^1.1.4", "binary-search-bounds": "^2.0.4", "clamp": "^1.0.1", "defined": "^1.0.0", From 22fc9e1c50c3b4e1a63459ce4c1b7f9e044b451a Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 10:32:00 -0400 Subject: [PATCH 3/6] uninstall unused regl module --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index f4fbfb1..801b5af 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "math-float64-bits": "^1.0.1", "math-float64-from-bits": "^1.0.0", "math-uint8-bits": "^1.0.0", - "regl": "^1.3.1", "snap-points-2d": "^3.2.0", "tape": "^4.8.0" } From 9447b9519bc3af7d84e6df9eda12746d8b4776d6 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 10:54:52 -0400 Subject: [PATCH 4/6] update module name and url --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 801b5af..5f1b86c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "point-cluster", + "name": "@plotly/point-cluster", "version": "3.1.8", "description": "Fast nd point clustering.", "main": "index.js", @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/dy/point-cluster.git" + "url": "git://github.com/plotly/point-cluster.git" }, "keywords": [ "snap-points-2d", From 0676c2ec073e31f72227382fcb22e28e26b7c13b Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 11:15:50 -0400 Subject: [PATCH 5/6] remove unused lines and dependency --- package.json | 1 - research.js | 45 +-------------------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/package.json b/package.json index 5f1b86c..e71977a 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "gauss-random": "^1.0.1", "math-float64-bits": "^1.0.1", "math-float64-from-bits": "^1.0.0", - "math-uint8-bits": "^1.0.0", "snap-points-2d": "^3.2.0", "tape": "^4.8.0" } diff --git a/research.js b/research.js index c3d8454..881cf46 100644 --- a/research.js +++ b/research.js @@ -2,16 +2,14 @@ const t = require('tape'); -const cluster = require('./'); const random = require('gauss-random') const bitsf64 = require('math-float64-from-bits') -const ui8bits = require('math-uint8-bits') const f64bits = require('math-float64-bits') t('packing 1e6 array', t => { let y = new Float64Array(1e6) - let x = new Float64Array(1e6) + console.time(1) y.subarray(0e5, 1e5) y.subarray(1e5, 2e5) @@ -31,9 +29,6 @@ t('float64 packing', t => { // uint8 (level) + uint32 (id) + float32→normalized uint16 (x) let f64 = new Float64Array(1) - let view = new DataView(f64.buffer) - let ui8 = new Uint8Array(f64.buffer) - let ui16 = new Uint16Array(f64.buffer) let ui32 = new Uint32Array(f64.buffer) // view.setUint8(7, parseInt('10000000', 2)) @@ -122,41 +117,3 @@ function data(N=1e6, f) { return points } - - - -/* -// use x-sort if required -if (options.sort) { -// pack levels: uint8, x-coord: uint16 and id: uint32 to float64 -let packed = new Float64Array(n) -let packedInt = new Uint32Array(packed.buffer) -for (let i = 0; i < n; i++) { - packedInt[i * 2] = i - packedInt[i * 2 + 1] = (0x3ff00000 & (levels[i] << 20) | 0x0000ffff & ((1 - points[i * 2]) * 0xffff)) -} - -// do native sort -packed.sort() - -// unpack data back -let sortedLevels = new Uint8Array(n) -let sortedWeights = new Uint32Array(n) -let sortedIds = new Uint32Array(n) -let sortedPoints = new Float64Array(n * 2) -for (let i = 0; i < n; i++) { - let id = packedInt[(n - i - 1) * 2] - sortedLevels[i] = levels[id] - sortedWeights[i] = weights[id] - sortedIds[i] = ids[id] - sortedPoints[i * 2] = points[id * 2] - sortedPoints[i * 2 + 1] = points[id * 2 + 1] -} - -ids = sortedIds -levels = sortedLevels -points = sortedPoints -weights = sortedWeights -} - -*/ From 03b1c956bdda78a7a056806fe24db70cbdde7648 Mon Sep 17 00:00:00 2001 From: archmoj Date: Mon, 17 Aug 2020 11:18:14 -0400 Subject: [PATCH 6/6] uninstall math-float64-from-bits until https://npmjs.com/advisories/1213 could be resolved in nested deps --- package.json | 1 - research.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e71977a..f75c2dc 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "bubleify": "^2.0.0", "canvas-fit": "^1.5.0", "gauss-random": "^1.0.1", - "math-float64-bits": "^1.0.1", "math-float64-from-bits": "^1.0.0", "snap-points-2d": "^3.2.0", "tape": "^4.8.0" diff --git a/research.js b/research.js index 881cf46..bf88616 100644 --- a/research.js +++ b/research.js @@ -4,7 +4,7 @@ const t = require('tape'); const random = require('gauss-random') const bitsf64 = require('math-float64-from-bits') -const f64bits = require('math-float64-bits') +// const f64bits = require('math-float64-bits') t('packing 1e6 array', t => { @@ -36,7 +36,7 @@ t('float64 packing', t => { // ui8[7] = 0xff // ui16[2] = 0x1000 ui32[1] = 0x00ff0000 & 0x01 << 16 | 0x0000ffff & 0xffff - console.log(f64[0], f64bits(f64[0])) + console.log(f64[0] /* , f64bits(f64[0]) */) let sign = '0' // ignore sign let exp = '00000000000' // write levels as exponent