@danielsimonjr/mathts-parallel 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ComputePool.d.ts +58 -38
- package/dist/ComputePool.d.ts.map +1 -1
- package/dist/WorkerPool.d.ts +15 -1
- package/dist/WorkerPool.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +238 -150
- package/dist/operations/map.d.ts.map +1 -1
- package/dist/ops/bitwise.d.ts.map +1 -1
- package/dist/validate.d.ts +20 -0
- package/dist/validate.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/ComputePool.d.ts
CHANGED
|
@@ -92,6 +92,21 @@ export declare const DEFAULT_THRESHOLD_BY_OP: Partial<Record<OpName, OpThreshold
|
|
|
92
92
|
* Default ComputePool configuration
|
|
93
93
|
*/
|
|
94
94
|
export declare const DEFAULT_POOL_CONFIG: ComputePoolConfig;
|
|
95
|
+
/**
|
|
96
|
+
* Per-call dispatch override accepted by the `ComputePool` operations.
|
|
97
|
+
*
|
|
98
|
+
* - `forceSequential` computes inline whatever the size or threshold.
|
|
99
|
+
* - `forceParallel` skips the threshold checks and dispatches to the workers. It still needs
|
|
100
|
+
* a ready pool: on a pool that was not initialized (or is disabled) the call runs inline.
|
|
101
|
+
*
|
|
102
|
+
* `forceSequential` wins when both are set.
|
|
103
|
+
*/
|
|
104
|
+
export interface DispatchOptions {
|
|
105
|
+
/** Force parallel execution regardless of threshold */
|
|
106
|
+
forceParallel?: boolean;
|
|
107
|
+
/** Force sequential execution regardless of threshold */
|
|
108
|
+
forceSequential?: boolean;
|
|
109
|
+
}
|
|
95
110
|
/**
|
|
96
111
|
* Result of a parallel operation
|
|
97
112
|
*/
|
|
@@ -147,7 +162,7 @@ export declare class ComputePool {
|
|
|
147
162
|
* is used. When `op` is omitted the global threshold is always used (for
|
|
148
163
|
* backward-compatibility with existing callers that don't know the op name).
|
|
149
164
|
*/
|
|
150
|
-
shouldParallelize(elementCount: number, op?: OpName): boolean;
|
|
165
|
+
shouldParallelize(elementCount: number, op?: OpName, force?: DispatchOptions): boolean;
|
|
151
166
|
/**
|
|
152
167
|
* Wrap a sequentially-computed reduction result in the `ParallelResult`
|
|
153
168
|
* envelope. Used by the reduction methods below so that ops whose threshold
|
|
@@ -183,15 +198,15 @@ export declare class ComputePool {
|
|
|
183
198
|
/**
|
|
184
199
|
* Parallel sum of array elements
|
|
185
200
|
*/
|
|
186
|
-
sum(data: Float64Array): Promise<ParallelResult<number>>;
|
|
201
|
+
sum(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
187
202
|
/**
|
|
188
203
|
* Parallel product of array elements
|
|
189
204
|
*/
|
|
190
|
-
prod(data: Float64Array): Promise<ParallelResult<number>>;
|
|
205
|
+
prod(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
191
206
|
/**
|
|
192
207
|
* Parallel dot product
|
|
193
208
|
*/
|
|
194
|
-
dot(a: Float64Array, b: Float64Array): Promise<ParallelResult<number>>;
|
|
209
|
+
dot(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
195
210
|
/**
|
|
196
211
|
* Pool options that apply `op`'s `thresholdByOp` entry to a call the pool decides itself.
|
|
197
212
|
*
|
|
@@ -202,14 +217,19 @@ export declare class ComputePool {
|
|
|
202
217
|
* `shouldParallelize` requires a ready pool, so `forceParallel` never reaches an idle one.
|
|
203
218
|
*/
|
|
204
219
|
private poolOptions;
|
|
220
|
+
/**
|
|
221
|
+
* Task options that carry only the caller's force flags, for methods that already gated
|
|
222
|
+
* in `ComputePool` (the pool then makes the same decision) or that have no per-op threshold.
|
|
223
|
+
*/
|
|
224
|
+
private forceTask;
|
|
205
225
|
/**
|
|
206
226
|
* Parallel element-wise operation
|
|
207
227
|
*/
|
|
208
|
-
elementwise(a: Float64Array, b: Float64Array, op: 'add' | 'subtract' | 'multiply' | 'divide'): Promise<ParallelResult<Float64Array>>;
|
|
228
|
+
elementwise(a: Float64Array, b: Float64Array, op: 'add' | 'subtract' | 'multiply' | 'divide', force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
209
229
|
/**
|
|
210
230
|
* Parallel scale operation
|
|
211
231
|
*/
|
|
212
|
-
scale(data: Float64Array, scalar: number): Promise<ParallelResult<Float64Array>>;
|
|
232
|
+
scale(data: Float64Array, scalar: number, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
213
233
|
/**
|
|
214
234
|
* Parallel matrix multiplication
|
|
215
235
|
*
|
|
@@ -219,27 +239,27 @@ export declare class ComputePool {
|
|
|
219
239
|
* @param b - Second matrix as flat Float64Array (row-major)
|
|
220
240
|
* @param bCols - Number of columns in B
|
|
221
241
|
*/
|
|
222
|
-
matmul(a: Float64Array, aRows: number, aCols: number, b: Float64Array, bCols: number): Promise<ParallelResult<Float64Array>>;
|
|
242
|
+
matmul(a: Float64Array, aRows: number, aCols: number, b: Float64Array, bCols: number, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
223
243
|
/**
|
|
224
244
|
* Parallel matrix transpose
|
|
225
245
|
*/
|
|
226
|
-
transpose(data: Float64Array, rows: number, cols: number): Promise<ParallelResult<Float64Array>>;
|
|
246
|
+
transpose(data: Float64Array, rows: number, cols: number, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
227
247
|
/**
|
|
228
248
|
* Parallel map operation
|
|
229
249
|
*/
|
|
230
|
-
map<T, R>(data: T[], fn: (item: T) => R): Promise<ParallelResult<R[]>>;
|
|
250
|
+
map<T, R>(data: T[], fn: (item: T) => R, force?: DispatchOptions): Promise<ParallelResult<R[]>>;
|
|
231
251
|
/**
|
|
232
252
|
* Parallel reduce operation
|
|
233
253
|
*/
|
|
234
|
-
reduce<T, R>(data: T[], fn: (acc: R, item: T) => R, initial: R): Promise<ParallelResult<R>>;
|
|
254
|
+
reduce<T, R>(data: T[], fn: (acc: R, item: T) => R, initial: R, force?: DispatchOptions): Promise<ParallelResult<R>>;
|
|
235
255
|
/**
|
|
236
256
|
* Parallel filter operation
|
|
237
257
|
*/
|
|
238
|
-
filter<T>(data: T[], predicate: (item: T) => boolean): Promise<ParallelResult<T[]>>;
|
|
258
|
+
filter<T>(data: T[], predicate: (item: T) => boolean, force?: DispatchOptions): Promise<ParallelResult<T[]>>;
|
|
239
259
|
/**
|
|
240
260
|
* Find min and max values in parallel
|
|
241
261
|
*/
|
|
242
|
-
minMax(data: Float64Array): Promise<ParallelResult<{
|
|
262
|
+
minMax(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<{
|
|
243
263
|
min: number;
|
|
244
264
|
max: number;
|
|
245
265
|
minIdx: number;
|
|
@@ -248,7 +268,7 @@ export declare class ComputePool {
|
|
|
248
268
|
/**
|
|
249
269
|
* Compute variance, mean, and standard deviation in parallel
|
|
250
270
|
*/
|
|
251
|
-
variance(data: Float64Array): Promise<ParallelResult<{
|
|
271
|
+
variance(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<{
|
|
252
272
|
mean: number;
|
|
253
273
|
variance: number;
|
|
254
274
|
std: number;
|
|
@@ -256,19 +276,19 @@ export declare class ComputePool {
|
|
|
256
276
|
/**
|
|
257
277
|
* Compute norm (Euclidean length) in parallel
|
|
258
278
|
*/
|
|
259
|
-
norm(data: Float64Array): Promise<ParallelResult<number>>;
|
|
279
|
+
norm(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
260
280
|
/**
|
|
261
281
|
* Compute Euclidean distance in parallel
|
|
262
282
|
*/
|
|
263
|
-
distance(a: Float64Array, b: Float64Array): Promise<ParallelResult<number>>;
|
|
283
|
+
distance(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
264
284
|
/**
|
|
265
285
|
* Compute histogram in parallel
|
|
266
286
|
*/
|
|
267
|
-
histogram(data: Float64Array, bins: number, min?: number, max?: number): Promise<ParallelResult<number[]>>;
|
|
287
|
+
histogram(data: Float64Array, bins: number, min?: number, max?: number, force?: DispatchOptions): Promise<ParallelResult<number[]>>;
|
|
268
288
|
/**
|
|
269
289
|
* Apply unary function in parallel
|
|
270
290
|
*/
|
|
271
|
-
unary(data: Float64Array, fn: 'abs' | 'sqrt' | 'exp' | 'log' | 'sin' | 'cos' | 'tan' | 'negate' | 'square'): Promise<ParallelResult<Float64Array>>;
|
|
291
|
+
unary(data: Float64Array, fn: 'abs' | 'sqrt' | 'exp' | 'log' | 'sin' | 'cos' | 'tan' | 'negate' | 'square', force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
272
292
|
/**
|
|
273
293
|
* Apply a caller-supplied unary numeric function in parallel.
|
|
274
294
|
*
|
|
@@ -366,51 +386,51 @@ export declare class ComputePool {
|
|
|
366
386
|
/**
|
|
367
387
|
* Parallel absolute value
|
|
368
388
|
*/
|
|
369
|
-
abs(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
389
|
+
abs(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
370
390
|
/**
|
|
371
391
|
* Parallel square root
|
|
372
392
|
*/
|
|
373
|
-
sqrt(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
393
|
+
sqrt(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
374
394
|
/**
|
|
375
395
|
* Parallel exponential
|
|
376
396
|
*/
|
|
377
|
-
exp(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
397
|
+
exp(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
378
398
|
/**
|
|
379
399
|
* Parallel natural log
|
|
380
400
|
*/
|
|
381
|
-
log(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
401
|
+
log(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
382
402
|
/**
|
|
383
403
|
* Parallel sine
|
|
384
404
|
*/
|
|
385
|
-
sin(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
405
|
+
sin(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
386
406
|
/**
|
|
387
407
|
* Parallel cosine
|
|
388
408
|
*/
|
|
389
|
-
cos(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
409
|
+
cos(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
390
410
|
/**
|
|
391
411
|
* Parallel tangent
|
|
392
412
|
*/
|
|
393
|
-
tan(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
413
|
+
tan(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
394
414
|
/**
|
|
395
415
|
* Parallel negation
|
|
396
416
|
*/
|
|
397
|
-
negate(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
417
|
+
negate(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
398
418
|
/**
|
|
399
419
|
* Parallel square
|
|
400
420
|
*/
|
|
401
|
-
square(data: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
421
|
+
square(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
402
422
|
/**
|
|
403
423
|
* Parallel matrix-vector multiplication
|
|
404
424
|
*/
|
|
405
|
-
matvec(matrix: Float64Array, rows: number, cols: number, vector: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
425
|
+
matvec(matrix: Float64Array, rows: number, cols: number, vector: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
406
426
|
/**
|
|
407
427
|
* Parallel outer product
|
|
408
428
|
*/
|
|
409
|
-
outer(a: Float64Array, b: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
429
|
+
outer(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
410
430
|
/**
|
|
411
431
|
* Parallel find operation
|
|
412
432
|
*/
|
|
413
|
-
find<T>(data: T[], predicate: (item: T) => boolean): Promise<ParallelResult<{
|
|
433
|
+
find<T>(data: T[], predicate: (item: T) => boolean, force?: DispatchOptions): Promise<ParallelResult<{
|
|
414
434
|
found: boolean;
|
|
415
435
|
value?: T;
|
|
416
436
|
index?: number;
|
|
@@ -418,23 +438,23 @@ export declare class ComputePool {
|
|
|
418
438
|
/**
|
|
419
439
|
* Parallel sort operation
|
|
420
440
|
*/
|
|
421
|
-
sort<T>(data: T[], compare?: (a: T, b: T) => number): Promise<ParallelResult<T[]>>;
|
|
441
|
+
sort<T>(data: T[], compare?: (a: T, b: T) => number, force?: DispatchOptions): Promise<ParallelResult<T[]>>;
|
|
422
442
|
/**
|
|
423
443
|
* Parallel addition of two arrays
|
|
424
444
|
*/
|
|
425
|
-
add(a: Float64Array, b: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
445
|
+
add(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
426
446
|
/**
|
|
427
447
|
* Parallel subtraction of two arrays
|
|
428
448
|
*/
|
|
429
|
-
subtract(a: Float64Array, b: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
449
|
+
subtract(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
430
450
|
/**
|
|
431
451
|
* Parallel element-wise multiplication
|
|
432
452
|
*/
|
|
433
|
-
multiply(a: Float64Array, b: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
453
|
+
multiply(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
434
454
|
/**
|
|
435
455
|
* Parallel element-wise division
|
|
436
456
|
*/
|
|
437
|
-
divide(a: Float64Array, b: Float64Array): Promise<ParallelResult<Float64Array>>;
|
|
457
|
+
divide(a: Float64Array, b: Float64Array, force?: DispatchOptions): Promise<ParallelResult<Float64Array>>;
|
|
438
458
|
/**
|
|
439
459
|
* Parallel element-wise exponentiation.
|
|
440
460
|
*
|
|
@@ -481,19 +501,19 @@ export declare class ComputePool {
|
|
|
481
501
|
/**
|
|
482
502
|
* Compute mean in parallel (uses variance internally)
|
|
483
503
|
*/
|
|
484
|
-
mean(data: Float64Array): Promise<ParallelResult<number>>;
|
|
504
|
+
mean(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
485
505
|
/**
|
|
486
506
|
* Compute standard deviation in parallel
|
|
487
507
|
*/
|
|
488
|
-
std(data: Float64Array): Promise<ParallelResult<number>>;
|
|
508
|
+
std(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
489
509
|
/**
|
|
490
510
|
* Find minimum value in parallel
|
|
491
511
|
*/
|
|
492
|
-
min(data: Float64Array): Promise<ParallelResult<number>>;
|
|
512
|
+
min(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
493
513
|
/**
|
|
494
514
|
* Find maximum value in parallel
|
|
495
515
|
*/
|
|
496
|
-
max(data: Float64Array): Promise<ParallelResult<number>>;
|
|
516
|
+
max(data: Float64Array, force?: DispatchOptions): Promise<ParallelResult<number>>;
|
|
497
517
|
/**
|
|
498
518
|
* Element-wise bitwise AND on two `Int32Array`s.
|
|
499
519
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComputePool.d.ts","sourceRoot":"","sources":["../src/ComputePool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,EACL,cAAc,EACd,QAAQ,EAIR,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,kCAAkC,CAAC;AAY1C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,GAEd,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,GACR,KAAK,GACL,OAAO,GACP,KAAK,GACL,QAAQ,GACR,MAAM,GACN,QAAQ,GAER,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,iBAAiB,GACjB,eAAe,GAC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
9
|
* module Web Workers otherwise. When the caller gives no worker count, the
|
|
10
10
|
* count is `navigator.hardwareConcurrency - 1` (minimum 2), or 4 when that
|
|
11
|
-
* value is not available. A worker error rejects
|
|
11
|
+
* value is not available. A worker error rejects only the tasks that worker was
|
|
12
|
+
* running; the crashed worker is terminated, evicted and replaced so the pool keeps
|
|
13
|
+
* its capacity, and the other workers are untouched.
|
|
12
14
|
* `terminate` rejects all queued and active tasks and stops all workers.
|
|
13
15
|
*/
|
|
14
16
|
export declare class WorkerPool {
|
|
@@ -20,12 +22,24 @@ export declare class WorkerPool {
|
|
|
20
22
|
private workerScript;
|
|
21
23
|
private isNode;
|
|
22
24
|
private terminated;
|
|
25
|
+
/** Workers that have delivered at least one message (so their script loads). */
|
|
26
|
+
private readyWorkers;
|
|
27
|
+
/** Consecutive crashes of workers that never became ready. */
|
|
28
|
+
private startupFailures;
|
|
23
29
|
constructor(workerScript: string, maxWorkers?: number);
|
|
24
30
|
private getOptimalWorkerCount;
|
|
25
31
|
private initialize;
|
|
32
|
+
/** `worker_threads`, imported once per pool and shared by every concurrent spawn. */
|
|
33
|
+
private workerThreadsModule?;
|
|
34
|
+
private nodeWorkerThreads;
|
|
26
35
|
protected createWorker(): Promise<Worker>;
|
|
27
36
|
private handleWorkerMessage;
|
|
28
37
|
private handleWorkerError;
|
|
38
|
+
/** Consecutive never-ready worker crashes tolerated before the pool stops respawning. */
|
|
39
|
+
static readonly MAX_STARTUP_FAILURES = 3;
|
|
40
|
+
private isBusy;
|
|
41
|
+
/** Terminate a crashed worker, drop it from the roster and spawn a replacement. */
|
|
42
|
+
private evictAndReplace;
|
|
29
43
|
private processQueue;
|
|
30
44
|
private executeTask;
|
|
31
45
|
/**
|
package/dist/WorkerPool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerPool.d.ts","sourceRoot":"","sources":["../src/WorkerPool.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"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IAAI,CAAC,CAsBtC;IAED,OAAO,CAAC,cAAc;IAOtB,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,eAAe,IAAI,MAAM,CAEnC;IAED,IAAW,WAAW,IAAI,MAAM,CAE/B;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { ComputePool, computePool, Transfer, DEFAULT_POOL_CONFIG, DEFAULT_THRESHOLD_BY_OP, resolveOpThreshold, } from './ComputePool.js';
|
|
10
10
|
export { WorkerPool } from './WorkerPool.js';
|
|
11
|
-
export type { ComputePoolConfig, ParallelResult, OpName, OpThreshold } from './ComputePool.js';
|
|
11
|
+
export type { ComputePoolConfig, ParallelResult, OpName, OpThreshold, DispatchOptions, } from './ComputePool.js';
|
|
12
12
|
export { parallelMatmul, parallelMatvec, parallelTranspose, parallelOuter, parallelDot, parallelAdd, parallelSubtract, parallelMultiply, parallelDivide, parallelScale, parallelAbs, parallelNegate, parallelSquare, parallelSqrt, parallelExp, parallelLog, parallelSin, parallelCos, parallelTan, parallelElementwise, parallelUnary, parallelSum, parallelMean, parallelMin, parallelMax, parallelMinMax, parallelVariance, parallelStd, parallelNorm, parallelDistance, parallelHistogram, parallelReduce, parallelMap, parallelFilter, parallelFind, parallelSort, parallelForEach, parallelSome, parallelEvery, parallelCount, } from './operations/index.js';
|
|
13
13
|
export type { MatmulOptions, ElementwiseOptions, ReduceOptions, MapOptions, } from './operations/index.js';
|
|
14
14
|
export { bitAnd, bitOr, bitXor, bitNot, leftShift, rightArithShift, rightLogShift, } from './ops/bitwise.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAEL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EAGX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,aAAa,EAGb,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EAGd,WAAW,EACX,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,UAAU,GACX,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMxD,OAAO,EAEL,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,WAAW,EAGX,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAU/B,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { norm2, pairwiseDot, pairwiseSum, scaledDistance, sumSquaredDeviations } from "@danielsimonjr/mathts-core";
|
|
2
2
|
import { MathWorkerPool, Transfer, tensordotRange } from "@danielsimonjr/mathts-workerpool";
|
|
3
|
+
//#region src/validate.ts
|
|
4
|
+
function assertSameLength(op, a, b) {
|
|
5
|
+
if (a !== b) throw new Error(`${op}: lengths must match (${a} vs ${b})`);
|
|
6
|
+
}
|
|
7
|
+
function assertMatmulShape(op, aLength, aRows, aCols, bLength, bRows, bCols) {
|
|
8
|
+
if (aCols !== bRows) throw new Error(`${op}: inner dimensions must match (aCols ${aCols} vs bRows ${bRows})`);
|
|
9
|
+
if (aLength !== aRows * aCols) throw new Error(`${op}: a has ${aLength} elements, expected ${aRows}x${aCols}`);
|
|
10
|
+
if (bLength !== bRows * bCols) throw new Error(`${op}: b has ${bLength} elements, expected ${bRows}x${bCols}`);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
3
13
|
//#region src/strategies/chunk.ts
|
|
4
14
|
const DEFAULT_CHUNK_OPTIONS = {
|
|
5
15
|
minChunkSize: 1e3,
|
|
@@ -168,7 +178,7 @@ function applyBinaryChunk(a, b, out, start, length, outStart, op) {
|
|
|
168
178
|
}
|
|
169
179
|
}
|
|
170
180
|
function runBinary(a, b, op, options = {}) {
|
|
171
|
-
|
|
181
|
+
assertSameLength(op, a.length, b.length);
|
|
172
182
|
const out = new Int32Array(a.length);
|
|
173
183
|
if (a.length === 0) return out;
|
|
174
184
|
const numChunks = Math.max(1, calculateOptimalChunks(a.length, options));
|
|
@@ -336,6 +346,9 @@ function mergeThresholds(base, override) {
|
|
|
336
346
|
...override
|
|
337
347
|
};
|
|
338
348
|
}
|
|
349
|
+
function exactBuffer(x) {
|
|
350
|
+
return (x.byteOffset === 0 && x.buffer.byteLength === x.byteLength ? x : x.slice()).buffer;
|
|
351
|
+
}
|
|
339
352
|
function toParallelResult(result) {
|
|
340
353
|
return {
|
|
341
354
|
result: result.result,
|
|
@@ -373,7 +386,9 @@ var ComputePool = class {
|
|
|
373
386
|
isReady() {
|
|
374
387
|
return this.workerPool.isReady();
|
|
375
388
|
}
|
|
376
|
-
shouldParallelize(elementCount, op) {
|
|
389
|
+
shouldParallelize(elementCount, op, force) {
|
|
390
|
+
if (force?.forceSequential) return false;
|
|
391
|
+
if (force?.forceParallel) return this.config.enabled && this.workerPool.isReady();
|
|
377
392
|
const byOp = this.config.thresholdByOp;
|
|
378
393
|
if (op !== void 0 && byOp !== void 0 && op in byOp) {
|
|
379
394
|
const raw = byOp[op];
|
|
@@ -393,14 +408,12 @@ var ComputePool = class {
|
|
|
393
408
|
};
|
|
394
409
|
}
|
|
395
410
|
async gatedBinary(a, b, options) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return this.seqResult(options.sequential(a, b));
|
|
399
|
-
}
|
|
411
|
+
assertSameLength(options.op, a.length, b.length);
|
|
412
|
+
if (!this.shouldParallelize(a.length, options.op, options.force)) return this.seqResult(options.sequential(a, b));
|
|
400
413
|
return toParallelResult(await options.worker(a, b));
|
|
401
414
|
}
|
|
402
415
|
async bitwiseBinary(a, b, options) {
|
|
403
|
-
|
|
416
|
+
assertSameLength(options.op, a.length, b.length);
|
|
404
417
|
if (this.shouldParallelize(a.length, options.op)) return toParallelResult(await this.workerPool.bitwiseBinary(a, b, options.op));
|
|
405
418
|
const start = performance.now();
|
|
406
419
|
return {
|
|
@@ -411,7 +424,7 @@ var ComputePool = class {
|
|
|
411
424
|
};
|
|
412
425
|
}
|
|
413
426
|
async bitwiseShift(a, b, options) {
|
|
414
|
-
if (typeof b !== "number"
|
|
427
|
+
if (typeof b !== "number") assertSameLength(options.op, a.length, b.length);
|
|
415
428
|
if (this.shouldParallelize(a.length, options.op)) return toParallelResult(typeof b === "number" ? await this.workerPool.bitwiseScalar(a, b, options.op) : await this.workerPool.bitwiseBinary(a, b, options.op));
|
|
416
429
|
const start = performance.now();
|
|
417
430
|
return {
|
|
@@ -427,57 +440,64 @@ var ComputePool = class {
|
|
|
427
440
|
stats() {
|
|
428
441
|
return this.workerPool.stats();
|
|
429
442
|
}
|
|
430
|
-
async sum(data) {
|
|
431
|
-
if (!this.shouldParallelize(data.length, "sum")) return this.seqResult(pairwiseSum(data));
|
|
432
|
-
return toParallelResult(await this.workerPool.sum(data));
|
|
443
|
+
async sum(data, force) {
|
|
444
|
+
if (!this.shouldParallelize(data.length, "sum", force)) return this.seqResult(pairwiseSum(data));
|
|
445
|
+
return toParallelResult(await this.workerPool.sum(data, this.forceTask(force)));
|
|
433
446
|
}
|
|
434
|
-
async prod(data) {
|
|
435
|
-
if (!this.shouldParallelize(data.length, "prod")) {
|
|
447
|
+
async prod(data, force) {
|
|
448
|
+
if (!this.shouldParallelize(data.length, "prod", force)) {
|
|
436
449
|
let p = 1;
|
|
437
450
|
for (let i = 0; i < data.length; i++) p *= data[i];
|
|
438
451
|
return this.seqResult(p);
|
|
439
452
|
}
|
|
440
|
-
return toParallelResult(await this.workerPool.prod(data));
|
|
453
|
+
return toParallelResult(await this.workerPool.prod(data, this.forceTask(force)));
|
|
441
454
|
}
|
|
442
|
-
async dot(a, b) {
|
|
455
|
+
async dot(a, b, force) {
|
|
443
456
|
return this.gatedBinary(a, b, {
|
|
444
457
|
op: "dot",
|
|
458
|
+
force,
|
|
445
459
|
sequential: pairwiseDot,
|
|
446
|
-
worker: (x, y) => this.workerPool.dot(x, y)
|
|
460
|
+
worker: (x, y) => this.workerPool.dot(x, y, this.forceTask(force))
|
|
447
461
|
});
|
|
448
462
|
}
|
|
449
|
-
poolOptions(elementCount, op) {
|
|
450
|
-
return this.shouldParallelize(elementCount, op) ? { forceParallel: true } : { forceSequential: true };
|
|
463
|
+
poolOptions(elementCount, op, force) {
|
|
464
|
+
return this.shouldParallelize(elementCount, op, force) ? { forceParallel: true } : { forceSequential: true };
|
|
465
|
+
}
|
|
466
|
+
forceTask(force) {
|
|
467
|
+
if (force === void 0) return void 0;
|
|
468
|
+
if (force.forceSequential) return { forceSequential: true };
|
|
469
|
+
if (force.forceParallel) return this.shouldParallelize(0, void 0, force) ? { forceParallel: true } : { forceSequential: true };
|
|
451
470
|
}
|
|
452
|
-
async elementwise(a, b, op) {
|
|
453
|
-
return toParallelResult(await this.workerPool.elementwise(a, b, op, this.poolOptions(a.length, op)));
|
|
471
|
+
async elementwise(a, b, op, force) {
|
|
472
|
+
return toParallelResult(await this.workerPool.elementwise(a, b, op, this.poolOptions(a.length, op, force)));
|
|
454
473
|
}
|
|
455
|
-
async scale(data, scalar) {
|
|
456
|
-
return toParallelResult(await this.workerPool.scale(data, scalar, this.poolOptions(data.length, "scale")));
|
|
474
|
+
async scale(data, scalar, force) {
|
|
475
|
+
return toParallelResult(await this.workerPool.scale(data, scalar, this.poolOptions(data.length, "scale", force)));
|
|
457
476
|
}
|
|
458
|
-
async matmul(a, aRows, aCols, b, bCols) {
|
|
459
|
-
|
|
477
|
+
async matmul(a, aRows, aCols, b, bCols, force) {
|
|
478
|
+
assertMatmulShape("matmul", a.length, aRows, aCols, b.length, aCols, bCols);
|
|
479
|
+
return toParallelResult(await this.workerPool.matmul(a, aRows, aCols, b, bCols, this.poolOptions(aRows * bCols, "matmul", force)));
|
|
460
480
|
}
|
|
461
|
-
async transpose(data, rows, cols) {
|
|
462
|
-
if (
|
|
463
|
-
|
|
481
|
+
async transpose(data, rows, cols, force) {
|
|
482
|
+
if (data.length !== rows * cols) throw new Error(`transpose: data length ${data.length} !== rows*cols (${rows * cols})`);
|
|
483
|
+
if (!this.shouldParallelize(data.length, "transpose", force)) {
|
|
464
484
|
const out = new Float64Array(rows * cols);
|
|
465
485
|
for (let i = 0; i < rows; i++) for (let j = 0; j < cols; j++) out[j * rows + i] = data[i * cols + j];
|
|
466
486
|
return this.seqResult(out);
|
|
467
487
|
}
|
|
468
|
-
return toParallelResult(await this.workerPool.transpose(data, rows, cols));
|
|
488
|
+
return toParallelResult(await this.workerPool.transpose(data, rows, cols, this.forceTask(force)));
|
|
469
489
|
}
|
|
470
|
-
async map(data, fn) {
|
|
471
|
-
return toParallelResult(await this.workerPool.map(data, fn));
|
|
490
|
+
async map(data, fn, force) {
|
|
491
|
+
return toParallelResult(await this.workerPool.map(data, fn, this.forceTask(force)));
|
|
472
492
|
}
|
|
473
|
-
async reduce(data, fn, initial) {
|
|
474
|
-
return toParallelResult(await this.workerPool.reduce(data, fn, initial));
|
|
493
|
+
async reduce(data, fn, initial, force) {
|
|
494
|
+
return toParallelResult(await this.workerPool.reduce(data, fn, initial, this.forceTask(force)));
|
|
475
495
|
}
|
|
476
|
-
async filter(data, predicate) {
|
|
477
|
-
return toParallelResult(await this.workerPool.filter(data, predicate));
|
|
496
|
+
async filter(data, predicate, force) {
|
|
497
|
+
return toParallelResult(await this.workerPool.filter(data, predicate, this.forceTask(force)));
|
|
478
498
|
}
|
|
479
|
-
async minMax(data) {
|
|
480
|
-
if (!this.shouldParallelize(data.length, "minMax") && !this.shouldParallelize(data.length, "min")) {
|
|
499
|
+
async minMax(data, force) {
|
|
500
|
+
if (!this.shouldParallelize(data.length, "minMax", force) && !this.shouldParallelize(data.length, "min", force)) {
|
|
481
501
|
let min = Infinity;
|
|
482
502
|
let max = -Infinity;
|
|
483
503
|
let minIdx = -1;
|
|
@@ -499,10 +519,10 @@ var ComputePool = class {
|
|
|
499
519
|
maxIdx
|
|
500
520
|
});
|
|
501
521
|
}
|
|
502
|
-
return toParallelResult(await this.workerPool.minMax(data));
|
|
522
|
+
return toParallelResult(await this.workerPool.minMax(data, this.forceTask(force)));
|
|
503
523
|
}
|
|
504
|
-
async variance(data) {
|
|
505
|
-
if (!this.shouldParallelize(data.length, "variance")) {
|
|
524
|
+
async variance(data, force) {
|
|
525
|
+
if (!this.shouldParallelize(data.length, "variance", force)) {
|
|
506
526
|
const n = data.length;
|
|
507
527
|
const mean = n > 0 ? pairwiseSum(data) / n : 0;
|
|
508
528
|
const variance = n > 0 ? sumSquaredDeviations(data) / n : 0;
|
|
@@ -512,45 +532,51 @@ var ComputePool = class {
|
|
|
512
532
|
std: Math.sqrt(variance)
|
|
513
533
|
});
|
|
514
534
|
}
|
|
515
|
-
return toParallelResult(await this.workerPool.variance(data));
|
|
535
|
+
return toParallelResult(await this.workerPool.variance(data, this.forceTask(force)));
|
|
516
536
|
}
|
|
517
|
-
async norm(data) {
|
|
518
|
-
if (!this.shouldParallelize(data.length, "norm")) return this.seqResult(norm2(data));
|
|
519
|
-
return toParallelResult(await this.workerPool.norm(data));
|
|
537
|
+
async norm(data, force) {
|
|
538
|
+
if (!this.shouldParallelize(data.length, "norm", force)) return this.seqResult(norm2(data));
|
|
539
|
+
return toParallelResult(await this.workerPool.norm(data, this.forceTask(force)));
|
|
520
540
|
}
|
|
521
|
-
async distance(a, b) {
|
|
541
|
+
async distance(a, b, force) {
|
|
522
542
|
return this.gatedBinary(a, b, {
|
|
523
543
|
op: "distance",
|
|
544
|
+
force,
|
|
524
545
|
sequential: scaledDistance,
|
|
525
|
-
worker: (x, y) => this.workerPool.distance(x, y)
|
|
546
|
+
worker: (x, y) => this.workerPool.distance(x, y, this.forceTask(force))
|
|
526
547
|
});
|
|
527
548
|
}
|
|
528
|
-
async histogram(data, bins, min, max) {
|
|
529
|
-
if (!
|
|
549
|
+
async histogram(data, bins, min, max, force) {
|
|
550
|
+
if (!Number.isInteger(bins) || bins <= 0) throw new RangeError(`histogram: bins must be a positive integer (got ${bins})`);
|
|
551
|
+
if (!this.shouldParallelize(data.length, "histogram", force)) {
|
|
530
552
|
let lo = min;
|
|
531
553
|
let hi = max;
|
|
532
554
|
if (lo === void 0 || hi === void 0) {
|
|
533
555
|
lo = Infinity;
|
|
534
556
|
hi = -Infinity;
|
|
535
557
|
for (let i = 0; i < data.length; i++) {
|
|
536
|
-
|
|
537
|
-
if (
|
|
558
|
+
const v = data[i];
|
|
559
|
+
if (!Number.isFinite(v)) continue;
|
|
560
|
+
if (v < lo) lo = v;
|
|
561
|
+
if (v > hi) hi = v;
|
|
538
562
|
}
|
|
539
563
|
}
|
|
540
564
|
const counts = new Array(bins).fill(0);
|
|
541
|
-
const width = (hi - lo) / bins
|
|
565
|
+
const width = hi > lo ? (hi - lo) / bins : 1;
|
|
542
566
|
for (let i = 0; i < data.length; i++) {
|
|
543
|
-
|
|
567
|
+
const v = data[i];
|
|
568
|
+
if (!Number.isFinite(v)) continue;
|
|
569
|
+
let b = Math.floor((v - lo) / width);
|
|
544
570
|
if (b >= bins) b = bins - 1;
|
|
545
571
|
if (b < 0) b = 0;
|
|
546
572
|
counts[b]++;
|
|
547
573
|
}
|
|
548
574
|
return this.seqResult(counts);
|
|
549
575
|
}
|
|
550
|
-
return toParallelResult(await this.workerPool.histogram(data, bins, min, max));
|
|
576
|
+
return toParallelResult(await this.workerPool.histogram(data, bins, min, max, this.forceTask(force)));
|
|
551
577
|
}
|
|
552
|
-
async unary(data, fn) {
|
|
553
|
-
return toParallelResult(await this.workerPool.unary(data, fn, this.poolOptions(data.length, fn)));
|
|
578
|
+
async unary(data, fn, force) {
|
|
579
|
+
return toParallelResult(await this.workerPool.unary(data, fn, this.poolOptions(data.length, fn, force)));
|
|
554
580
|
}
|
|
555
581
|
async applyKernel(data, fnSource) {
|
|
556
582
|
return toParallelResult(await this.workerPool.applyKernel(data, fnSource));
|
|
@@ -604,37 +630,37 @@ var ComputePool = class {
|
|
|
604
630
|
async distanceMatrix(points, n, dim) {
|
|
605
631
|
return toParallelResult(await this.workerPool.distanceMatrix(points, n, dim));
|
|
606
632
|
}
|
|
607
|
-
async abs(data) {
|
|
608
|
-
return this.unary(data, "abs");
|
|
633
|
+
async abs(data, force) {
|
|
634
|
+
return this.unary(data, "abs", force);
|
|
609
635
|
}
|
|
610
|
-
async sqrt(data) {
|
|
611
|
-
return this.unary(data, "sqrt");
|
|
636
|
+
async sqrt(data, force) {
|
|
637
|
+
return this.unary(data, "sqrt", force);
|
|
612
638
|
}
|
|
613
|
-
async exp(data) {
|
|
614
|
-
return this.unary(data, "exp");
|
|
639
|
+
async exp(data, force) {
|
|
640
|
+
return this.unary(data, "exp", force);
|
|
615
641
|
}
|
|
616
|
-
async log(data) {
|
|
617
|
-
return this.unary(data, "log");
|
|
642
|
+
async log(data, force) {
|
|
643
|
+
return this.unary(data, "log", force);
|
|
618
644
|
}
|
|
619
|
-
async sin(data) {
|
|
620
|
-
return this.unary(data, "sin");
|
|
645
|
+
async sin(data, force) {
|
|
646
|
+
return this.unary(data, "sin", force);
|
|
621
647
|
}
|
|
622
|
-
async cos(data) {
|
|
623
|
-
return this.unary(data, "cos");
|
|
648
|
+
async cos(data, force) {
|
|
649
|
+
return this.unary(data, "cos", force);
|
|
624
650
|
}
|
|
625
|
-
async tan(data) {
|
|
626
|
-
return this.unary(data, "tan");
|
|
651
|
+
async tan(data, force) {
|
|
652
|
+
return this.unary(data, "tan", force);
|
|
627
653
|
}
|
|
628
|
-
async negate(data) {
|
|
629
|
-
return this.unary(data, "negate");
|
|
654
|
+
async negate(data, force) {
|
|
655
|
+
return this.unary(data, "negate", force);
|
|
630
656
|
}
|
|
631
|
-
async square(data) {
|
|
632
|
-
return this.unary(data, "square");
|
|
657
|
+
async square(data, force) {
|
|
658
|
+
return this.unary(data, "square", force);
|
|
633
659
|
}
|
|
634
|
-
async matvec(matrix, rows, cols, vector) {
|
|
635
|
-
if (
|
|
636
|
-
|
|
637
|
-
|
|
660
|
+
async matvec(matrix, rows, cols, vector, force) {
|
|
661
|
+
if (matrix.length !== rows * cols) throw new Error(`matvec: matrix length ${matrix.length} !== rows*cols (${rows * cols})`);
|
|
662
|
+
if (vector.length !== cols) throw new Error(`matvec: vector length ${vector.length} !== cols (${cols})`);
|
|
663
|
+
if (!this.shouldParallelize(matrix.length, "matvec", force)) {
|
|
638
664
|
const out = new Float64Array(rows);
|
|
639
665
|
for (let i = 0; i < rows; i++) {
|
|
640
666
|
let s = 0;
|
|
@@ -643,36 +669,36 @@ var ComputePool = class {
|
|
|
643
669
|
}
|
|
644
670
|
return this.seqResult(out);
|
|
645
671
|
}
|
|
646
|
-
return toParallelResult(await this.workerPool.matvec(matrix, rows, cols, vector));
|
|
672
|
+
return toParallelResult(await this.workerPool.matvec(matrix, rows, cols, vector, this.forceTask(force)));
|
|
647
673
|
}
|
|
648
|
-
async outer(a, b) {
|
|
649
|
-
if (!this.shouldParallelize(a.length * b.length, "outer")) {
|
|
674
|
+
async outer(a, b, force) {
|
|
675
|
+
if (!this.shouldParallelize(a.length * b.length, "outer", force)) {
|
|
650
676
|
const out = new Float64Array(a.length * b.length);
|
|
651
677
|
for (let i = 0; i < a.length; i++) for (let j = 0; j < b.length; j++) out[i * b.length + j] = a[i] * b[j];
|
|
652
678
|
return this.seqResult(out);
|
|
653
679
|
}
|
|
654
|
-
return toParallelResult(await this.workerPool.outer(a, b));
|
|
680
|
+
return toParallelResult(await this.workerPool.outer(a, b, this.forceTask(force)));
|
|
655
681
|
}
|
|
656
|
-
async find(data, predicate) {
|
|
657
|
-
return toParallelResult(await this.workerPool.find(data, predicate));
|
|
682
|
+
async find(data, predicate, force) {
|
|
683
|
+
return toParallelResult(await this.workerPool.find(data, predicate, this.forceTask(force)));
|
|
658
684
|
}
|
|
659
|
-
async sort(data, compare) {
|
|
660
|
-
return toParallelResult(await this.workerPool.sort(data, compare));
|
|
685
|
+
async sort(data, compare, force) {
|
|
686
|
+
return toParallelResult(await this.workerPool.sort(data, compare, this.forceTask(force)));
|
|
661
687
|
}
|
|
662
|
-
async add(a, b) {
|
|
663
|
-
return this.elementwise(a, b, "add");
|
|
688
|
+
async add(a, b, force) {
|
|
689
|
+
return this.elementwise(a, b, "add", force);
|
|
664
690
|
}
|
|
665
|
-
async subtract(a, b) {
|
|
666
|
-
return this.elementwise(a, b, "subtract");
|
|
691
|
+
async subtract(a, b, force) {
|
|
692
|
+
return this.elementwise(a, b, "subtract", force);
|
|
667
693
|
}
|
|
668
|
-
async multiply(a, b) {
|
|
669
|
-
return this.elementwise(a, b, "multiply");
|
|
694
|
+
async multiply(a, b, force) {
|
|
695
|
+
return this.elementwise(a, b, "multiply", force);
|
|
670
696
|
}
|
|
671
|
-
async divide(a, b) {
|
|
672
|
-
return this.elementwise(a, b, "divide");
|
|
697
|
+
async divide(a, b, force) {
|
|
698
|
+
return this.elementwise(a, b, "divide", force);
|
|
673
699
|
}
|
|
674
700
|
async pow(a, b) {
|
|
675
|
-
|
|
701
|
+
assertSameLength("pow", a.length, b.length);
|
|
676
702
|
if (this.shouldParallelize(a.length, "pow")) return this.applyKernel2(a, b, "(a, b) => Math.pow(a, b)");
|
|
677
703
|
const start = performance.now();
|
|
678
704
|
const result = new Float64Array(a.length);
|
|
@@ -725,10 +751,12 @@ var ComputePool = class {
|
|
|
725
751
|
const bShapeArr = Array.from(bShape);
|
|
726
752
|
const axesAArr = Array.from(axesA);
|
|
727
753
|
const axesBArr = Array.from(axesB);
|
|
754
|
+
const aBuffer = exactBuffer(a);
|
|
755
|
+
const bBuffer = exactBuffer(b);
|
|
728
756
|
const chunkResults = await Promise.all(chunks.map(([outStart, outEnd]) => this.workerPool.exec("tensordotChunk", [
|
|
729
|
-
|
|
757
|
+
aBuffer,
|
|
730
758
|
aShapeArr,
|
|
731
|
-
|
|
759
|
+
bBuffer,
|
|
732
760
|
bShapeArr,
|
|
733
761
|
axesAArr,
|
|
734
762
|
axesBArr,
|
|
@@ -763,29 +791,29 @@ var ComputePool = class {
|
|
|
763
791
|
parallelized: false
|
|
764
792
|
};
|
|
765
793
|
}
|
|
766
|
-
async mean(data) {
|
|
767
|
-
const result = await this.variance(data);
|
|
794
|
+
async mean(data, force) {
|
|
795
|
+
const result = await this.variance(data, force);
|
|
768
796
|
return {
|
|
769
797
|
...result,
|
|
770
798
|
result: result.result.mean
|
|
771
799
|
};
|
|
772
800
|
}
|
|
773
|
-
async std(data) {
|
|
774
|
-
const result = await this.variance(data);
|
|
801
|
+
async std(data, force) {
|
|
802
|
+
const result = await this.variance(data, force);
|
|
775
803
|
return {
|
|
776
804
|
...result,
|
|
777
805
|
result: result.result.std
|
|
778
806
|
};
|
|
779
807
|
}
|
|
780
|
-
async min(data) {
|
|
781
|
-
const result = await this.minMax(data);
|
|
808
|
+
async min(data, force) {
|
|
809
|
+
const result = await this.minMax(data, force);
|
|
782
810
|
return {
|
|
783
811
|
...result,
|
|
784
812
|
result: result.result.min
|
|
785
813
|
};
|
|
786
814
|
}
|
|
787
|
-
async max(data) {
|
|
788
|
-
const result = await this.minMax(data);
|
|
815
|
+
async max(data, force) {
|
|
816
|
+
const result = await this.minMax(data, force);
|
|
789
817
|
return {
|
|
790
818
|
...result,
|
|
791
819
|
result: result.result.max
|
|
@@ -861,7 +889,8 @@ var ComputePool = class {
|
|
|
861
889
|
const computePool = new ComputePool();
|
|
862
890
|
//#endregion
|
|
863
891
|
//#region src/WorkerPool.ts
|
|
864
|
-
|
|
892
|
+
let taskCounter = 0;
|
|
893
|
+
var WorkerPool = class WorkerPool {
|
|
865
894
|
workers = [];
|
|
866
895
|
availableWorkers = [];
|
|
867
896
|
taskQueue = [];
|
|
@@ -870,7 +899,10 @@ var WorkerPool = class {
|
|
|
870
899
|
workerScript;
|
|
871
900
|
isNode;
|
|
872
901
|
terminated = false;
|
|
902
|
+
readyWorkers = /* @__PURE__ */ new WeakSet();
|
|
903
|
+
startupFailures = 0;
|
|
873
904
|
constructor(workerScript, maxWorkers) {
|
|
905
|
+
if (maxWorkers !== void 0 && (!Number.isInteger(maxWorkers) || maxWorkers < 0)) throw new RangeError(`WorkerPool: maxWorkers must be a non-negative integer, 0 for auto (got ${maxWorkers})`);
|
|
874
906
|
this.workerScript = workerScript;
|
|
875
907
|
this.maxWorkers = maxWorkers || this.getOptimalWorkerCount();
|
|
876
908
|
this.isNode = typeof process !== "undefined" && process.versions?.node !== void 0;
|
|
@@ -881,7 +913,7 @@ var WorkerPool = class {
|
|
|
881
913
|
return 4;
|
|
882
914
|
}
|
|
883
915
|
async initialize() {
|
|
884
|
-
|
|
916
|
+
await Promise.all(Array.from({ length: this.maxWorkers }, async () => {
|
|
885
917
|
const worker = await this.createWorker();
|
|
886
918
|
if (this.terminated) {
|
|
887
919
|
worker.terminate();
|
|
@@ -890,12 +922,17 @@ var WorkerPool = class {
|
|
|
890
922
|
this.workers.push(worker);
|
|
891
923
|
this.availableWorkers.push(worker);
|
|
892
924
|
this.processQueue();
|
|
893
|
-
}
|
|
925
|
+
}));
|
|
926
|
+
}
|
|
927
|
+
workerThreadsModule;
|
|
928
|
+
nodeWorkerThreads() {
|
|
929
|
+
this.workerThreadsModule ??= import("worker_threads");
|
|
930
|
+
return this.workerThreadsModule;
|
|
894
931
|
}
|
|
895
932
|
async createWorker() {
|
|
896
933
|
let worker;
|
|
897
934
|
if (this.isNode) {
|
|
898
|
-
const { Worker: NodeWorker } = await
|
|
935
|
+
const { Worker: NodeWorker } = await this.nodeWorkerThreads();
|
|
899
936
|
const nodeWorker = new NodeWorker(this.workerScript.startsWith("file://") ? new URL(this.workerScript) : this.workerScript);
|
|
900
937
|
nodeWorker.on("message", (data) => {
|
|
901
938
|
this.handleWorkerMessage(worker, data);
|
|
@@ -916,8 +953,16 @@ var WorkerPool = class {
|
|
|
916
953
|
return worker;
|
|
917
954
|
}
|
|
918
955
|
handleWorkerMessage(worker, message) {
|
|
956
|
+
this.readyWorkers.add(worker);
|
|
957
|
+
this.startupFailures = 0;
|
|
919
958
|
const task = this.activeTasks.get(message.id);
|
|
920
|
-
if (!task)
|
|
959
|
+
if (!task) {
|
|
960
|
+
if (this.workers.includes(worker) && !this.availableWorkers.includes(worker) && !this.isBusy(worker)) {
|
|
961
|
+
this.availableWorkers.push(worker);
|
|
962
|
+
this.processQueue();
|
|
963
|
+
}
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
921
966
|
this.activeTasks.delete(message.id);
|
|
922
967
|
if (task.timeoutHandle) {
|
|
923
968
|
clearTimeout(task.timeoutHandle);
|
|
@@ -930,11 +975,54 @@ var WorkerPool = class {
|
|
|
930
975
|
}
|
|
931
976
|
handleWorkerError(worker, error) {
|
|
932
977
|
console.error("Worker error:", error);
|
|
933
|
-
|
|
978
|
+
if (!this.workers.includes(worker)) return;
|
|
979
|
+
for (const [id, task] of this.activeTasks) if (task.worker === worker) {
|
|
934
980
|
this.activeTasks.delete(id);
|
|
935
981
|
this.clearTaskTimer(task);
|
|
936
982
|
task.reject(/* @__PURE__ */ new Error(`Worker error: ${error.message}`));
|
|
937
983
|
}
|
|
984
|
+
if (!this.readyWorkers.has(worker)) {
|
|
985
|
+
this.startupFailures++;
|
|
986
|
+
if (this.startupFailures >= WorkerPool.MAX_STARTUP_FAILURES) {
|
|
987
|
+
this.workers = this.workers.filter((w) => w !== worker);
|
|
988
|
+
this.availableWorkers = this.availableWorkers.filter((w) => w !== worker);
|
|
989
|
+
try {
|
|
990
|
+
worker.terminate();
|
|
991
|
+
} catch {}
|
|
992
|
+
const reason = /* @__PURE__ */ new Error(`WorkerPool: ${this.startupFailures} consecutive workers failed before becoming ready (${error.message}); not respawning`);
|
|
993
|
+
for (const task of this.taskQueue.splice(0)) {
|
|
994
|
+
this.clearTaskTimer(task);
|
|
995
|
+
task.reject(reason);
|
|
996
|
+
}
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
this.evictAndReplace(worker);
|
|
1001
|
+
}
|
|
1002
|
+
static MAX_STARTUP_FAILURES = 3;
|
|
1003
|
+
isBusy(worker) {
|
|
1004
|
+
for (const task of this.activeTasks.values()) if (task.worker === worker) return true;
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
async evictAndReplace(dead) {
|
|
1008
|
+
try {
|
|
1009
|
+
dead.terminate();
|
|
1010
|
+
} catch {}
|
|
1011
|
+
this.workers = this.workers.filter((w) => w !== dead);
|
|
1012
|
+
this.availableWorkers = this.availableWorkers.filter((w) => w !== dead);
|
|
1013
|
+
if (this.terminated) return;
|
|
1014
|
+
try {
|
|
1015
|
+
const replacement = await this.createWorker();
|
|
1016
|
+
if (this.terminated) {
|
|
1017
|
+
replacement.terminate();
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
this.workers.push(replacement);
|
|
1021
|
+
this.availableWorkers.push(replacement);
|
|
1022
|
+
this.processQueue();
|
|
1023
|
+
} catch (err) {
|
|
1024
|
+
console.error("WorkerPool: failed to spawn replacement worker:", err);
|
|
1025
|
+
}
|
|
938
1026
|
}
|
|
939
1027
|
processQueue() {
|
|
940
1028
|
while (this.taskQueue.length > 0 && this.availableWorkers.length > 0) {
|
|
@@ -1009,7 +1097,7 @@ var WorkerPool = class {
|
|
|
1009
1097
|
});
|
|
1010
1098
|
}
|
|
1011
1099
|
generateTaskId() {
|
|
1012
|
-
return `task_${
|
|
1100
|
+
return `task_${++taskCounter}`;
|
|
1013
1101
|
}
|
|
1014
1102
|
async terminate() {
|
|
1015
1103
|
this.terminated = true;
|
|
@@ -1046,137 +1134,137 @@ var WorkerPool = class {
|
|
|
1046
1134
|
//#endregion
|
|
1047
1135
|
//#region src/operations/matmul.ts
|
|
1048
1136
|
async function parallelMatmul(a, aRows, aCols, b, bCols, options = {}) {
|
|
1049
|
-
return (options.pool ?? computePool).matmul(a, aRows, aCols, b, bCols);
|
|
1137
|
+
return (options.pool ?? computePool).matmul(a, aRows, aCols, b, bCols, options);
|
|
1050
1138
|
}
|
|
1051
1139
|
async function parallelMatvec(matrix, rows, cols, vector, options = {}) {
|
|
1052
|
-
return (options.pool ?? computePool).matvec(matrix, rows, cols, vector);
|
|
1140
|
+
return (options.pool ?? computePool).matvec(matrix, rows, cols, vector, options);
|
|
1053
1141
|
}
|
|
1054
1142
|
async function parallelTranspose(data, rows, cols, options = {}) {
|
|
1055
|
-
return (options.pool ?? computePool).transpose(data, rows, cols);
|
|
1143
|
+
return (options.pool ?? computePool).transpose(data, rows, cols, options);
|
|
1056
1144
|
}
|
|
1057
1145
|
async function parallelOuter(a, b, options = {}) {
|
|
1058
|
-
return (options.pool ?? computePool).outer(a, b);
|
|
1146
|
+
return (options.pool ?? computePool).outer(a, b, options);
|
|
1059
1147
|
}
|
|
1060
1148
|
async function parallelDot(a, b, options = {}) {
|
|
1061
|
-
return (options.pool ?? computePool).dot(a, b);
|
|
1149
|
+
return (options.pool ?? computePool).dot(a, b, options);
|
|
1062
1150
|
}
|
|
1063
1151
|
//#endregion
|
|
1064
1152
|
//#region src/operations/elementwise.ts
|
|
1065
1153
|
async function parallelAdd(a, b, options = {}) {
|
|
1066
|
-
return (options.pool ?? computePool).add(a, b);
|
|
1154
|
+
return (options.pool ?? computePool).add(a, b, options);
|
|
1067
1155
|
}
|
|
1068
1156
|
async function parallelSubtract(a, b, options = {}) {
|
|
1069
|
-
return (options.pool ?? computePool).subtract(a, b);
|
|
1157
|
+
return (options.pool ?? computePool).subtract(a, b, options);
|
|
1070
1158
|
}
|
|
1071
1159
|
async function parallelMultiply(a, b, options = {}) {
|
|
1072
|
-
return (options.pool ?? computePool).multiply(a, b);
|
|
1160
|
+
return (options.pool ?? computePool).multiply(a, b, options);
|
|
1073
1161
|
}
|
|
1074
1162
|
async function parallelDivide(a, b, options = {}) {
|
|
1075
|
-
return (options.pool ?? computePool).divide(a, b);
|
|
1163
|
+
return (options.pool ?? computePool).divide(a, b, options);
|
|
1076
1164
|
}
|
|
1077
1165
|
async function parallelScale(data, scalar, options = {}) {
|
|
1078
|
-
return (options.pool ?? computePool).scale(data, scalar);
|
|
1166
|
+
return (options.pool ?? computePool).scale(data, scalar, options);
|
|
1079
1167
|
}
|
|
1080
1168
|
async function parallelAbs(data, options = {}) {
|
|
1081
|
-
return (options.pool ?? computePool).abs(data);
|
|
1169
|
+
return (options.pool ?? computePool).abs(data, options);
|
|
1082
1170
|
}
|
|
1083
1171
|
async function parallelNegate(data, options = {}) {
|
|
1084
|
-
return (options.pool ?? computePool).negate(data);
|
|
1172
|
+
return (options.pool ?? computePool).negate(data, options);
|
|
1085
1173
|
}
|
|
1086
1174
|
async function parallelSquare(data, options = {}) {
|
|
1087
|
-
return (options.pool ?? computePool).square(data);
|
|
1175
|
+
return (options.pool ?? computePool).square(data, options);
|
|
1088
1176
|
}
|
|
1089
1177
|
async function parallelSqrt(data, options = {}) {
|
|
1090
|
-
return (options.pool ?? computePool).sqrt(data);
|
|
1178
|
+
return (options.pool ?? computePool).sqrt(data, options);
|
|
1091
1179
|
}
|
|
1092
1180
|
async function parallelExp(data, options = {}) {
|
|
1093
|
-
return (options.pool ?? computePool).exp(data);
|
|
1181
|
+
return (options.pool ?? computePool).exp(data, options);
|
|
1094
1182
|
}
|
|
1095
1183
|
async function parallelLog(data, options = {}) {
|
|
1096
|
-
return (options.pool ?? computePool).log(data);
|
|
1184
|
+
return (options.pool ?? computePool).log(data, options);
|
|
1097
1185
|
}
|
|
1098
1186
|
async function parallelSin(data, options = {}) {
|
|
1099
|
-
return (options.pool ?? computePool).sin(data);
|
|
1187
|
+
return (options.pool ?? computePool).sin(data, options);
|
|
1100
1188
|
}
|
|
1101
1189
|
async function parallelCos(data, options = {}) {
|
|
1102
|
-
return (options.pool ?? computePool).cos(data);
|
|
1190
|
+
return (options.pool ?? computePool).cos(data, options);
|
|
1103
1191
|
}
|
|
1104
1192
|
async function parallelTan(data, options = {}) {
|
|
1105
|
-
return (options.pool ?? computePool).tan(data);
|
|
1193
|
+
return (options.pool ?? computePool).tan(data, options);
|
|
1106
1194
|
}
|
|
1107
1195
|
async function parallelElementwise(a, b, op, options = {}) {
|
|
1108
|
-
return (options.pool ?? computePool).elementwise(a, b, op);
|
|
1196
|
+
return (options.pool ?? computePool).elementwise(a, b, op, options);
|
|
1109
1197
|
}
|
|
1110
1198
|
async function parallelUnary(data, fn, options = {}) {
|
|
1111
|
-
return (options.pool ?? computePool).unary(data, fn);
|
|
1199
|
+
return (options.pool ?? computePool).unary(data, fn, options);
|
|
1112
1200
|
}
|
|
1113
1201
|
//#endregion
|
|
1114
1202
|
//#region src/operations/reduce.ts
|
|
1115
1203
|
async function parallelSum(data, options = {}) {
|
|
1116
|
-
return (options.pool ?? computePool).sum(data);
|
|
1204
|
+
return (options.pool ?? computePool).sum(data, options);
|
|
1117
1205
|
}
|
|
1118
1206
|
async function parallelMean(data, options = {}) {
|
|
1119
|
-
return (options.pool ?? computePool).mean(data);
|
|
1207
|
+
return (options.pool ?? computePool).mean(data, options);
|
|
1120
1208
|
}
|
|
1121
1209
|
async function parallelMin(data, options = {}) {
|
|
1122
|
-
return (options.pool ?? computePool).min(data);
|
|
1210
|
+
return (options.pool ?? computePool).min(data, options);
|
|
1123
1211
|
}
|
|
1124
1212
|
async function parallelMax(data, options = {}) {
|
|
1125
|
-
return (options.pool ?? computePool).max(data);
|
|
1213
|
+
return (options.pool ?? computePool).max(data, options);
|
|
1126
1214
|
}
|
|
1127
1215
|
async function parallelMinMax(data, options = {}) {
|
|
1128
|
-
return (options.pool ?? computePool).minMax(data);
|
|
1216
|
+
return (options.pool ?? computePool).minMax(data, options);
|
|
1129
1217
|
}
|
|
1130
1218
|
async function parallelVariance(data, options = {}) {
|
|
1131
|
-
return (options.pool ?? computePool).variance(data);
|
|
1219
|
+
return (options.pool ?? computePool).variance(data, options);
|
|
1132
1220
|
}
|
|
1133
1221
|
async function parallelStd(data, options = {}) {
|
|
1134
|
-
return (options.pool ?? computePool).std(data);
|
|
1222
|
+
return (options.pool ?? computePool).std(data, options);
|
|
1135
1223
|
}
|
|
1136
1224
|
async function parallelNorm(data, options = {}) {
|
|
1137
|
-
return (options.pool ?? computePool).norm(data);
|
|
1225
|
+
return (options.pool ?? computePool).norm(data, options);
|
|
1138
1226
|
}
|
|
1139
1227
|
async function parallelDistance(a, b, options = {}) {
|
|
1140
|
-
return (options.pool ?? computePool).distance(a, b);
|
|
1228
|
+
return (options.pool ?? computePool).distance(a, b, options);
|
|
1141
1229
|
}
|
|
1142
1230
|
async function parallelHistogram(data, bins, min, max, options = {}) {
|
|
1143
|
-
return (options.pool ?? computePool).histogram(data, bins, min, max);
|
|
1231
|
+
return (options.pool ?? computePool).histogram(data, bins, min, max, options);
|
|
1144
1232
|
}
|
|
1145
1233
|
async function parallelReduce(data, fn, initial, options = {}) {
|
|
1146
|
-
return (options.pool ?? computePool).reduce(data, fn, initial);
|
|
1234
|
+
return (options.pool ?? computePool).reduce(data, fn, initial, options);
|
|
1147
1235
|
}
|
|
1148
1236
|
//#endregion
|
|
1149
1237
|
//#region src/operations/map.ts
|
|
1150
1238
|
async function parallelMap(data, fn, options = {}) {
|
|
1151
|
-
return (options.pool ?? computePool).map(data, fn);
|
|
1239
|
+
return (options.pool ?? computePool).map(data, fn, options);
|
|
1152
1240
|
}
|
|
1153
1241
|
async function parallelFilter(data, predicate, options = {}) {
|
|
1154
|
-
return (options.pool ?? computePool).filter(data, predicate);
|
|
1242
|
+
return (options.pool ?? computePool).filter(data, predicate, options);
|
|
1155
1243
|
}
|
|
1156
1244
|
async function parallelFind(data, predicate, options = {}) {
|
|
1157
|
-
return (options.pool ?? computePool).find(data, predicate);
|
|
1245
|
+
return (options.pool ?? computePool).find(data, predicate, options);
|
|
1158
1246
|
}
|
|
1159
1247
|
async function parallelSort(data, compare, options = {}) {
|
|
1160
|
-
return (options.pool ?? computePool).sort(data, compare);
|
|
1248
|
+
return (options.pool ?? computePool).sort(data, compare, options);
|
|
1161
1249
|
}
|
|
1162
1250
|
async function parallelForEach(data, fn, options = {}) {
|
|
1163
1251
|
const result = await (options.pool ?? computePool).map(data, (item) => {
|
|
1164
1252
|
fn(item);
|
|
1165
|
-
});
|
|
1253
|
+
}, options);
|
|
1166
1254
|
return {
|
|
1167
1255
|
...result,
|
|
1168
1256
|
result: result.result
|
|
1169
1257
|
};
|
|
1170
1258
|
}
|
|
1171
1259
|
async function parallelSome(data, predicate, options = {}) {
|
|
1172
|
-
const findResult = await (options.pool ?? computePool).find(data, predicate);
|
|
1260
|
+
const findResult = await (options.pool ?? computePool).find(data, predicate, options);
|
|
1173
1261
|
return {
|
|
1174
1262
|
...findResult,
|
|
1175
1263
|
result: findResult.result.found
|
|
1176
1264
|
};
|
|
1177
1265
|
}
|
|
1178
1266
|
async function parallelEvery(data, predicate, options = {}) {
|
|
1179
|
-
const findResult = await (options.pool ?? computePool).find(data, (item) => !predicate(item));
|
|
1267
|
+
const findResult = await (options.pool ?? computePool).find(data, (item) => !predicate(item), options);
|
|
1180
1268
|
return {
|
|
1181
1269
|
...findResult,
|
|
1182
1270
|
result: !findResult.result.found
|
|
@@ -1190,7 +1278,7 @@ async function parallelCount(data, predicate, options = {}) {
|
|
|
1190
1278
|
chunks: 1,
|
|
1191
1279
|
parallelized: false
|
|
1192
1280
|
};
|
|
1193
|
-
const filterResult = await pool.filter(data, predicate);
|
|
1281
|
+
const filterResult = await pool.filter(data, predicate, options);
|
|
1194
1282
|
return {
|
|
1195
1283
|
...filterResult,
|
|
1196
1284
|
result: filterResult.result.length
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/operations/map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,uDAAuD;IACvD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yDAAy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":3,"file":"bitwise.d.ts","sourceRoot":"","sources":["../../src/ops/bitwise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"bitwise.d.ts","sourceRoot":"","sources":["../../src/ops/bitwise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGnF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GACzB,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAsEpF;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,CAEvF;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,CAEtF;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,CAEvF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,GAAG,MAAM,EACtB,OAAO,CAAC,EAAE,YAAY,GACrB,UAAU,CAGZ;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,GAAG,MAAM,EACtB,OAAO,CAAC,EAAE,YAAY,GACrB,UAAU,CAGZ;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,GAAG,MAAM,EACtB,OAAO,CAAC,EAAE,YAAY,GACrB,UAAU,CAGZ;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,UAAU,CAiB5E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Argument validation shared by the parallel operations.
|
|
3
|
+
*
|
|
4
|
+
* Every check throws one message shape per kind of mistake, so callers and tests can match a
|
|
5
|
+
* single text whatever the size of the input or the path (inline or workers) it would take.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Length check for binary element-wise operations: `<op>: lengths must match (<a> vs <b>)`.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function assertSameLength(op: string, a: number, b: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* Shape check for a row-major `aRows x aCols` times `bRows x bCols` product. Checks the inner
|
|
16
|
+
* dimensions and that both buffers hold exactly the elements their shapes claim.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function assertMatmulShape(op: string, aLength: number, aRows: number, aCols: number, bLength: number, bRows: number, bCols: number): void;
|
|
20
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI,CAUN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-parallel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "WebWorker parallelization for MathTS computations",
|
|
5
5
|
"author": "Daniel Simon Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@danielsimonjr/mathts-workerpool": "^0.
|
|
46
|
-
"@danielsimonjr/mathts-core": "^0.
|
|
45
|
+
"@danielsimonjr/mathts-workerpool": "^0.3.0",
|
|
46
|
+
"@danielsimonjr/mathts-core": "^0.22.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^26.4.0",
|