spear-kernels 1.10.2 → 1.10.3

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.
Files changed (4) hide show
  1. package/README.md +55 -55
  2. package/index.cjs +16 -9
  3. package/index.js +16 -9
  4. package/package.json +26 -26
package/README.md CHANGED
@@ -1,55 +1,55 @@
1
- # spear-kernels
2
-
3
- Every closed-form kernel discovered by the [SPEAR](https://github.com/) symbolic
4
- regression engine, published as a zero-dependency, fully self-contained package.
5
- Each kernel ships four interchangeable backends plus metadata:
6
-
7
- | Field | What it is |
8
- |---|---|
9
- | `precise.js` / `precise.eval` | standalone JS arrow-function (source string / compiled) |
10
- | `precise.c` | CUDA C `__device__` source |
11
- | `precise.py` | PyTorch source |
12
- | `precise.wasmBase64` | compiled f64 WebAssembly module |
13
- | `fast` | algebraic-only variant when one was discovered |
14
- | `meta` | `metric`, `level`, `formulaCost`, `exactCost`, `speedupVsExact`, `vsIterative` |
15
-
16
- ## Usage
17
-
18
- ```js
19
- import { kernels, kernelIds } from "spear-kernels";
20
-
21
- kernelIds; // list of all kernel ids
22
-
23
- kernels.silu.precise.eval(2); // ~1.762 (SiLU approximant)
24
-
25
- if (kernels.sigmoid.fast) {
26
- kernels.sigmoid.fast.eval(3); // algebraic fast path
27
- }
28
-
29
- kernels.gaussian_cdf.meta.speedupVsExact; // metadata access
30
- ```
31
-
32
- ### WebAssembly backend
33
-
34
- ```js
35
- const bytes = Uint8Array.from(atob(kernels.silu.precise.wasmBase64), (c) => c.charCodeAt(0));
36
- const env = {
37
- exp: Math.exp, sin: Math.sin, cos: Math.cos, atan: Math.atan,
38
- log: (v) => Math.log(v > 1e-30 ? v : 1e-30),
39
- };
40
- const { instance } = await WebAssembly.instantiate(bytes, { env });
41
- instance.exports.spear(2); // same protected-division semantics as the JS backend
42
- ```
43
-
44
- Division is **protected** exactly like the engine: denominators floored at
45
- ±1e-4 (sign-preserving), results clamped to ±1e4. Discovered formulas rely on
46
- these rails — do not swap in bare `/`.
47
-
48
- ## Support
49
-
50
- If SPEAR kernels save you compute time, consider tipping the lab:
51
-
52
- ₿ **bc1q6zmudp0ju8rg29jycgzmc8ev2zarejaejnntnd**
53
-
54
- `npm fund` also surfaces this address (declared in the `funding` field).
55
- Every satoshi goes back into GPU time for the evolution farm.
1
+ # spear-kernels
2
+
3
+ Every closed-form kernel discovered by the [SPEAR](https://github.com/) symbolic
4
+ regression engine, published as a zero-dependency, fully self-contained package.
5
+ Each kernel ships four interchangeable backends plus metadata:
6
+
7
+ | Field | What it is |
8
+ |---|---|
9
+ | `precise.js` / `precise.eval` | standalone JS arrow-function (source string / compiled) |
10
+ | `precise.c` | CUDA C `__device__` source |
11
+ | `precise.py` | PyTorch source |
12
+ | `precise.wasmBase64` | compiled f64 WebAssembly module |
13
+ | `fast` | algebraic-only variant when one was discovered |
14
+ | `meta` | `metric`, `level`, `formulaCost`, `exactCost`, `speedupVsExact`, `vsIterative` |
15
+
16
+ ## Usage
17
+
18
+ ```js
19
+ import { kernels, kernelIds } from "spear-kernels";
20
+
21
+ kernelIds; // list of all kernel ids
22
+
23
+ kernels.silu.precise.eval(2); // ~1.762 (SiLU approximant)
24
+
25
+ if (kernels.sigmoid.fast) {
26
+ kernels.sigmoid.fast.eval(3); // algebraic fast path
27
+ }
28
+
29
+ kernels.gaussian_cdf.meta.speedupVsExact; // metadata access
30
+ ```
31
+
32
+ ### WebAssembly backend
33
+
34
+ ```js
35
+ const bytes = Uint8Array.from(atob(kernels.silu.precise.wasmBase64), (c) => c.charCodeAt(0));
36
+ const env = {
37
+ exp: Math.exp, sin: Math.sin, cos: Math.cos, atan: Math.atan,
38
+ log: (v) => Math.log(v > 1e-30 ? v : 1e-30),
39
+ };
40
+ const { instance } = await WebAssembly.instantiate(bytes, { env });
41
+ instance.exports.spear(2); // same protected-division semantics as the JS backend
42
+ ```
43
+
44
+ Division is **protected** exactly like the engine: denominators floored at
45
+ ±1e-4 (sign-preserving), results clamped to ±1e4. Discovered formulas rely on
46
+ these rails — do not swap in bare `/`.
47
+
48
+ ## Support
49
+
50
+ If SPEAR kernels save you compute time, consider tipping the lab:
51
+
52
+ ₿ **bc1q6zmudp0ju8rg29jycgzmc8ev2zarejaejnntnd**
53
+
54
+ `npm fund` also surfaces this address (declared in the `funding` field).
55
+ Every satoshi goes back into GPU time for the evolution farm.
package/index.cjs CHANGED
@@ -764,6 +764,13 @@ const kernels = {
764
764
  py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sqrt(torch.abs(torch.exp(torch.clamp((-(x * x)), -50.0, 50.0))))",
765
765
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQoiASAAIAAgAKKaRAAAAAAAAEnApUQAAAAAAABJQKQQAJmfCw==",
766
766
  },
767
+ fast: {
768
+ js: "((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / ((((x) * (x) + 1.489797)) < 1e-4 && (((x) * (x) + 1.489797)) > -1e-4 ? ((((x) * (x) + 1.489797)) >= 0 ? 1e-4 : -1e-4) : (((x) * (x) + 1.489797))))))",
769
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / ((((x) * (x) + 1.489797)) < 1e-4 && (((x) * (x) + 1.489797)) > -1e-4 ? ((((x) * (x) + 1.489797)) >= 0 ? 1e-4 : -1e-4) : (((x) * (x) + 1.489797)))))),
770
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((powf(x, 2.0f) / copysignf(fmaxf(fabsf((powf(x, 2.0f) + 1.489797f)), 1.0e-4f), (powf(x, 2.0f) + 1.489797f))), -1.0e4f), 1.0e4f);\n}",
771
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((x * x) / (abs(((x * x) + 1.489797)) < 1e-4 ? 1e-4 : ((x * x) + 1.489797)))",
772
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkgBRgAgACAAoiAAIACiRNPcCmE11vc/oJlELUMc6+I2Gj+lIAAgAKJE09wKYTXW9z+gpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
773
+ },
767
774
  meta: {
768
775
  metric: 8.1772509994516e-34,
769
776
  level: 5,
@@ -1326,19 +1333,19 @@ const kernels = {
1326
1333
  "implied_vol": {
1327
1334
  id: "implied_vol",
1328
1335
  precise: {
1329
- js: "((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247))",
1330
- eval: ((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247)),
1331
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.033865f * ((4.540114f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.505f)) + (0.3183f * fminf(fmaxf((powf(((s - k) * 0.25f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.032453f)) + -0.011517f);\n}",
1332
- py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.033865 * ((4.540114 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.505)) + (0.3183 * ((((s - k) * 0.25) * ((s - k) * 0.25)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.032453)) + -0.011517)",
1333
- wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACvABAe0BAET9Qq4/torwP0RtcvikEykSQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FEKVyPwvUo4D+ioUR0RpT2Bl/UPyACIAOhRAAAAAAAANA/oiACIAOhRAAAAAAAANA/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJE121Q+62doL+gokRiEKIlIJaHv6AL",
1336
+ js: "((t, c, s, k) => ((5.655105 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.507)) + (-1.458771 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.939578)) * (((s - k) * 0.939578))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.08691573466883222))",
1337
+ eval: ((t, c, s, k) => ((5.655105 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.507)) + (-1.458771 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.939578)) * (((s - k) * 0.939578))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.08691573466883222)),
1338
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((5.655105f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.507f)) + (-1.458771f * fminf(fmaxf((powf(((s - k) * 0.939578f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.086916f);\n}",
1339
+ py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((5.655105 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.507)) + (-1.458771 * ((((s - k) * 0.939578) * ((s - k) * 0.939578)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.086916)",
1340
+ wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACtwBAdkBAETJyFnY054WQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FE001iEFg54D+ioUTGppVCIFf3vyACIAOhRJhQweEFEe4/oiACIAOhRJhQweEFEe4/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJEGxPpDRxAtr+gCw==",
1334
1341
  },
1335
1342
  meta: {
1336
- metric: 0.013185177440660847,
1337
- level: 0,
1338
- formulaCost: null,
1343
+ metric: 0.003177750474181145,
1344
+ level: 2,
1345
+ formulaCost: 27,
1339
1346
  exactCost: null,
1340
1347
  speedupVsExact: null,
1341
- vsIterative: null,
1348
+ vsIterative: {"label":"Newton vega · ~5 itérations","speedup":54.8},
1342
1349
  },
1343
1350
  },
1344
1351
  "michaelis_menten": {
package/index.js CHANGED
@@ -764,6 +764,13 @@ export const kernels = {
764
764
  py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sqrt(torch.abs(torch.exp(torch.clamp((-(x * x)), -50.0, 50.0))))",
765
765
  wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQoiASAAIAAgAKKaRAAAAAAAAEnApUQAAAAAAABJQKQQAJmfCw==",
766
766
  },
767
+ fast: {
768
+ js: "((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / ((((x) * (x) + 1.489797)) < 1e-4 && (((x) * (x) + 1.489797)) > -1e-4 ? ((((x) * (x) + 1.489797)) >= 0 ? 1e-4 : -1e-4) : (((x) * (x) + 1.489797))))))",
769
+ eval: ((x) => Math.min(1e4, Math.max(-1e4, ((x) * (x)) / ((((x) * (x) + 1.489797)) < 1e-4 && (((x) * (x) + 1.489797)) > -1e-4 ? ((((x) * (x) + 1.489797)) >= 0 ? 1e-4 : -1e-4) : (((x) * (x) + 1.489797)))))),
770
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((powf(x, 2.0f) / copysignf(fmaxf(fabsf((powf(x, 2.0f) + 1.489797f)), 1.0e-4f), (powf(x, 2.0f) + 1.489797f))), -1.0e4f), 1.0e4f);\n}",
771
+ py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((x * x) / (abs(((x * x) + 1.489797)) < 1e-4 ? 1e-4 : ((x * x) + 1.489797)))",
772
+ wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkgBRgAgACAAoiAAIACiRNPcCmE11vc/oJlELUMc6+I2Gj+lIAAgAKJE09wKYTXW9z+gpqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
773
+ },
767
774
  meta: {
768
775
  metric: 8.1772509994516e-34,
769
776
  level: 5,
@@ -1326,19 +1333,19 @@ export const kernels = {
1326
1333
  "implied_vol": {
1327
1334
  id: "implied_vol",
1328
1335
  precise: {
1329
- js: "((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247))",
1330
- eval: ((t, c, s, k) => ((1.0338652122047158 * ((4.540114 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.505)) + (0.3183 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.25)) * (((s - k) * 0.25))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.032453)) + -0.011516810558767247)),
1331
- c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((1.033865f * ((4.540114f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.505f)) + (0.3183f * fminf(fmaxf((powf(((s - k) * 0.25f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.032453f)) + -0.011517f);\n}",
1332
- py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((1.033865 * ((4.540114 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.505)) + (0.3183 * ((((s - k) * 0.25) * ((s - k) * 0.25)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.032453)) + -0.011517)",
1333
- wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACvABAe0BAET9Qq4/torwP0RtcvikEykSQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FEKVyPwvUo4D+ioUR0RpT2Bl/UPyACIAOhRAAAAAAAANA/oiACIAOhRAAAAAAAANA/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJE121Q+62doL+gokRiEKIlIJaHv6AL",
1336
+ js: "((t, c, s, k) => ((5.655105 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.507)) + (-1.458771 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.939578)) * (((s - k) * 0.939578))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.08691573466883222))",
1337
+ eval: ((t, c, s, k) => ((5.655105 * (Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (1) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))))) * Math.min(1e4, Math.max(-1e4, (((c - ((s - k) * 0.507)) + (-1.458771 * Math.min(1e4, Math.max(-1e4, ((((s - k) * 0.939578)) * (((s - k) * 0.939578))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k)))))))) / (((s + k)) < 1e-4 && ((s + k)) > -1e-4 ? (((s + k)) >= 0 ? 1e-4 : -1e-4) : ((s + k))))))) + -0.08691573466883222)),
1338
+ c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((5.655105f * (sqrtf(fabsf(fminf(fmaxf((1f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f))) * fminf(fmaxf((((c - ((s - k) * 0.507f)) + (-1.458771f * fminf(fmaxf((powf(((s - k) * 0.939578f), 2.0f) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) / copysignf(fmaxf(fabsf((s + k)), 1.0e-4f), (s + k))), -1.0e4f), 1.0e4f))) + -0.086916f);\n}",
1339
+ py: "import torch\n\ndef spear_fn(t, c, s, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((5.655105 * (torch.sqrt(torch.abs((1 / (abs(t) < 1e-4 ? 1e-4 : t)))) * (((c - ((s - k) * 0.507)) + (-1.458771 * ((((s - k) * 0.939578) * ((s - k) * 0.939578)) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) / (abs((s + k)) < 1e-4 ? 1e-4 : (s + k))))) + -0.086916)",
1340
+ wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACtwBAdkBAETJyFnY054WQEQAAAAAAADwPyAAmUQtQxzr4jYaP6UgAKajRAAAAAAAiMPApUQAAAAAAIjDQKSZnyABIAIgA6FE001iEFg54D+ioUTGppVCIFf3vyACIAOhRJhQweEFEe4/oiACIAOhRJhQweEFEe4/oqIgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqAgAiADoJlELUMc6+I2Gj+lIAIgA6Cmo0QAAAAAAIjDwKVEAAAAAACIw0CkoqJEGxPpDRxAtr+gCw==",
1334
1341
  },
1335
1342
  meta: {
1336
- metric: 0.013185177440660847,
1337
- level: 0,
1338
- formulaCost: null,
1343
+ metric: 0.003177750474181145,
1344
+ level: 2,
1345
+ formulaCost: 27,
1339
1346
  exactCost: null,
1340
1347
  speedupVsExact: null,
1341
- vsIterative: null,
1348
+ vsIterative: {"label":"Newton vega · ~5 itérations","speedup":54.8},
1342
1349
  },
1343
1350
  },
1344
1351
  "michaelis_menten": {
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
- {
2
- "name": "spear-kernels",
3
- "version": "1.10.2",
4
- "description": "Closed-form kernels discovered by the SPEAR symbolic regression engine, shipped as JS, CUDA C, PyTorch and WebAssembly.",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "./index.cjs",
8
- "module": "./index.js",
9
- "types": "./index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./index.d.ts",
13
- "import": "./index.js",
14
- "require": "./index.cjs"
15
- },
16
- "./package.json": "./package.json"
17
- },
18
- "files": [
19
- "index.js",
20
- "index.cjs",
21
- "index.d.ts",
22
- "README.md"
23
- ],
24
- "sideEffects": false,
25
- "funding": "bitcoin:bc1q6zmudp0ju8rg29jycgzmc8ev2zarejaejnntnd"
26
- }
1
+ {
2
+ "name": "spear-kernels",
3
+ "version": "1.10.3",
4
+ "description": "Closed-form kernels discovered by the SPEAR symbolic regression engine, shipped as JS, CUDA C, PyTorch and WebAssembly.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./index.cjs",
8
+ "module": "./index.js",
9
+ "types": "./index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./index.d.ts",
13
+ "import": "./index.js",
14
+ "require": "./index.cjs"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.cjs",
21
+ "index.d.ts",
22
+ "README.md"
23
+ ],
24
+ "sideEffects": false,
25
+ "funding": "bitcoin:bc1q6zmudp0ju8rg29jycgzmc8ev2zarejaejnntnd"
26
+ }