@danielsimonjr/mathts-functions 0.19.0 → 0.20.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/gpu/elementwise-gpu.d.ts +48 -1
- package/dist/gpu/elementwise-gpu.d.ts.map +1 -1
- package/dist/index.js +256 -56
- package/dist/matrix/fft.d.ts.map +1 -1
- package/dist/signal/fft-core-f64.d.ts +37 -0
- package/dist/signal/fft-core-f64.d.ts.map +1 -0
- package/dist/typed/fused.d.ts +22 -1
- package/dist/typed/fused.d.ts.map +1 -1
- package/dist/typed/index.d.ts +1 -1
- package/dist/typed/index.d.ts.map +1 -1
- package/dist/typed/signal.d.ts.map +1 -1
- package/package.json +76 -76
|
@@ -45,9 +45,12 @@ declare const WGSL_OP_BODY: {
|
|
|
45
45
|
};
|
|
46
46
|
/** Ops that have a GPU kernel. A chain outside this set falls back. */
|
|
47
47
|
export type GpuElementwiseOp = keyof typeof WGSL_OP_BODY;
|
|
48
|
-
export declare const GPU_ELEMENTWISE_OPS: GpuElementwiseOp[];
|
|
48
|
+
export declare const GPU_ELEMENTWISE_OPS: readonly GpuElementwiseOp[];
|
|
49
49
|
/** Whether every op in the chain has a GPU kernel. */
|
|
50
50
|
export declare function isGpuChainSupported(ops: readonly string[]): ops is readonly GpuElementwiseOp[];
|
|
51
|
+
/** Reductions that can be fused onto the end of a chain. */
|
|
52
|
+
export type GpuReduceOp = 'sum' | 'max' | 'min';
|
|
53
|
+
export declare const GPU_REDUCE_OPS: readonly ["sum", "max", "min"];
|
|
51
54
|
/** Drop the cached shaders/buffers (device loss, or between tests). */
|
|
52
55
|
export declare function resetGpuElementwise(): void;
|
|
53
56
|
/** Options for a GPU element-wise dispatch. */
|
|
@@ -69,5 +72,49 @@ export interface GpuChainOptions extends GPUContextOptions {
|
|
|
69
72
|
* @returns the f32 results, or `null` to signal "fall back to another tier"
|
|
70
73
|
*/
|
|
71
74
|
export declare function elementwiseChainGpuDispatch(ops: readonly string[], xs: Float64Array | Float32Array, options?: GpuChainOptions): Promise<Float32Array | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Apply `ops` on the GPU and **reduce the result on-device**, returning a single
|
|
77
|
+
* number instead of an array.
|
|
78
|
+
*
|
|
79
|
+
* The point is the readback, not the arithmetic: reducing on the device replaces
|
|
80
|
+
* an **n-float** transfer back to the CPU with an **n/256-float** one. Measured
|
|
81
|
+
* end-to-end through THIS function (not a prototype), NVIDIA Pascal,
|
|
82
|
+
* `sum(exp(sin(x)))`:
|
|
83
|
+
*
|
|
84
|
+
* | n | WASM chain + JS sum | GPU chain + JS sum | fused GPU reduce |
|
|
85
|
+
* | --------- | ------------------- | ------------------ | ---------------- |
|
|
86
|
+
* | 262,144 | 25.6 ms | 16.7 ms | **9.9 ms** |
|
|
87
|
+
* | 1,048,576 | 96.8 ms | 34.3 ms | **25.4 ms** |
|
|
88
|
+
* | 4,194,304 | 260.0 ms | 100.0 ms | **72.2 ms** |
|
|
89
|
+
*
|
|
90
|
+
* **1.35-1.7x** over the shipped GPU path, **2.6-3.8x** over the CPU tier.
|
|
91
|
+
*
|
|
92
|
+
* Quote the **1.39x at n=2^22** if you quote one number: it is the only ratio here that
|
|
93
|
+
* reproduces run to run (1.31-1.39x over four runs). The 1.7x is the n=262,144 row, and
|
|
94
|
+
* that size swings 1.19-2.83x between runs — the GPU work is short enough that fixed
|
|
95
|
+
* costs dominate. A headline should not be a lucky sample.
|
|
96
|
+
*
|
|
97
|
+
* Why not more: a bare-WGSL prototype of this hit ~2x, but it pre-converted its
|
|
98
|
+
* input outside the timed region. The real f64->f32 conversion is an n-scaling cost
|
|
99
|
+
* that BOTH paths pay, so it dilutes the ratio as n grows (the absolute saving is
|
|
100
|
+
* steady: ~28 ms at n=2^22). The prototype's number was not a lie, it was measuring
|
|
101
|
+
* a workload no caller has. Quote the numbers above, not those.
|
|
102
|
+
*
|
|
103
|
+
* **An empty `ops` is declined on purpose.** A *standalone* GPU reduction uploads
|
|
104
|
+
* n floats to produce one number — pure transfer tax, measured 3-9x SLOWER than a
|
|
105
|
+
* plain JS sum. There is no chain to amortise the upload against, so this returns
|
|
106
|
+
* `null` and lets the caller use the CPU, which is genuinely the faster path. The
|
|
107
|
+
* upload is only worth paying for when real work rides along with it.
|
|
108
|
+
*
|
|
109
|
+
* Same never-throw contract as {@link elementwiseChainGpuDispatch}: returns `null`
|
|
110
|
+
* — never rejects — whenever the GPU is unavailable, not opted into, the input is
|
|
111
|
+
* below `GPU_MIN_ELEMENTS`, an op has no kernel, or a device limit is exceeded.
|
|
112
|
+
*
|
|
113
|
+
* Precision: f32, like every GPU path here. For `sum` the tree reduction is
|
|
114
|
+
* pairwise, so its error grows O(log n) rather than the O(n) of a sequential
|
|
115
|
+
* accumulate — it is better-conditioned than the JS loop it replaces, even though
|
|
116
|
+
* it works in f32.
|
|
117
|
+
*/
|
|
118
|
+
export declare function elementwiseChainReduceGpuDispatch(ops: readonly string[], xs: Float64Array | Float32Array, reduce: GpuReduceOp, options?: GpuChainOptions): Promise<number | null>;
|
|
72
119
|
export {};
|
|
73
120
|
//# sourceMappingURL=elementwise-gpu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elementwise-gpu.d.ts","sourceRoot":"","sources":["../../src/gpu/elementwise-gpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AA+CnC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;CAgCR,CAAC;AAEX,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,YAAY,CAAC;AAEzD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"elementwise-gpu.d.ts","sourceRoot":"","sources":["../../src/gpu/elementwise-gpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,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,
|
|
25
25
|
GPU_ELEMENTWISE_OPS: () => GPU_ELEMENTWISE_OPS,
|
|
26
26
|
GPU_MIN_ELEMENTS: () => GPU_MIN_ELEMENTS2,
|
|
27
|
+
GPU_REDUCE_OPS: () => GPU_REDUCE_OPS,
|
|
27
28
|
WASM_INTERP_THRESHOLD: () => WASM_INTERP_THRESHOLD,
|
|
28
29
|
abs: () => abs,
|
|
29
30
|
acos: () => acos,
|
|
@@ -153,6 +154,7 @@ __export(typed_exports, {
|
|
|
153
154
|
eigenvectorCentrality: () => eigenvectorCentrality,
|
|
154
155
|
element: () => element,
|
|
155
156
|
elementwiseChainGpuDispatch: () => elementwiseChainGpuDispatch,
|
|
157
|
+
elementwiseChainReduceGpuDispatch: () => elementwiseChainReduceGpuDispatch,
|
|
156
158
|
eliminate: () => eliminate,
|
|
157
159
|
ellipticE: () => ellipticE,
|
|
158
160
|
ellipticEIncomplete: () => ellipticEIncomplete,
|
|
@@ -195,6 +197,7 @@ __export(typed_exports, {
|
|
|
195
197
|
functionExpand: () => functionExpand,
|
|
196
198
|
fuseUnaryChain: () => fuseUnaryChain,
|
|
197
199
|
fuseUnaryChainAsync: () => fuseUnaryChainAsync,
|
|
200
|
+
fuseUnaryChainReduceAsync: () => fuseUnaryChainReduceAsync,
|
|
198
201
|
gammaDist: () => gammaDist,
|
|
199
202
|
gammaPDF: () => gammaPDF,
|
|
200
203
|
gammainc: () => gammainc,
|
|
@@ -3197,6 +3200,63 @@ async function terminateStatistics() {
|
|
|
3197
3200
|
|
|
3198
3201
|
// src/typed/signal.ts
|
|
3199
3202
|
import { mathTyped as mathTyped5 } from "@danielsimonjr/mathts-core";
|
|
3203
|
+
|
|
3204
|
+
// src/signal/fft-core-f64.ts
|
|
3205
|
+
function bitReverse(x, bits) {
|
|
3206
|
+
let result = 0;
|
|
3207
|
+
for (let i = 0; i < bits; i++) {
|
|
3208
|
+
result = result << 1 | x & 1;
|
|
3209
|
+
x >>= 1;
|
|
3210
|
+
}
|
|
3211
|
+
return result;
|
|
3212
|
+
}
|
|
3213
|
+
function fftCoreFloat64(realIn, imagIn, inverse = false) {
|
|
3214
|
+
const n = realIn.length;
|
|
3215
|
+
const bits = Math.log2(n);
|
|
3216
|
+
const real = new Float64Array(n);
|
|
3217
|
+
const imag = new Float64Array(n);
|
|
3218
|
+
for (let i = 0; i < n; i++) {
|
|
3219
|
+
const j = bitReverse(i, bits);
|
|
3220
|
+
real[j] = realIn[i];
|
|
3221
|
+
imag[j] = imagIn[i];
|
|
3222
|
+
}
|
|
3223
|
+
const direction = inverse ? 1 : -1;
|
|
3224
|
+
for (let size2 = 2; size2 <= n; size2 *= 2) {
|
|
3225
|
+
const halfSize = size2 / 2;
|
|
3226
|
+
const angle = direction * 2 * Math.PI / size2;
|
|
3227
|
+
const wRe = Math.cos(angle);
|
|
3228
|
+
const wIm = Math.sin(angle);
|
|
3229
|
+
for (let start = 0; start < n; start += size2) {
|
|
3230
|
+
let tRe = 1;
|
|
3231
|
+
let tIm = 0;
|
|
3232
|
+
for (let j = 0; j < halfSize; j++) {
|
|
3233
|
+
const evenIdx = start + j;
|
|
3234
|
+
const oddIdx = start + j + halfSize;
|
|
3235
|
+
const uRe = real[oddIdx] * tRe - imag[oddIdx] * tIm;
|
|
3236
|
+
const uIm = real[oddIdx] * tIm + imag[oddIdx] * tRe;
|
|
3237
|
+
const eRe = real[evenIdx];
|
|
3238
|
+
const eIm = imag[evenIdx];
|
|
3239
|
+
real[evenIdx] = eRe + uRe;
|
|
3240
|
+
imag[evenIdx] = eIm + uIm;
|
|
3241
|
+
real[oddIdx] = eRe - uRe;
|
|
3242
|
+
imag[oddIdx] = eIm - uIm;
|
|
3243
|
+
const nextTRe = tRe * wRe - tIm * wIm;
|
|
3244
|
+
const nextTIm = tRe * wIm + tIm * wRe;
|
|
3245
|
+
tRe = nextTRe;
|
|
3246
|
+
tIm = nextTIm;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
if (inverse) {
|
|
3251
|
+
for (let i = 0; i < n; i++) {
|
|
3252
|
+
real[i] /= n;
|
|
3253
|
+
imag[i] /= n;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
return { real, imag };
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
// src/typed/signal.ts
|
|
3200
3260
|
import { computePool as computePool4 } from "@danielsimonjr/mathts-parallel";
|
|
3201
3261
|
|
|
3202
3262
|
// src/wasm/signal/wasm-bridge.ts
|
|
@@ -3529,59 +3589,6 @@ function nextPowerOf2(n) {
|
|
|
3529
3589
|
if (n <= 1) return 1;
|
|
3530
3590
|
return Math.pow(2, Math.ceil(Math.log2(n)));
|
|
3531
3591
|
}
|
|
3532
|
-
function bitReverse(x, bits) {
|
|
3533
|
-
let result = 0;
|
|
3534
|
-
for (let i = 0; i < bits; i++) {
|
|
3535
|
-
result = result << 1 | x & 1;
|
|
3536
|
-
x >>= 1;
|
|
3537
|
-
}
|
|
3538
|
-
return result;
|
|
3539
|
-
}
|
|
3540
|
-
function fftCoreFloat64(realIn, imagIn, inverse = false) {
|
|
3541
|
-
const n = realIn.length;
|
|
3542
|
-
const bits = Math.log2(n);
|
|
3543
|
-
const real = new Float64Array(n);
|
|
3544
|
-
const imag = new Float64Array(n);
|
|
3545
|
-
for (let i = 0; i < n; i++) {
|
|
3546
|
-
const j = bitReverse(i, bits);
|
|
3547
|
-
real[j] = realIn[i];
|
|
3548
|
-
imag[j] = imagIn[i];
|
|
3549
|
-
}
|
|
3550
|
-
const direction = inverse ? 1 : -1;
|
|
3551
|
-
for (let size2 = 2; size2 <= n; size2 *= 2) {
|
|
3552
|
-
const halfSize = size2 / 2;
|
|
3553
|
-
const angle = direction * 2 * Math.PI / size2;
|
|
3554
|
-
const wRe = Math.cos(angle);
|
|
3555
|
-
const wIm = Math.sin(angle);
|
|
3556
|
-
for (let start = 0; start < n; start += size2) {
|
|
3557
|
-
let tRe = 1;
|
|
3558
|
-
let tIm = 0;
|
|
3559
|
-
for (let j = 0; j < halfSize; j++) {
|
|
3560
|
-
const evenIdx = start + j;
|
|
3561
|
-
const oddIdx = start + j + halfSize;
|
|
3562
|
-
const uRe = real[oddIdx] * tRe - imag[oddIdx] * tIm;
|
|
3563
|
-
const uIm = real[oddIdx] * tIm + imag[oddIdx] * tRe;
|
|
3564
|
-
const eRe = real[evenIdx];
|
|
3565
|
-
const eIm = imag[evenIdx];
|
|
3566
|
-
real[evenIdx] = eRe + uRe;
|
|
3567
|
-
imag[evenIdx] = eIm + uIm;
|
|
3568
|
-
real[oddIdx] = eRe - uRe;
|
|
3569
|
-
imag[oddIdx] = eIm - uIm;
|
|
3570
|
-
const nextTRe = tRe * wRe - tIm * wIm;
|
|
3571
|
-
const nextTIm = tRe * wIm + tIm * wRe;
|
|
3572
|
-
tRe = nextTRe;
|
|
3573
|
-
tIm = nextTIm;
|
|
3574
|
-
}
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
if (inverse) {
|
|
3578
|
-
for (let i = 0; i < n; i++) {
|
|
3579
|
-
real[i] /= n;
|
|
3580
|
-
imag[i] /= n;
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
return { real, imag };
|
|
3584
|
-
}
|
|
3585
3592
|
async function fourStepFFT(real, imag, inverse) {
|
|
3586
3593
|
const N = real.length;
|
|
3587
3594
|
if (N < 4 || !isPowerOf2(N)) {
|
|
@@ -7413,7 +7420,9 @@ var WGSL_OP_BODY = {
|
|
|
7413
7420
|
// An f32 fast path may be less precise. It may not be WRONG. Chains containing
|
|
7414
7421
|
// these fall back to the exact WASM/JS tiers.
|
|
7415
7422
|
};
|
|
7416
|
-
var GPU_ELEMENTWISE_OPS = Object.keys(
|
|
7423
|
+
var GPU_ELEMENTWISE_OPS = Object.keys(
|
|
7424
|
+
WGSL_OP_BODY
|
|
7425
|
+
);
|
|
7417
7426
|
function isGpuChainSupported(ops) {
|
|
7418
7427
|
return ops.every((op) => op in WGSL_OP_BODY);
|
|
7419
7428
|
}
|
|
@@ -7438,6 +7447,48 @@ function wgslFor(op) {
|
|
|
7438
7447
|
}
|
|
7439
7448
|
`;
|
|
7440
7449
|
}
|
|
7450
|
+
var GPU_REDUCE_OPS = ["sum", "max", "min"];
|
|
7451
|
+
var reduceKey = (r) => `reduce:${r}`;
|
|
7452
|
+
var WGSL_REDUCE = {
|
|
7453
|
+
sum: { identity: "0.0", combine: "a + b" },
|
|
7454
|
+
max: { identity: "neg_inf()", combine: "max(a, b)" },
|
|
7455
|
+
min: { identity: "pos_inf()", combine: "min(a, b)" }
|
|
7456
|
+
};
|
|
7457
|
+
function wgslForReduce(r) {
|
|
7458
|
+
const { identity: identity2, combine: combine2 } = WGSL_REDUCE[r];
|
|
7459
|
+
return `
|
|
7460
|
+
@group(0) @binding(0) var<storage, read> inp: array<f32>;
|
|
7461
|
+
@group(0) @binding(1) var<storage, read_write> partials: array<f32>;
|
|
7462
|
+
@group(0) @binding(2) var<uniform> params: vec4<u32>; // n, nanBits, +infBits, -infBits
|
|
7463
|
+
|
|
7464
|
+
${WGSL_IEEE}
|
|
7465
|
+
|
|
7466
|
+
// NOTE: "shared" is a RESERVED WORD in WGSL \u2014 this must not be named that.
|
|
7467
|
+
var<workgroup> sdata: array<f32, ${WORKGROUP_SIZE}>;
|
|
7468
|
+
|
|
7469
|
+
fn identity() -> f32 { return ${identity2}; }
|
|
7470
|
+
fn combine(a: f32, b: f32) -> f32 { return ${combine2}; }
|
|
7471
|
+
|
|
7472
|
+
@compute @workgroup_size(${WORKGROUP_SIZE})
|
|
7473
|
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>,
|
|
7474
|
+
@builtin(local_invocation_id) lid: vec3<u32>,
|
|
7475
|
+
@builtin(workgroup_id) wid: vec3<u32>) {
|
|
7476
|
+
var v: f32 = identity();
|
|
7477
|
+
if (gid.x < params.x) { v = inp[gid.x]; }
|
|
7478
|
+
sdata[lid.x] = v;
|
|
7479
|
+
workgroupBarrier();
|
|
7480
|
+
|
|
7481
|
+
var s: u32 = ${WORKGROUP_SIZE}u / 2u;
|
|
7482
|
+
loop {
|
|
7483
|
+
if (s == 0u) { break; }
|
|
7484
|
+
if (lid.x < s) { sdata[lid.x] = combine(sdata[lid.x], sdata[lid.x + s]); }
|
|
7485
|
+
workgroupBarrier();
|
|
7486
|
+
s = s >> 1u;
|
|
7487
|
+
}
|
|
7488
|
+
if (lid.x == 0u) { partials[wid.x] = sdata[0]; }
|
|
7489
|
+
}
|
|
7490
|
+
`;
|
|
7491
|
+
}
|
|
7441
7492
|
var resources = null;
|
|
7442
7493
|
async function getResources(options) {
|
|
7443
7494
|
const device = await getGpuDevice(options);
|
|
@@ -7448,6 +7499,9 @@ async function getResources(options) {
|
|
|
7448
7499
|
for (const op of GPU_ELEMENTWISE_OPS) {
|
|
7449
7500
|
shaders.registerShader(op, wgslFor(op));
|
|
7450
7501
|
}
|
|
7502
|
+
for (const r of GPU_REDUCE_OPS) {
|
|
7503
|
+
shaders.registerShader(reduceKey(r), wgslForReduce(r));
|
|
7504
|
+
}
|
|
7451
7505
|
shaders.precompileRegistered();
|
|
7452
7506
|
resources = { device, shaders, pool: new BufferPool(ctx) };
|
|
7453
7507
|
return resources;
|
|
@@ -7456,7 +7510,16 @@ function resetGpuElementwise() {
|
|
|
7456
7510
|
resources?.pool.destroy();
|
|
7457
7511
|
resources = null;
|
|
7458
7512
|
}
|
|
7459
|
-
|
|
7513
|
+
var gpuQueue = Promise.resolve();
|
|
7514
|
+
function serializeGpu(run) {
|
|
7515
|
+
const next = gpuQueue.then(run, run);
|
|
7516
|
+
gpuQueue = next.catch(() => void 0);
|
|
7517
|
+
return next;
|
|
7518
|
+
}
|
|
7519
|
+
function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
7520
|
+
return serializeGpu(() => chainGpuDispatchImpl(ops, xs, options));
|
|
7521
|
+
}
|
|
7522
|
+
async function chainGpuDispatchImpl(ops, xs, options) {
|
|
7460
7523
|
const n = xs.length;
|
|
7461
7524
|
const enabled = options?.gpu ?? isGpuEnabled();
|
|
7462
7525
|
if (!enabled) return null;
|
|
@@ -7470,6 +7533,7 @@ async function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
|
7470
7533
|
let bufB;
|
|
7471
7534
|
let staging;
|
|
7472
7535
|
let params;
|
|
7536
|
+
let scopePushed = false;
|
|
7473
7537
|
let scopePopped = false;
|
|
7474
7538
|
try {
|
|
7475
7539
|
const r = await getResources(options);
|
|
@@ -7482,6 +7546,7 @@ async function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
|
7482
7546
|
if (bytes > limits.maxBufferSize) return null;
|
|
7483
7547
|
const input = xs instanceof Float32Array ? xs : new Float32Array(xs);
|
|
7484
7548
|
device.pushErrorScope("validation");
|
|
7549
|
+
scopePushed = true;
|
|
7485
7550
|
bufA = pool.acquireStorageBuffer(bytes, "chain-a", true, true);
|
|
7486
7551
|
bufB = pool.acquireStorageBuffer(bytes, "chain-b", true, true);
|
|
7487
7552
|
staging = pool.acquireStagingBuffer(bytes, "chain-staging");
|
|
@@ -7520,7 +7585,7 @@ async function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
|
7520
7585
|
} catch {
|
|
7521
7586
|
return null;
|
|
7522
7587
|
} finally {
|
|
7523
|
-
if (res && !scopePopped) {
|
|
7588
|
+
if (res && scopePushed && !scopePopped) {
|
|
7524
7589
|
try {
|
|
7525
7590
|
await res.device.popErrorScope();
|
|
7526
7591
|
} catch {
|
|
@@ -7534,6 +7599,120 @@ async function elementwiseChainGpuDispatch(ops, xs, options) {
|
|
|
7534
7599
|
}
|
|
7535
7600
|
}
|
|
7536
7601
|
}
|
|
7602
|
+
function elementwiseChainReduceGpuDispatch(ops, xs, reduce3, options) {
|
|
7603
|
+
return serializeGpu(() => chainReduceGpuDispatchImpl(ops, xs, reduce3, options));
|
|
7604
|
+
}
|
|
7605
|
+
async function chainReduceGpuDispatchImpl(ops, xs, reduce3, options) {
|
|
7606
|
+
const n = xs.length;
|
|
7607
|
+
const enabled = options?.gpu ?? isGpuEnabled();
|
|
7608
|
+
if (!enabled) return null;
|
|
7609
|
+
if (ops.length === 0) return null;
|
|
7610
|
+
if (n < GPU_MIN_ELEMENTS) return null;
|
|
7611
|
+
if (!isGpuChainSupported(ops)) return null;
|
|
7612
|
+
if (!GPU_REDUCE_OPS.includes(reduce3)) return null;
|
|
7613
|
+
const bytes = n * 4;
|
|
7614
|
+
const workgroups = Math.ceil(n / WORKGROUP_SIZE);
|
|
7615
|
+
const partialBytes = workgroups * 4;
|
|
7616
|
+
let res;
|
|
7617
|
+
let bufA;
|
|
7618
|
+
let bufB;
|
|
7619
|
+
let partials;
|
|
7620
|
+
let staging;
|
|
7621
|
+
let params;
|
|
7622
|
+
let scopePushed = false;
|
|
7623
|
+
let scopePopped = false;
|
|
7624
|
+
try {
|
|
7625
|
+
const r = await getResources(options);
|
|
7626
|
+
if (!r) return null;
|
|
7627
|
+
res = r;
|
|
7628
|
+
const { device, shaders, pool } = r;
|
|
7629
|
+
const limits = device.limits;
|
|
7630
|
+
if (workgroups > limits.maxComputeWorkgroupsPerDimension) return null;
|
|
7631
|
+
if (bytes > limits.maxStorageBufferBindingSize) return null;
|
|
7632
|
+
if (bytes > limits.maxBufferSize) return null;
|
|
7633
|
+
const input = xs instanceof Float32Array ? xs : new Float32Array(xs);
|
|
7634
|
+
device.pushErrorScope("validation");
|
|
7635
|
+
scopePushed = true;
|
|
7636
|
+
bufA = pool.acquireStorageBuffer(bytes, "chain-a", true, true);
|
|
7637
|
+
bufB = pool.acquireStorageBuffer(bytes, "chain-b", true, true);
|
|
7638
|
+
partials = pool.acquireStorageBuffer(partialBytes, "reduce-partials", true, true);
|
|
7639
|
+
staging = pool.acquireStagingBuffer(partialBytes, "reduce-staging");
|
|
7640
|
+
params = pool.acquireUniformBuffer(16, "chain-params");
|
|
7641
|
+
device.queue.writeBuffer(bufA, 0, input);
|
|
7642
|
+
device.queue.writeBuffer(params, 0, new Uint32Array([n, 2143289344, 2139095040, 4286578688]));
|
|
7643
|
+
const encoder = device.createCommandEncoder({ label: "elementwise-chain-reduce" });
|
|
7644
|
+
let src = bufA;
|
|
7645
|
+
let dst2 = bufB;
|
|
7646
|
+
for (const op of ops) {
|
|
7647
|
+
const pipeline = shaders.getRegisteredPipeline(op);
|
|
7648
|
+
const bindGroup = device.createBindGroup({
|
|
7649
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
7650
|
+
entries: [
|
|
7651
|
+
{ binding: 0, resource: { buffer: src } },
|
|
7652
|
+
{ binding: 1, resource: { buffer: dst2 } },
|
|
7653
|
+
{ binding: 2, resource: { buffer: params } }
|
|
7654
|
+
]
|
|
7655
|
+
});
|
|
7656
|
+
const pass = encoder.beginComputePass({ label: `chain:${op}` });
|
|
7657
|
+
pass.setPipeline(pipeline);
|
|
7658
|
+
pass.setBindGroup(0, bindGroup);
|
|
7659
|
+
pass.dispatchWorkgroups(workgroups);
|
|
7660
|
+
pass.end();
|
|
7661
|
+
[src, dst2] = [dst2, src];
|
|
7662
|
+
}
|
|
7663
|
+
const reducePipeline = shaders.getRegisteredPipeline(reduceKey(reduce3));
|
|
7664
|
+
const reduceBind = device.createBindGroup({
|
|
7665
|
+
layout: reducePipeline.getBindGroupLayout(0),
|
|
7666
|
+
entries: [
|
|
7667
|
+
{ binding: 0, resource: { buffer: src } },
|
|
7668
|
+
{ binding: 1, resource: { buffer: partials } },
|
|
7669
|
+
{ binding: 2, resource: { buffer: params } }
|
|
7670
|
+
]
|
|
7671
|
+
});
|
|
7672
|
+
const reducePass = encoder.beginComputePass({ label: `reduce:${reduce3}` });
|
|
7673
|
+
reducePass.setPipeline(reducePipeline);
|
|
7674
|
+
reducePass.setBindGroup(0, reduceBind);
|
|
7675
|
+
reducePass.dispatchWorkgroups(workgroups);
|
|
7676
|
+
reducePass.end();
|
|
7677
|
+
encoder.copyBufferToBuffer(partials, 0, staging, 0, partialBytes);
|
|
7678
|
+
device.queue.submit([encoder.finish()]);
|
|
7679
|
+
const validationError = await device.popErrorScope();
|
|
7680
|
+
scopePopped = true;
|
|
7681
|
+
if (validationError) return null;
|
|
7682
|
+
await staging.mapAsync(GPUMapMode.READ, 0, partialBytes);
|
|
7683
|
+
const parts = new Float32Array(staging.getMappedRange(0, partialBytes).slice(0));
|
|
7684
|
+
staging.unmap();
|
|
7685
|
+
return foldPartials(parts, reduce3);
|
|
7686
|
+
} catch {
|
|
7687
|
+
return null;
|
|
7688
|
+
} finally {
|
|
7689
|
+
if (res && scopePushed && !scopePopped) {
|
|
7690
|
+
try {
|
|
7691
|
+
await res.device.popErrorScope();
|
|
7692
|
+
} catch {
|
|
7693
|
+
}
|
|
7694
|
+
}
|
|
7695
|
+
if (res) {
|
|
7696
|
+
if (bufA) res.pool.release(bufA);
|
|
7697
|
+
if (bufB) res.pool.release(bufB);
|
|
7698
|
+
if (partials) res.pool.release(partials);
|
|
7699
|
+
if (staging) res.pool.release(staging);
|
|
7700
|
+
if (params) res.pool.release(params);
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
function foldPartials(parts, reduce3) {
|
|
7705
|
+
if (reduce3 === "sum") {
|
|
7706
|
+
let acc2 = 0;
|
|
7707
|
+
for (let i = 0; i < parts.length; i++) acc2 += parts[i];
|
|
7708
|
+
return acc2;
|
|
7709
|
+
}
|
|
7710
|
+
let acc = reduce3 === "max" ? -Infinity : Infinity;
|
|
7711
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7712
|
+
acc = reduce3 === "max" ? Math.max(acc, parts[i]) : Math.min(acc, parts[i]);
|
|
7713
|
+
}
|
|
7714
|
+
return acc;
|
|
7715
|
+
}
|
|
7537
7716
|
|
|
7538
7717
|
// src/typed/fused.ts
|
|
7539
7718
|
var SCALAR = {
|
|
@@ -7576,6 +7755,24 @@ async function fuseUnaryChainAsync(ops, xs, options) {
|
|
|
7576
7755
|
if (wasm) return wasm;
|
|
7577
7756
|
return jsChain(ops, xs);
|
|
7578
7757
|
}
|
|
7758
|
+
async function fuseUnaryChainReduceAsync(ops, xs, reduce3, options) {
|
|
7759
|
+
const gpu = await elementwiseChainReduceGpuDispatch(ops, xs, reduce3, options);
|
|
7760
|
+
if (gpu !== null) return gpu;
|
|
7761
|
+
const chained = elementwiseChainDispatch(ops, xs) ?? jsChain(ops, xs);
|
|
7762
|
+
return reduceF64(chained, reduce3);
|
|
7763
|
+
}
|
|
7764
|
+
function reduceF64(xs, reduce3) {
|
|
7765
|
+
if (reduce3 === "sum") {
|
|
7766
|
+
let acc2 = 0;
|
|
7767
|
+
for (let i = 0; i < xs.length; i++) acc2 += xs[i];
|
|
7768
|
+
return acc2;
|
|
7769
|
+
}
|
|
7770
|
+
let acc = reduce3 === "max" ? -Infinity : Infinity;
|
|
7771
|
+
for (let i = 0; i < xs.length; i++) {
|
|
7772
|
+
acc = reduce3 === "max" ? Math.max(acc, xs[i]) : Math.min(acc, xs[i]);
|
|
7773
|
+
}
|
|
7774
|
+
return acc;
|
|
7775
|
+
}
|
|
7579
7776
|
|
|
7580
7777
|
// src/typed/distributions.ts
|
|
7581
7778
|
import { mathTyped as mathTyped11 } from "@danielsimonjr/mathts-core";
|
|
@@ -44940,6 +45137,7 @@ export {
|
|
|
44940
45137
|
GAUSS_WORKER_THRESHOLD,
|
|
44941
45138
|
GPU_ELEMENTWISE_OPS,
|
|
44942
45139
|
GPU_MIN_ELEMENTS2 as GPU_MIN_ELEMENTS,
|
|
45140
|
+
GPU_REDUCE_OPS,
|
|
44943
45141
|
WASM_INTERP_THRESHOLD,
|
|
44944
45142
|
abs,
|
|
44945
45143
|
acf,
|
|
@@ -45157,6 +45355,7 @@ export {
|
|
|
45157
45355
|
element,
|
|
45158
45356
|
elementaryCharge,
|
|
45159
45357
|
elementwiseChainGpuDispatch,
|
|
45358
|
+
elementwiseChainReduceGpuDispatch,
|
|
45160
45359
|
eliminate,
|
|
45161
45360
|
ellipticE,
|
|
45162
45361
|
ellipticEIncomplete,
|
|
@@ -45285,6 +45484,7 @@ export {
|
|
|
45285
45484
|
functionExpand,
|
|
45286
45485
|
fuseUnaryChain,
|
|
45287
45486
|
fuseUnaryChainAsync,
|
|
45487
|
+
fuseUnaryChainReduceAsync,
|
|
45288
45488
|
gamma,
|
|
45289
45489
|
gammaCDF,
|
|
45290
45490
|
gammaDist,
|
package/dist/matrix/fft.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fft.d.ts","sourceRoot":"","sources":["../../src/matrix/fft.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"fft.d.ts","sourceRoot":"","sources":["../../src/matrix/fft.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA2E/D,KAAK,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC;AAIzD,wDAAwD;AACxD,KAAK,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAEhD,UAAU,MAAM;IACd,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,GAAG,QAAQ,CAAC;IAC9B,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,WAAW,IAAI,MAAM,CAAC;IACtB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnD,OAAO,IAAI,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC;CACpC;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC;IAClE,SAAS,EAAE,QAAQ,CAAC;IACpB,cAAc,EAAE,QAAQ,CAAC;IACzB,YAAY,EAAE,QAAQ,CAAC;IACvB,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/C;AA4BD,eAAO,MAAM,SAAS,sEA0MrB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE radix-2 Cooley-Tukey core for this package, on flat Float64Arrays.
|
|
3
|
+
*
|
|
4
|
+
* There used to be two. This flat one (used by `parallelFFT`), and a second inside
|
|
5
|
+
* `signal/fft.ts` that did the butterfly arithmetic in Complex OBJECTS — a `{ re, im }`
|
|
6
|
+
* allocation per twiddle step and per butterfly. Same transform, same machine:
|
|
7
|
+
*
|
|
8
|
+
* | n | flat Float64Array core | Complex-object core |
|
|
9
|
+
* | --------- | ---------------------- | ------------------- |
|
|
10
|
+
* | 262,144 | 80 ms | 607 ms |
|
|
11
|
+
* | 1,048,576 | 358 ms | 2987 ms |
|
|
12
|
+
*
|
|
13
|
+
* The public `fft()` used the SLOW one, so the FFT every consumer reaches by default was
|
|
14
|
+
* ~8x slower than the library's own fast path. Its `ComplexNumber[]` return type was not
|
|
15
|
+
* the cause: materialising the objects once at the boundary is cheap — doing the
|
|
16
|
+
* ARITHMETIC in them is what cost 8x. Both surfaces now share this core and box at the
|
|
17
|
+
* edge.
|
|
18
|
+
*
|
|
19
|
+
* Internal. Not part of the public API.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
/** 32-bit int / 64-bit float aliases, matching the annotations used across `signal/`. */
|
|
24
|
+
type i32 = number;
|
|
25
|
+
/**
|
|
26
|
+
* Bit reverse for FFT
|
|
27
|
+
*/
|
|
28
|
+
export declare function bitReverse(x: i32, bits: i32): i32;
|
|
29
|
+
/**
|
|
30
|
+
* Radix-2 FFT core using Float64Array for WASM compatibility
|
|
31
|
+
*/
|
|
32
|
+
export declare function fftCoreFloat64(realIn: Float64Array, imagIn: Float64Array, inverse?: boolean): {
|
|
33
|
+
real: Float64Array;
|
|
34
|
+
imag: Float64Array;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=fft-core-f64.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fft-core-f64.d.ts","sourceRoot":"","sources":["../../src/signal/fft-core-f64.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,yFAAyF;AACzF,KAAK,GAAG,GAAG,MAAM,CAAC;AAGlB;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAOjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,OAAe,GACvB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CA8D5C"}
|
package/dist/typed/fused.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* array is below threshold, so the result is always correct.
|
|
14
14
|
*/
|
|
15
15
|
import { type WasmElementwiseOp } from '../wasm/elementwise/wasm-bridge.js';
|
|
16
|
-
import { type GpuChainOptions } from '../gpu/elementwise-gpu.js';
|
|
16
|
+
import { type GpuChainOptions, type GpuReduceOp } from '../gpu/elementwise-gpu.js';
|
|
17
17
|
/**
|
|
18
18
|
* Apply `ops` left-to-right over `xs` (i.e. `ops[last](…ops[0](x))`), fused in
|
|
19
19
|
* WASM when possible. Returns a new `Float64Array`; never mutates `xs`.
|
|
@@ -83,4 +83,25 @@ export declare function fuseUnaryChain(ops: WasmElementwiseOp[], xs: Float64Arra
|
|
|
83
83
|
* `elementwiseChainGpuDispatch` directly — it is exported for exactly that.
|
|
84
84
|
*/
|
|
85
85
|
export declare function fuseUnaryChainAsync(ops: WasmElementwiseOp[], xs: Float64Array, options?: GpuChainOptions): Promise<Float64Array>;
|
|
86
|
+
/**
|
|
87
|
+
* Apply `ops` and then reduce to a single number — `sum(exp(sin(x)))` and friends.
|
|
88
|
+
*
|
|
89
|
+
* Tiers: **GPU (f32, opt-in) → WASM chain + JS reduce → JS chain + JS reduce.**
|
|
90
|
+
*
|
|
91
|
+
* When the GPU tier runs, the reduction happens **on the device**, so only n/256
|
|
92
|
+
* floats cross the bus instead of n. That is the whole reason this function exists.
|
|
93
|
+
* Measured end-to-end for `sum(exp(sin(x)))` on an NVIDIA Pascal adapter: **1.35-1.7x**
|
|
94
|
+
* faster than `fuseUnaryChainAsync(...)` followed by a JS loop, and **2.6-3.8x** faster
|
|
95
|
+
* than the CPU tier. (See `elementwiseChainReduceGpuDispatch` for the full table and
|
|
96
|
+
* for why the ratio shrinks as n grows.)
|
|
97
|
+
*
|
|
98
|
+
* Reach for it only when you want the **scalar**. If you also need the transformed
|
|
99
|
+
* array, use `fuseUnaryChainAsync` — you have to pay the n-float readback anyway, and
|
|
100
|
+
* summing it in JS afterwards costs almost nothing on top.
|
|
101
|
+
*
|
|
102
|
+
* Precision follows the tier that ran: f32 (~7 significant digits) on the GPU, exact
|
|
103
|
+
* f64 on WASM/JS. `enableGpu()` is the consent; with the flag off this is a pure f64
|
|
104
|
+
* computation.
|
|
105
|
+
*/
|
|
106
|
+
export declare function fuseUnaryChainReduceAsync(ops: WasmElementwiseOp[], xs: Float64Array, reduce: GpuReduceOp, options?: GpuChainOptions): Promise<number>;
|
|
86
107
|
//# sourceMappingURL=fused.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fused.d.ts","sourceRoot":"","sources":["../../src/typed/fused.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"fused.d.ts","sourceRoot":"","sources":["../../src/typed/fused.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,2BAA2B,CAAC;AAyBnC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,YAAY,CAIvF;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,iBAAiB,EAAE,EACxB,EAAE,EAAE,YAAY,EAChB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,YAAY,CAAC,CAgBvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,iBAAiB,EAAE,EACxB,EAAE,EAAE,YAAY,EAChB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAQjB"}
|
package/dist/typed/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export * from './matrix-ops.js';
|
|
|
47
47
|
export { cond } from './matrix-ops.js';
|
|
48
48
|
export * from './gpu.js';
|
|
49
49
|
export { enableGpu, disableGpu, isGpuEnabled, GPU_MIN_ELEMENTS } from '@danielsimonjr/mathts-gpu';
|
|
50
|
-
export { elementwiseChainGpuDispatch, isGpuChainSupported, resetGpuElementwise, GPU_ELEMENTWISE_OPS, type GpuElementwiseOp, type GpuChainOptions, } from '../gpu/elementwise-gpu.js';
|
|
50
|
+
export { elementwiseChainGpuDispatch, elementwiseChainReduceGpuDispatch, GPU_REDUCE_OPS, type GpuReduceOp, isGpuChainSupported, resetGpuElementwise, GPU_ELEMENTWISE_OPS, type GpuElementwiseOp, type GpuChainOptions, } from '../gpu/elementwise-gpu.js';
|
|
51
51
|
export * from './relational.js';
|
|
52
52
|
export { typedRelational } from './relational.js';
|
|
53
53
|
export * from './string.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CA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;;;;;;;;;;;;;CA8B1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/typed/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/typed/signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,EACL,mBAAmB,EAOpB,MAAM,+BAA+B,CAAC;AAWvC,0CAA0C;AAC1C,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,4BAA4B;AAC5B,KAAK,GAAG,GAAG,MAAM,CAAC;AAgJlB;;;;GAIG;AACH,eAAO,MAAM,WAAW,wCAqCtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY,wCAcvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,wCAwB/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,wCAoB3B,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,YAAY,wCAmEvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,wCAaxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,wCAQ3B,CAAC;AAMH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAoBnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAErD;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,CAAC,EAAE,MAAM,EAAE,GACX;IAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,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AAW,EAAE,MAAM,CAAA;CAAE,CAS/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAC/B,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,CAAC,EAAE,GAAG,CAAA;CAAE,GAC7B;IAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAwC1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,GAAG,GAAG,CAG/F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAC/B,CAAC,EAAE,GAAG,EACN,QAAQ,GAAE,GAAO,EACjB,OAAO,GAAE,GAA2E,GACnF;IAAE,EAAE,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,YAAY,CAAA;CAAE,CAUxC;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCvB,CAAC;AAEF;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEtD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAErD"}
|
package/package.json
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
|
-
"author": "Daniel Simon Jr.",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./dist/index.js",
|
|
9
|
-
"module": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist",
|
|
19
|
-
"types",
|
|
20
|
-
"README.md"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.dts.json && node scripts/copy-wasm.mjs",
|
|
24
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
25
|
-
"test": "vitest run",
|
|
26
|
-
"test:diff": "node tests/diff-special.test.mjs && node tests/diff-elementwise.test.mjs && node tests/diff-fusion.test.mjs",
|
|
27
|
-
"golden:gen": "python -X utf8 tests/golden/gen_special_goldens.py",
|
|
28
|
-
"test:watch": "vitest",
|
|
29
|
-
"test:coverage": "vitest run --coverage",
|
|
30
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
-
"lint": "eslint src --ext .ts",
|
|
32
|
-
"lint:fix": "eslint src --ext .ts --fix",
|
|
33
|
-
"clean": "rm -rf dist",
|
|
34
|
-
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@danielsimonjr/mathts-core": "^0.6.0",
|
|
38
|
-
"@danielsimonjr/mathts-expression": "^0.6.0",
|
|
39
|
-
"@danielsimonjr/mathts-gpu": "^0.1.1",
|
|
40
|
-
"@danielsimonjr/mathts-matrix": "^0.4.0",
|
|
41
|
-
"@danielsimonjr/mathts-parallel": "^0.3.4",
|
|
42
|
-
"bignumber.js": "^9.1.2",
|
|
43
|
-
"complex.js": "^2.2.5",
|
|
44
|
-
"decimal.js": "^10.4.3",
|
|
45
|
-
"escape-latex": "^1.2.0",
|
|
46
|
-
"fraction.js": "^5.2.1",
|
|
47
|
-
"javascript-natural-sort": "^0.7.1",
|
|
48
|
-
"seedrandom": "^3.0.5",
|
|
49
|
-
"tiny-emitter": "^2.1.0",
|
|
50
|
-
"typed-function": "github:danielsimonjr/typed-function"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@types/node": "^25.5.2",
|
|
54
|
-
"@webgpu/types": "^0.1.67",
|
|
55
|
-
"tsup": "^8.0.0",
|
|
56
|
-
"typescript": "^5.3.0",
|
|
57
|
-
"vitest": "^4.1.5"
|
|
58
|
-
},
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"access": "public"
|
|
61
|
-
},
|
|
62
|
-
"repository": {
|
|
63
|
-
"type": "git",
|
|
64
|
-
"url": "https://github.com/danielsimonjr/mathts",
|
|
65
|
-
"directory": "functions"
|
|
66
|
-
},
|
|
67
|
-
"keywords": [
|
|
68
|
-
"math",
|
|
69
|
-
"typescript",
|
|
70
|
-
"functions",
|
|
71
|
-
"arithmetic",
|
|
72
|
-
"algebra",
|
|
73
|
-
"trigonometry",
|
|
74
|
-
"statistics"
|
|
75
|
-
]
|
|
76
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
+
"version": "0.20.1",
|
|
4
|
+
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
|
+
"author": "Daniel Simon Jr.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"types",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.dts.json && node scripts/copy-wasm.mjs",
|
|
24
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:diff": "node tests/diff-special.test.mjs && node tests/diff-elementwise.test.mjs && node tests/diff-fusion.test.mjs",
|
|
27
|
+
"golden:gen": "python -X utf8 tests/golden/gen_special_goldens.py",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"lint": "eslint src --ext .ts",
|
|
32
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@danielsimonjr/mathts-core": "^0.6.0",
|
|
38
|
+
"@danielsimonjr/mathts-expression": "^0.6.0",
|
|
39
|
+
"@danielsimonjr/mathts-gpu": "^0.1.1",
|
|
40
|
+
"@danielsimonjr/mathts-matrix": "^0.4.0",
|
|
41
|
+
"@danielsimonjr/mathts-parallel": "^0.3.4",
|
|
42
|
+
"bignumber.js": "^9.1.2",
|
|
43
|
+
"complex.js": "^2.2.5",
|
|
44
|
+
"decimal.js": "^10.4.3",
|
|
45
|
+
"escape-latex": "^1.2.0",
|
|
46
|
+
"fraction.js": "^5.2.1",
|
|
47
|
+
"javascript-natural-sort": "^0.7.1",
|
|
48
|
+
"seedrandom": "^3.0.5",
|
|
49
|
+
"tiny-emitter": "^2.1.0",
|
|
50
|
+
"typed-function": "github:danielsimonjr/typed-function"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^25.5.2",
|
|
54
|
+
"@webgpu/types": "^0.1.67",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"typescript": "^5.3.0",
|
|
57
|
+
"vitest": "^4.1.5"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "https://github.com/danielsimonjr/mathts",
|
|
65
|
+
"directory": "functions"
|
|
66
|
+
},
|
|
67
|
+
"keywords": [
|
|
68
|
+
"math",
|
|
69
|
+
"typescript",
|
|
70
|
+
"functions",
|
|
71
|
+
"arithmetic",
|
|
72
|
+
"algebra",
|
|
73
|
+
"trigonometry",
|
|
74
|
+
"statistics"
|
|
75
|
+
]
|
|
76
|
+
}
|