spear-kernels 1.4.1 → 1.5.0
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/index.cjs +138 -68
- package/index.js +138 -68
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -28,6 +28,13 @@ const kernels = {
|
|
|
28
28
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.997729 * (x * torch.minimum(1.002, torch.relu(((0.306923 * x) + 0.501))))) + -0.004004)",
|
|
29
29
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEQ6ooXmXt7z8gAETVeOkmMQjwP0Qr+dhdoKTTPyAAokTVeOkmMQjgP6BEAAAAAAAAAAClpKKiRHfX2ZB/ZnC/oAs=",
|
|
30
30
|
},
|
|
31
|
+
fast: {
|
|
32
|
+
js: "((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5)))))",
|
|
33
|
+
eval: ((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5))))),
|
|
34
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (x * fminf(1f, fmaxf(0.0f, ((0.295845f * x) + 0.5f))));\n}",
|
|
35
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x * torch.minimum(1, torch.relu(((0.295845 * x) + 0.5))))",
|
|
36
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjEBLwAgAEQAAAAAAADwP0QC2evdH+/SPyAAokQAAAAAAADgP6BEAAAAAAAAAAClpKIL",
|
|
37
|
+
},
|
|
31
38
|
meta: {
|
|
32
39
|
metric: 0.0005322566020140329,
|
|
33
40
|
level: 2,
|
|
@@ -247,11 +254,11 @@ const kernels = {
|
|
|
247
254
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AiADA2VudgNleHAAAQNlbnYEYXRhbgABA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAwpIAUYARFrhtkDMt/a/RHWuKCUE6wFAIABEAAAAAAAAScClRAAAAAAAAElApBAAEAFEoMLr/ktItDmlEAKhokTf3Weg90IMQKAL",
|
|
248
255
|
},
|
|
249
256
|
fast: {
|
|
250
|
-
js: "((t) => ((
|
|
251
|
-
eval: ((t) => ((
|
|
252
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
253
|
-
py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
254
|
-
wasmBase64: "
|
|
257
|
+
js: "((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))))",
|
|
258
|
+
eval: ((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t)))),
|
|
259
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(powf((6.643258f - t), 3.0f), 2.0f);\n}",
|
|
260
|
+
py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((6.643258 - t) ** 3) * ((6.643258 - t) ** 3))",
|
|
261
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClEBTwBEvY+jObKSGkAgAKFEvY+jObKSGkAgAKFEvY+jObKSGkAgAKGiokS9j6M5spIaQCAAoUS9j6M5spIaQCAAoUS9j6M5spIaQCAAoaKiogs=",
|
|
255
262
|
},
|
|
256
263
|
meta: {
|
|
257
264
|
metric: 0.00007258403509477666,
|
|
@@ -904,6 +911,13 @@ const kernels = {
|
|
|
904
911
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1.106774 * ((x + (0.034298 * (x ** 3))) / (abs((0.995 + (0.378089 * (x * x)))) < 1e-4 ? 1e-4 : (0.995 + (0.378089 * (x * x))))))",
|
|
905
912
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnYBdABEeQJhp1i18T8gAEQp7KLogY+hPyAAIAAgAKKioqBE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgmUQtQxzr4jYaP6VE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgpqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
|
|
906
913
|
},
|
|
914
|
+
fast: {
|
|
915
|
+
js: "((x) => Math.sin(Math.sin(Math.atan(x))))",
|
|
916
|
+
eval: ((x) => Math.sin(Math.sin(Math.atan(x)))),
|
|
917
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return sinf(sinf(atanf(x)));\n}",
|
|
918
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sin(torch.sin(torch.atan(x)))",
|
|
919
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNzaW4AAQNlbnYEYXRhbgABAwIBAAcJAQVzcGVhcgACCgwBCgAgABABEAAQAAs=",
|
|
920
|
+
},
|
|
907
921
|
meta: {
|
|
908
922
|
metric: 0.00004650870031371604,
|
|
909
923
|
level: 3,
|
|
@@ -1216,25 +1230,25 @@ const kernels = {
|
|
|
1216
1230
|
"logit_ml": {
|
|
1217
1231
|
id: "logit_ml",
|
|
1218
1232
|
precise: {
|
|
1219
|
-
js: "((x) =>
|
|
1220
|
-
eval: ((x) =>
|
|
1221
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-
|
|
1222
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return
|
|
1223
|
-
wasmBase64: "
|
|
1233
|
+
js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x))))))))",
|
|
1234
|
+
eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x)))))))),
|
|
1235
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f - x)), 1.0e-4f), (1f - x))), -1.0e4f), 1.0e4f)));\n}",
|
|
1236
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((x / (abs((1 - x)) < 1e-4 ? 1e-4 : (1 - x))), min=1e-30))",
|
|
1237
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQpLAUkAIABEAAAAAAAA8D8gAKGZRC1DHOviNho/pUQAAAAAAADwPyAAoaajRAAAAAAAiMPApUQAAAAAAIjDQKREoMLr/ktItDmlEAAL",
|
|
1224
1238
|
},
|
|
1225
1239
|
fast: {
|
|
1226
|
-
js: "((x) => ((
|
|
1227
|
-
eval: ((x) => ((
|
|
1228
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1229
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1230
|
-
wasmBase64: "
|
|
1240
|
+
js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x))))))))",
|
|
1241
|
+
eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)))))))),
|
|
1242
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x)), 1.0e-4f), (fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x))), -1.0e4f), 1.0e4f)));\n}",
|
|
1243
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((x / (abs(((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x)) < 1e-4 ? 1e-4 : ((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x))), min=1e-30))",
|
|
1244
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQqIAQGFAQAgACAAIACZRC1DHOviNho/pSAApqNEAAAAAACIw8ClRAAAAAAAiMNApCAAoZlELUMc6+I2Gj+lIAAgAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkIAChpqNEAAAAAACIw8ClRAAAAAAAiMNApESgwuv+S0i0OaUQAAs=",
|
|
1231
1245
|
},
|
|
1232
1246
|
meta: {
|
|
1233
|
-
metric: 0
|
|
1234
|
-
level:
|
|
1235
|
-
formulaCost:
|
|
1247
|
+
metric: 0,
|
|
1248
|
+
level: 5,
|
|
1249
|
+
formulaCost: 25,
|
|
1236
1250
|
exactCost: 27,
|
|
1237
|
-
speedupVsExact:
|
|
1251
|
+
speedupVsExact: 1.08,
|
|
1238
1252
|
vsIterative: null,
|
|
1239
1253
|
},
|
|
1240
1254
|
},
|
|
@@ -1272,6 +1286,13 @@ const kernels = {
|
|
|
1272
1286
|
py: "import torch\n\ndef spear_fn(g, l):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (100 * (g / (abs((g + l)) < 1e-4 ? 1e-4 : (g + l))))",
|
|
1273
1287
|
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAo7ATkARAAAAAAAAFlAIAAgACABoJlELUMc6+I2Gj+lIAAgAaCmo0QAAAAAAIjDwKVEAAAAAACIw0Ckogs=",
|
|
1274
1288
|
},
|
|
1289
|
+
fast: {
|
|
1290
|
+
js: "((g, l) => (85.981607 * Math.min(1e4, Math.max(-1e4, (g) / (((g + l)) < 1e-4 && ((g + l)) > -1e-4 ? (((g + l)) >= 0 ? 1e-4 : -1e-4) : ((g + l)))))))",
|
|
1291
|
+
eval: ((g, l) => (85.981607 * Math.min(1e4, Math.max(-1e4, (g) / (((g + l)) < 1e-4 && ((g + l)) > -1e-4 ? (((g + l)) >= 0 ? 1e-4 : -1e-4) : ((g + l))))))),
|
|
1292
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (85.981607f * fminf(fmaxf((g / copysignf(fmaxf(fabsf((g + l)), 1.0e-4f), (g + l))), -1.0e4f), 1.0e4f));\n}",
|
|
1293
|
+
py: "import torch\n\ndef spear_fn(g, l):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (85.981607 * (g / (abs((g + l)) < 1e-4 ? 1e-4 : (g + l))))",
|
|
1294
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAo7ATkARJShKqbSflVAIAAgACABoJlELUMc6+I2Gj+lIAAgAaCmo0QAAAAAAIjDwKVEAAAAAACIw0Ckogs=",
|
|
1295
|
+
},
|
|
1275
1296
|
meta: {
|
|
1276
1297
|
metric: 1.836172557108052e-29,
|
|
1277
1298
|
level: 2,
|
|
@@ -1284,14 +1305,14 @@ const kernels = {
|
|
|
1284
1305
|
"implied_vol": {
|
|
1285
1306
|
id: "implied_vol",
|
|
1286
1307
|
precise: {
|
|
1287
|
-
js: "((k,
|
|
1288
|
-
eval: ((k,
|
|
1289
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1290
|
-
py: "import torch\n\ndef spear_fn(k,
|
|
1291
|
-
wasmBase64: "
|
|
1308
|
+
js: "((k, s, t, c) => ((-1.1629327259438174 * (Math.min(1e4, Math.max(-1e4, (k) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s)))) * (Math.min(1e4, Math.max(-1e4, (0.205774) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))) + Math.sqrt(Math.abs((3.267127 + c)))))) + 6.6139818048422185))",
|
|
1309
|
+
eval: ((k, s, t, c) => ((-1.1629327259438174 * (Math.min(1e4, Math.max(-1e4, (k) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s)))) * (Math.min(1e4, Math.max(-1e4, (0.205774) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))) + Math.sqrt(Math.abs((3.267127 + c)))))) + 6.6139818048422185)),
|
|
1310
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-1.162933f * (fminf(fmaxf((k / copysignf(fmaxf(fabsf(s), 1.0e-4f), s)), -1.0e4f), 1.0e4f) * (fminf(fmaxf((0.205774f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f) + sqrtf(fabsf((3.267127f + c)))))) + 6.613982f);\n}",
|
|
1311
|
+
py: "import torch\n\ndef spear_fn(k, s, t, c):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-1.162933 * ((k / (abs(s) < 1e-4 ? 1e-4 : s)) * ((0.205774 / (abs(t) < 1e-4 ? 1e-4 : t)) + torch.sqrt(torch.abs((3.267127 + c)))))) + 6.613982)",
|
|
1312
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACn0BewBEeweWWF+b8r8gACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKRERP0ubM1Wyj8gAplELUMc6+I2Gj+lIAKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRFsHB3sTIwpAIAOgmZ+goqJEqItwpbd0GkCgCw==",
|
|
1292
1313
|
},
|
|
1293
1314
|
meta: {
|
|
1294
|
-
metric: 0.
|
|
1315
|
+
metric: 0.9250539868167686,
|
|
1295
1316
|
level: 0,
|
|
1296
1317
|
formulaCost: null,
|
|
1297
1318
|
exactCost: null,
|
|
@@ -1427,18 +1448,25 @@ const kernels = {
|
|
|
1427
1448
|
"grover_amplitude": {
|
|
1428
1449
|
id: "grover_amplitude",
|
|
1429
1450
|
precise: {
|
|
1430
|
-
js: "((k) => ((-
|
|
1431
|
-
eval: ((k) => ((-
|
|
1432
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-
|
|
1433
|
-
py: "import torch\n\ndef spear_fn(k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.
|
|
1434
|
-
wasmBase64: "
|
|
1451
|
+
js: "((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))))",
|
|
1452
|
+
eval: ((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))))))))),
|
|
1453
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(sinf((asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))) + (2f * (k * asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))))))), 2.0f);\n}",
|
|
1454
|
+
py: "import torch\n\ndef spear_fn(m, n, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))) * torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))))",
|
|
1455
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCFgIDZW52A3NpbgABA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAIKogIBnwIAIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABRAAAAAAAAABAIAIgACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKSZn0QAAAAAAADwv6VEAAAAAAAA8D+kEAGioqAQACAAIAGZRC1DHOviNho/pSABpqNEAAAAAACIw8ClRAAAAAAAiMNApJmfRAAAAAAAAPC/pUQAAAAAAADwP6QQAUQAAAAAAAAAQCACIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABoqKgEACiCw==",
|
|
1456
|
+
},
|
|
1457
|
+
fast: {
|
|
1458
|
+
js: "((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))))",
|
|
1459
|
+
eval: ((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))))))))),
|
|
1460
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(sinf((asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))) + (2f * (k * asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))))))), 2.0f);\n}",
|
|
1461
|
+
py: "import torch\n\ndef spear_fn(m, n, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))) * torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))))",
|
|
1462
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCFgIDZW52A3NpbgABA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAIKogIBnwIAIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABRAAAAAAAAABAIAIgACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKSZn0QAAAAAAADwv6VEAAAAAAAA8D+kEAGioqAQACAAIAGZRC1DHOviNho/pSABpqNEAAAAAACIw8ClRAAAAAAAiMNApJmfRAAAAAAAAPC/pUQAAAAAAADwP6QQAUQAAAAAAAAAQCACIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABoqKgEACiCw==",
|
|
1435
1463
|
},
|
|
1436
1464
|
meta: {
|
|
1437
|
-
metric:
|
|
1438
|
-
level:
|
|
1439
|
-
formulaCost:
|
|
1465
|
+
metric: 8.312261599931228e-32,
|
|
1466
|
+
level: 2,
|
|
1467
|
+
formulaCost: 76,
|
|
1440
1468
|
exactCost: 48,
|
|
1441
|
-
speedupVsExact:
|
|
1469
|
+
speedupVsExact: 0.631578947368421,
|
|
1442
1470
|
vsIterative: null,
|
|
1443
1471
|
},
|
|
1444
1472
|
},
|
|
@@ -1469,6 +1497,13 @@ const kernels = {
|
|
|
1469
1497
|
py: "import torch\n\ndef spear_fn(a, b, ap, bp):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.abs((((-torch.cos((a - b))) + (-torch.cos((ap - b)))) - ((-torch.cos((a - bp))) - (-torch.cos((ap - bp))))))",
|
|
1470
1498
|
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AgsBA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAQooASYAIAAgAaEQAJogAiABoRAAmqAgACADoRAAmiACIAOhEACaoaGZCw==",
|
|
1471
1499
|
},
|
|
1500
|
+
fast: {
|
|
1501
|
+
js: "((a, b, ap, bp) => Math.abs((((-Math.cos((a - b))) + (-Math.cos((ap - b)))) - ((-Math.cos((a - bp))) - (-Math.cos((ap - bp)))))))",
|
|
1502
|
+
eval: ((a, b, ap, bp) => Math.abs((((-Math.cos((a - b))) + (-Math.cos((ap - b)))) - ((-Math.cos((a - bp))) - (-Math.cos((ap - bp))))))),
|
|
1503
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fabsf((((-cosf((a - b))) + (-cosf((ap - b)))) - ((-cosf((a - bp))) - (-cosf((ap - bp))))));\n}",
|
|
1504
|
+
py: "import torch\n\ndef spear_fn(a, b, ap, bp):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.abs((((-torch.cos((a - b))) + (-torch.cos((ap - b)))) - ((-torch.cos((a - bp))) - (-torch.cos((ap - bp))))))",
|
|
1505
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AgsBA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAQooASYAIAAgAaEQAJogAiABoRAAmqAgACADoRAAmiACIAOhEACaoaGZCw==",
|
|
1506
|
+
},
|
|
1472
1507
|
meta: {
|
|
1473
1508
|
metric: 2.1055469858256505e-32,
|
|
1474
1509
|
level: 2,
|
|
@@ -1556,37 +1591,51 @@ const kernels = {
|
|
|
1556
1591
|
"qfi_dephasing": {
|
|
1557
1592
|
id: "qfi_dephasing",
|
|
1558
1593
|
precise: {
|
|
1559
|
-
js: "((n, t, g) => ((
|
|
1560
|
-
eval: ((n, t, g) => ((
|
|
1561
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1562
|
-
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1563
|
-
wasmBase64: "
|
|
1594
|
+
js: "((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t)))))))))",
|
|
1595
|
+
eval: ((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t))))))))),
|
|
1596
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(n, 2.0f) * (powf(t, 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(n, 2.0f) * (g * t))))))));\n}",
|
|
1597
|
+
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((n * n) * ((t * t) * torch.exp(torch.clamp((-((n * n) * (g * t))), -50.0, 50.0))))",
|
|
1598
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCCwEDZW52A2V4cAABAwIBAAcJAQVzcGVhcgABCjIBMAAgACAAoiABIAGiIAAgAKIgAiABoqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKKiCw==",
|
|
1599
|
+
},
|
|
1600
|
+
fast: {
|
|
1601
|
+
js: "((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t)))))))))",
|
|
1602
|
+
eval: ((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t))))))))),
|
|
1603
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(n, 2.0f) * (powf(t, 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(n, 2.0f) * (g * t))))))));\n}",
|
|
1604
|
+
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((n * n) * ((t * t) * torch.exp(torch.clamp((-((n * n) * (g * t))), -50.0, 50.0))))",
|
|
1605
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCCwEDZW52A2V4cAABAwIBAAcJAQVzcGVhcgABCjIBMAAgACAAoiABIAGiIAAgAKIgAiABoqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKKiCw==",
|
|
1564
1606
|
},
|
|
1565
1607
|
meta: {
|
|
1566
|
-
metric: 1.
|
|
1567
|
-
level:
|
|
1568
|
-
formulaCost:
|
|
1608
|
+
metric: 1.6734673238482507e-31,
|
|
1609
|
+
level: 2,
|
|
1610
|
+
formulaCost: 28,
|
|
1569
1611
|
exactCost: 22,
|
|
1570
|
-
speedupVsExact: 0.
|
|
1571
|
-
vsIterative: {"label":"BFGS optimisation","speedup":
|
|
1612
|
+
speedupVsExact: 0.7857142857142857,
|
|
1613
|
+
vsIterative: {"label":"BFGS optimisation","speedup":28.6},
|
|
1572
1614
|
},
|
|
1573
1615
|
},
|
|
1574
1616
|
"amp_damp_fid": {
|
|
1575
1617
|
id: "amp_damp_fid",
|
|
1576
1618
|
precise: {
|
|
1577
|
-
js: "((th, t) => ((
|
|
1578
|
-
eval: ((th, t) => ((
|
|
1579
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1580
|
-
py: "import torch\n\ndef spear_fn(th, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1581
|
-
wasmBase64: "
|
|
1619
|
+
js: "((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))))))",
|
|
1620
|
+
eval: ((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t))))))))),
|
|
1621
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((powf(cosf(th), 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t)))))) + (powf(sinf(th), 2.0f) * (2f - expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t))))))));\n}",
|
|
1622
|
+
py: "import torch\n\ndef spear_fn(th, g, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.cos(th) * torch.cos(th)) * torch.exp(torch.clamp((-(g * t)), -50.0, 50.0))) + ((torch.sin(th) * torch.sin(th)) * (2 - torch.exp(torch.clamp((-(g * t)), -50.0, 50.0)))))",
|
|
1623
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCHwMDZW52A2V4cAABA2VudgNzaW4AAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAMKWwFZACAAEAIgABACoiABIAKimkQAAAAAAABJwKVEAAAAAAAASUCkEACiIAAQASAAEAGiRAAAAAAAAABAIAEgAqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKGioAs=",
|
|
1624
|
+
},
|
|
1625
|
+
fast: {
|
|
1626
|
+
js: "((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))))))",
|
|
1627
|
+
eval: ((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t))))))))),
|
|
1628
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((powf(cosf(th), 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t)))))) + (powf(sinf(th), 2.0f) * (2f - expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t))))))));\n}",
|
|
1629
|
+
py: "import torch\n\ndef spear_fn(th, g, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.cos(th) * torch.cos(th)) * torch.exp(torch.clamp((-(g * t)), -50.0, 50.0))) + ((torch.sin(th) * torch.sin(th)) * (2 - torch.exp(torch.clamp((-(g * t)), -50.0, 50.0)))))",
|
|
1630
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCHwMDZW52A2V4cAABA2VudgNzaW4AAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAMKWwFZACAAEAIgABACoiABIAKimkQAAAAAAABJwKVEAAAAAAAASUCkEACiIAAQASAAEAGiRAAAAAAAAABAIAEgAqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKGioAs=",
|
|
1582
1631
|
},
|
|
1583
1632
|
meta: {
|
|
1584
|
-
metric: 0
|
|
1585
|
-
level:
|
|
1586
|
-
formulaCost:
|
|
1633
|
+
metric: 0,
|
|
1634
|
+
level: 5,
|
|
1635
|
+
formulaCost: 90,
|
|
1587
1636
|
exactCost: 24,
|
|
1588
|
-
speedupVsExact: 0.
|
|
1589
|
-
vsIterative: {"label":"Kraus ops 4×4 matmul","speedup":0.
|
|
1637
|
+
speedupVsExact: 0.26666666666666666,
|
|
1638
|
+
vsIterative: {"label":"Kraus ops 4×4 matmul","speedup":0.5},
|
|
1590
1639
|
},
|
|
1591
1640
|
},
|
|
1592
1641
|
"loschmidt_rate": {
|
|
@@ -1617,14 +1666,21 @@ const kernels = {
|
|
|
1617
1666
|
"bessel_i0e": {
|
|
1618
1667
|
id: "bessel_i0e",
|
|
1619
1668
|
precise: {
|
|
1620
|
-
js: "((x) => ((-0.
|
|
1621
|
-
eval: ((x) => ((-0.
|
|
1622
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.
|
|
1623
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.
|
|
1624
|
-
wasmBase64: "
|
|
1669
|
+
js: "((x) => ((-0.23493996284905358 * Math.min(1e4, Math.max(-1e4, ((x + -2.458142)) / (((0.798564 + x)) < 1e-4 && ((0.798564 + x)) > -1e-4 ? (((0.798564 + x)) >= 0 ? 1e-4 : -1e-4) : ((0.798564 + x)))))) + 0.2839492702683716))",
|
|
1670
|
+
eval: ((x) => ((-0.23493996284905358 * Math.min(1e4, Math.max(-1e4, ((x + -2.458142)) / (((0.798564 + x)) < 1e-4 && ((0.798564 + x)) > -1e-4 ? (((0.798564 + x)) >= 0 ? 1e-4 : -1e-4) : ((0.798564 + x)))))) + 0.2839492702683716)),
|
|
1671
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.23494f * fminf(fmaxf(((x + -2.458142f) / copysignf(fmaxf(fabsf((0.798564f + x)), 1.0e-4f), (0.798564f + x))), -1.0e4f), 1.0e4f)) + 0.283949f);\n}",
|
|
1672
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.23494 * ((x + -2.458142) / (abs((0.798564 + x)) < 1e-4 ? 1e-4 : (0.798564 + x)))) + 0.283949)",
|
|
1673
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBE3+V6QIMSzr8gAERrZFdaRqoDwKBECmr4FtaN6T8gAKCZRC1DHOviNho/pUQKavgW1o3pPyAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRGqlYY85LNI/oAs=",
|
|
1674
|
+
},
|
|
1675
|
+
fast: {
|
|
1676
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578))))))",
|
|
1677
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578)))))),
|
|
1678
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((2.895344f / copysignf(fmaxf(fabsf(((x + (1.447672f + x)) * 0.661578f)), 1.0e-4f), ((x + (1.447672f + x)) * 0.661578f))), -1.0e4f), 1.0e4f);\n}",
|
|
1679
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (2.895344 / (abs(((x + (1.447672 + x)) * 0.661578)) < 1e-4 ? 1e-4 : ((x + (1.447672 + x)) * 0.661578)))",
|
|
1680
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmABXgBEzVt1HaopB0AgAETNW3Udqin3PyAAoKBETBk4oKUr5T+imUQtQxzr4jYaP6UgAETNW3Udqin3PyAAoKBETBk4oKUr5T+ipqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
1625
1681
|
},
|
|
1626
1682
|
meta: {
|
|
1627
|
-
metric: 0.
|
|
1683
|
+
metric: 0.00003054908318748102,
|
|
1628
1684
|
level: 2,
|
|
1629
1685
|
formulaCost: 8,
|
|
1630
1686
|
exactCost: 24,
|
|
@@ -1641,6 +1697,13 @@ const kernels = {
|
|
|
1641
1697
|
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.229391 * ((torch.exp(torch.clamp(m, -50.0, 50.0)) * (torch.asin(torch.clamp(m, -1.0, 1.0)) ** 3)) + m)) + 1.642805)",
|
|
1642
1698
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNleHAAAQNlbnYEYXNpbgABAwIBAAcJAQVzcGVhcgACCn4BfABECnUC8rJczT8gAEQAAAAAAABJwKVEAAAAAAAASUCkEAAgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAGioqIgAKCiRB1ZwOrtSPo/oAs=",
|
|
1643
1699
|
},
|
|
1700
|
+
fast: {
|
|
1701
|
+
js: "((m) => (((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * ((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * Math.min(1e4, Math.max(-1e4, (Math.asin(Math.max(-1, Math.min(1, m)))) / ((((m) * (m)) * ((m) * (m))) < 1e-4 && (((m) * (m)) * ((m) * (m))) > -1e-4 ? ((((m) * (m)) * ((m) * (m))) >= 0 ? 1e-4 : -1e-4) : (((m) * (m)) * ((m) * (m))))))))",
|
|
1702
|
+
eval: ((m) => (((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * ((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * Math.min(1e4, Math.max(-1e4, (Math.asin(Math.max(-1, Math.min(1, m)))) / ((((m) * (m)) * ((m) * (m))) < 1e-4 && (((m) * (m)) * ((m) * (m))) > -1e-4 ? ((((m) * (m)) * ((m) * (m))) >= 0 ? 1e-4 : -1e-4) : (((m) * (m)) * ((m) * (m)))))))),
|
|
1703
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(powf(asinf(fmaxf(-1.0f, fminf(1.0f, m))), 2.0f), 2.0f) * fminf(fmaxf((asinf(fmaxf(-1.0f, fminf(1.0f, m))) / copysignf(fmaxf(fabsf(powf(powf(m, 2.0f), 2.0f)), 1.0e-4f), powf(powf(m, 2.0f), 2.0f))), -1.0e4f), 1.0e4f));\n}",
|
|
1704
|
+
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.asin(torch.clamp(m, -1.0, 1.0)) * torch.asin(torch.clamp(m, -1.0, 1.0))) * (torch.asin(torch.clamp(m, -1.0, 1.0)) * torch.asin(torch.clamp(m, -1.0, 1.0)))) * (torch.asin(torch.clamp(m, -1.0, 1.0)) / (abs(((m * m) * (m * m))) < 1e-4 ? 1e-4 : ((m * m) * (m * m)))))",
|
|
1705
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAEKuAEBtQEAIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAoiAARAAAAAAAAPC/pUQAAAAAAADwP6QQACAARAAAAAAAAPC/pUQAAAAAAADwP6QQAKKiIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAIAAgAKIgACAAoqKZRC1DHOviNho/pSAAIACiIAAgAKKipqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
|
|
1706
|
+
},
|
|
1644
1707
|
meta: {
|
|
1645
1708
|
metric: 0.004333603318947968,
|
|
1646
1709
|
level: 2,
|
|
@@ -1653,18 +1716,18 @@ const kernels = {
|
|
|
1653
1716
|
"kepler_solver": {
|
|
1654
1717
|
id: "kepler_solver",
|
|
1655
1718
|
precise: {
|
|
1656
|
-
js: "((
|
|
1657
|
-
eval: ((
|
|
1658
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1659
|
-
py: "import torch\n\ndef spear_fn(
|
|
1660
|
-
wasmBase64: "
|
|
1719
|
+
js: "((M, e) => ((0.2499447407678102 * (((M + (M + e)) + (0.749715 * (M + e))) + Math.min(3.875643, (2.049437 * (M + e))))) + -0.21378713578869088))",
|
|
1720
|
+
eval: ((M, e) => ((0.2499447407678102 * (((M + (M + e)) + (0.749715 * (M + e))) + Math.min(3.875643, (2.049437 * (M + e))))) + -0.21378713578869088)),
|
|
1721
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.249945f * (((M + (M + e)) + (0.749715f * (M + e))) + fminf(3.875643f, (2.049437f * (M + e))))) + -0.213787f);\n}",
|
|
1722
|
+
py: "import torch\n\ndef spear_fn(M, e):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.249945 * (((M + (M + e)) + (0.749715 * (M + e))) + torch.minimum(3.875643, (2.049437 * (M + e))))) + -0.213787)",
|
|
1723
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAApKAUgARCrVs3Mw/s8/IAAgACABoKBEr0LKT6r95z8gACABoKKgREjF/x1RAQ9AROay0Tk/ZQBAIAAgAaCipKCiRM9LQnpgXcu/oAs=",
|
|
1661
1724
|
},
|
|
1662
1725
|
meta: {
|
|
1663
|
-
metric: 0.
|
|
1726
|
+
metric: 0.006134991867434414,
|
|
1664
1727
|
level: 1,
|
|
1665
|
-
formulaCost:
|
|
1728
|
+
formulaCost: 11,
|
|
1666
1729
|
exactCost: 32,
|
|
1667
|
-
speedupVsExact:
|
|
1730
|
+
speedupVsExact: 2.909090909090909,
|
|
1668
1731
|
vsIterative: null,
|
|
1669
1732
|
},
|
|
1670
1733
|
},
|
|
@@ -1677,6 +1740,13 @@ const kernels = {
|
|
|
1677
1740
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.exp(torch.clamp(x, -50.0, 50.0))",
|
|
1678
1741
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQocARoAIABEAAAAAAAAScClRAAAAAAAAElApBAACw==",
|
|
1679
1742
|
},
|
|
1743
|
+
fast: {
|
|
1744
|
+
js: "((x) => Math.min(1.491, Math.exp(Math.max(-50, Math.min(50, x)))))",
|
|
1745
|
+
eval: ((x) => Math.min(1.491, Math.exp(Math.max(-50, Math.min(50, x))))),
|
|
1746
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(1.491f, expf(fmaxf(-50.0f, fminf(50.0f, x))));\n}",
|
|
1747
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.minimum(1.491, torch.exp(torch.clamp(x, -50.0, 50.0)))",
|
|
1748
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQomASQAREJg5dAi2/c/IABEAAAAAAAAScClRAAAAAAAAElApBAApAs=",
|
|
1749
|
+
},
|
|
1680
1750
|
meta: {
|
|
1681
1751
|
metric: 0,
|
|
1682
1752
|
level: 5,
|
package/index.js
CHANGED
|
@@ -28,6 +28,13 @@ export const kernels = {
|
|
|
28
28
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.997729 * (x * torch.minimum(1.002, torch.relu(((0.306923 * x) + 0.501))))) + -0.004004)",
|
|
29
29
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACkUBQwBEQ6ooXmXt7z8gAETVeOkmMQjwP0Qr+dhdoKTTPyAAokTVeOkmMQjgP6BEAAAAAAAAAAClpKKiRHfX2ZB/ZnC/oAs=",
|
|
30
30
|
},
|
|
31
|
+
fast: {
|
|
32
|
+
js: "((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5)))))",
|
|
33
|
+
eval: ((x) => (x * Math.min(1, Math.max(0, ((0.295845 * x) + 0.5))))),
|
|
34
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (x * fminf(1f, fmaxf(0.0f, ((0.295845f * x) + 0.5f))));\n}",
|
|
35
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (x * torch.minimum(1, torch.relu(((0.295845 * x) + 0.5))))",
|
|
36
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACjEBLwAgAEQAAAAAAADwP0QC2evdH+/SPyAAokQAAAAAAADgP6BEAAAAAAAAAAClpKIL",
|
|
37
|
+
},
|
|
31
38
|
meta: {
|
|
32
39
|
metric: 0.0005322566020140329,
|
|
33
40
|
level: 2,
|
|
@@ -247,11 +254,11 @@ export const kernels = {
|
|
|
247
254
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AiADA2VudgNleHAAAQNlbnYEYXRhbgABA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAwpIAUYARFrhtkDMt/a/RHWuKCUE6wFAIABEAAAAAAAAScClRAAAAAAAAElApBAAEAFEoMLr/ktItDmlEAKhokTf3Weg90IMQKAL",
|
|
248
255
|
},
|
|
249
256
|
fast: {
|
|
250
|
-
js: "((t) => ((
|
|
251
|
-
eval: ((t) => ((
|
|
252
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
253
|
-
py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
254
|
-
wasmBase64: "
|
|
257
|
+
js: "((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))))",
|
|
258
|
+
eval: ((t) => (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t))) * (((6.643258 - t)) * ((6.643258 - t)) * ((6.643258 - t)))),
|
|
259
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(powf((6.643258f - t), 3.0f), 2.0f);\n}",
|
|
260
|
+
py: "import torch\n\ndef spear_fn(t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((6.643258 - t) ** 3) * ((6.643258 - t) ** 3))",
|
|
261
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAAClEBTwBEvY+jObKSGkAgAKFEvY+jObKSGkAgAKFEvY+jObKSGkAgAKGiokS9j6M5spIaQCAAoUS9j6M5spIaQCAAoUS9j6M5spIaQCAAoaKiogs=",
|
|
255
262
|
},
|
|
256
263
|
meta: {
|
|
257
264
|
metric: 0.00007258403509477666,
|
|
@@ -904,6 +911,13 @@ export const kernels = {
|
|
|
904
911
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (1.106774 * ((x + (0.034298 * (x ** 3))) / (abs((0.995 + (0.378089 * (x * x)))) < 1e-4 ? 1e-4 : (0.995 + (0.378089 * (x * x))))))",
|
|
905
912
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACnYBdABEeQJhp1i18T8gAEQp7KLogY+hPyAAIAAgAKKioqBE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgmUQtQxzr4jYaP6VE16NwPQrX7z9Ezox+NJwy2D8gACAAoqKgpqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
|
|
906
913
|
},
|
|
914
|
+
fast: {
|
|
915
|
+
js: "((x) => Math.sin(Math.sin(Math.atan(x))))",
|
|
916
|
+
eval: ((x) => Math.sin(Math.sin(Math.atan(x)))),
|
|
917
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return sinf(sinf(atanf(x)));\n}",
|
|
918
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.sin(torch.sin(torch.atan(x)))",
|
|
919
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNzaW4AAQNlbnYEYXRhbgABAwIBAAcJAQVzcGVhcgACCgwBCgAgABABEAAQAAs=",
|
|
920
|
+
},
|
|
907
921
|
meta: {
|
|
908
922
|
metric: 0.00004650870031371604,
|
|
909
923
|
level: 3,
|
|
@@ -1216,25 +1230,25 @@ export const kernels = {
|
|
|
1216
1230
|
"logit_ml": {
|
|
1217
1231
|
id: "logit_ml",
|
|
1218
1232
|
precise: {
|
|
1219
|
-
js: "((x) =>
|
|
1220
|
-
eval: ((x) =>
|
|
1221
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-
|
|
1222
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return
|
|
1223
|
-
wasmBase64: "
|
|
1233
|
+
js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x))))))))",
|
|
1234
|
+
eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((1 - x)) < 1e-4 && ((1 - x)) > -1e-4 ? (((1 - x)) >= 0 ? 1e-4 : -1e-4) : ((1 - x)))))))),
|
|
1235
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((1f - x)), 1.0e-4f), (1f - x))), -1.0e4f), 1.0e4f)));\n}",
|
|
1236
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((x / (abs((1 - x)) < 1e-4 ? 1e-4 : (1 - x))), min=1e-30))",
|
|
1237
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQpLAUkAIABEAAAAAAAA8D8gAKGZRC1DHOviNho/pUQAAAAAAADwPyAAoaajRAAAAAAAiMPApUQAAAAAAIjDQKREoMLr/ktItDmlEAAL",
|
|
1224
1238
|
},
|
|
1225
1239
|
fast: {
|
|
1226
|
-
js: "((x) => ((
|
|
1227
|
-
eval: ((x) => ((
|
|
1228
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1229
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1230
|
-
wasmBase64: "
|
|
1240
|
+
js: "((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x))))))))",
|
|
1241
|
+
eval: ((x) => Math.log(Math.max(1e-30, Math.min(1e4, Math.max(-1e4, (x) / (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) < 1e-4 && ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) > -1e-4 ? (((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)) >= 0 ? 1e-4 : -1e-4) : ((Math.min(1e4, Math.max(-1e4, (x) / ((x) < 1e-4 && (x) > -1e-4 ? ((x) >= 0 ? 1e-4 : -1e-4) : (x)))) - x)))))))),
|
|
1242
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return logf(fmaxf(1.0e-30f, fminf(fmaxf((x / copysignf(fmaxf(fabsf((fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x)), 1.0e-4f), (fminf(fmaxf((x / copysignf(fmaxf(fabsf(x), 1.0e-4f), x)), -1.0e4f), 1.0e4f) - x))), -1.0e4f), 1.0e4f)));\n}",
|
|
1243
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.log(torch.clamp((x / (abs(((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x)) < 1e-4 ? 1e-4 : ((x / (abs(x) < 1e-4 ? 1e-4 : x)) - x))), min=1e-30))",
|
|
1244
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNsb2cAAQMCAQAHCQEFc3BlYXIAAQqIAQGFAQAgACAAIACZRC1DHOviNho/pSAApqNEAAAAAACIw8ClRAAAAAAAiMNApCAAoZlELUMc6+I2Gj+lIAAgAJlELUMc6+I2Gj+lIACmo0QAAAAAAIjDwKVEAAAAAACIw0CkIAChpqNEAAAAAACIw8ClRAAAAAAAiMNApESgwuv+S0i0OaUQAAs=",
|
|
1231
1245
|
},
|
|
1232
1246
|
meta: {
|
|
1233
|
-
metric: 0
|
|
1234
|
-
level:
|
|
1235
|
-
formulaCost:
|
|
1247
|
+
metric: 0,
|
|
1248
|
+
level: 5,
|
|
1249
|
+
formulaCost: 25,
|
|
1236
1250
|
exactCost: 27,
|
|
1237
|
-
speedupVsExact:
|
|
1251
|
+
speedupVsExact: 1.08,
|
|
1238
1252
|
vsIterative: null,
|
|
1239
1253
|
},
|
|
1240
1254
|
},
|
|
@@ -1272,6 +1286,13 @@ export const kernels = {
|
|
|
1272
1286
|
py: "import torch\n\ndef spear_fn(g, l):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (100 * (g / (abs((g + l)) < 1e-4 ? 1e-4 : (g + l))))",
|
|
1273
1287
|
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAo7ATkARAAAAAAAAFlAIAAgACABoJlELUMc6+I2Gj+lIAAgAaCmo0QAAAAAAIjDwKVEAAAAAACIw0Ckogs=",
|
|
1274
1288
|
},
|
|
1289
|
+
fast: {
|
|
1290
|
+
js: "((g, l) => (85.981607 * Math.min(1e4, Math.max(-1e4, (g) / (((g + l)) < 1e-4 && ((g + l)) > -1e-4 ? (((g + l)) >= 0 ? 1e-4 : -1e-4) : ((g + l)))))))",
|
|
1291
|
+
eval: ((g, l) => (85.981607 * Math.min(1e4, Math.max(-1e4, (g) / (((g + l)) < 1e-4 && ((g + l)) > -1e-4 ? (((g + l)) >= 0 ? 1e-4 : -1e-4) : ((g + l))))))),
|
|
1292
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (85.981607f * fminf(fmaxf((g / copysignf(fmaxf(fabsf((g + l)), 1.0e-4f), (g + l))), -1.0e4f), 1.0e4f));\n}",
|
|
1293
|
+
py: "import torch\n\ndef spear_fn(g, l):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (85.981607 * (g / (abs((g + l)) < 1e-4 ? 1e-4 : (g + l))))",
|
|
1294
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAAo7ATkARJShKqbSflVAIAAgACABoJlELUMc6+I2Gj+lIAAgAaCmo0QAAAAAAIjDwKVEAAAAAACIw0Ckogs=",
|
|
1295
|
+
},
|
|
1275
1296
|
meta: {
|
|
1276
1297
|
metric: 1.836172557108052e-29,
|
|
1277
1298
|
level: 2,
|
|
@@ -1284,14 +1305,14 @@ export const kernels = {
|
|
|
1284
1305
|
"implied_vol": {
|
|
1285
1306
|
id: "implied_vol",
|
|
1286
1307
|
precise: {
|
|
1287
|
-
js: "((k,
|
|
1288
|
-
eval: ((k,
|
|
1289
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1290
|
-
py: "import torch\n\ndef spear_fn(k,
|
|
1291
|
-
wasmBase64: "
|
|
1308
|
+
js: "((k, s, t, c) => ((-1.1629327259438174 * (Math.min(1e4, Math.max(-1e4, (k) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s)))) * (Math.min(1e4, Math.max(-1e4, (0.205774) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))) + Math.sqrt(Math.abs((3.267127 + c)))))) + 6.6139818048422185))",
|
|
1309
|
+
eval: ((k, s, t, c) => ((-1.1629327259438174 * (Math.min(1e4, Math.max(-1e4, (k) / ((s) < 1e-4 && (s) > -1e-4 ? ((s) >= 0 ? 1e-4 : -1e-4) : (s)))) * (Math.min(1e4, Math.max(-1e4, (0.205774) / ((t) < 1e-4 && (t) > -1e-4 ? ((t) >= 0 ? 1e-4 : -1e-4) : (t)))) + Math.sqrt(Math.abs((3.267127 + c)))))) + 6.6139818048422185)),
|
|
1310
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-1.162933f * (fminf(fmaxf((k / copysignf(fmaxf(fabsf(s), 1.0e-4f), s)), -1.0e4f), 1.0e4f) * (fminf(fmaxf((0.205774f / copysignf(fmaxf(fabsf(t), 1.0e-4f), t)), -1.0e4f), 1.0e4f) + sqrtf(fabsf((3.267127f + c)))))) + 6.613982f);\n}",
|
|
1311
|
+
py: "import torch\n\ndef spear_fn(k, s, t, c):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-1.162933 * ((k / (abs(s) < 1e-4 ? 1e-4 : s)) * ((0.205774 / (abs(t) < 1e-4 ? 1e-4 : t)) + torch.sqrt(torch.abs((3.267127 + c)))))) + 6.613982)",
|
|
1312
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AwIBAAcJAQVzcGVhcgAACn0BewBEeweWWF+b8r8gACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKRERP0ubM1Wyj8gAplELUMc6+I2Gj+lIAKmo0QAAAAAAIjDwKVEAAAAAACIw0CkRFsHB3sTIwpAIAOgmZ+goqJEqItwpbd0GkCgCw==",
|
|
1292
1313
|
},
|
|
1293
1314
|
meta: {
|
|
1294
|
-
metric: 0.
|
|
1315
|
+
metric: 0.9250539868167686,
|
|
1295
1316
|
level: 0,
|
|
1296
1317
|
formulaCost: null,
|
|
1297
1318
|
exactCost: null,
|
|
@@ -1427,18 +1448,25 @@ export const kernels = {
|
|
|
1427
1448
|
"grover_amplitude": {
|
|
1428
1449
|
id: "grover_amplitude",
|
|
1429
1450
|
precise: {
|
|
1430
|
-
js: "((k) => ((-
|
|
1431
|
-
eval: ((k) => ((-
|
|
1432
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-
|
|
1433
|
-
py: "import torch\n\ndef spear_fn(k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.
|
|
1434
|
-
wasmBase64: "
|
|
1451
|
+
js: "((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))))",
|
|
1452
|
+
eval: ((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))))))))),
|
|
1453
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(sinf((asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))) + (2f * (k * asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))))))), 2.0f);\n}",
|
|
1454
|
+
py: "import torch\n\ndef spear_fn(m, n, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))) * torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))))",
|
|
1455
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCFgIDZW52A3NpbgABA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAIKogIBnwIAIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABRAAAAAAAAABAIAIgACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKSZn0QAAAAAAADwv6VEAAAAAAAA8D+kEAGioqAQACAAIAGZRC1DHOviNho/pSABpqNEAAAAAACIw8ClRAAAAAAAiMNApJmfRAAAAAAAAPC/pUQAAAAAAADwP6QQAUQAAAAAAAAAQCACIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABoqKgEACiCw==",
|
|
1456
|
+
},
|
|
1457
|
+
fast: {
|
|
1458
|
+
js: "((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))))",
|
|
1459
|
+
eval: ((m, n, k) => (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n)))))))))))))) * (Math.sin((Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))) + (2 * (k * Math.asin(Math.max(-1, Math.min(1, Math.sqrt(Math.abs(Math.min(1e4, Math.max(-1e4, (m) / ((n) < 1e-4 && (n) > -1e-4 ? ((n) >= 0 ? 1e-4 : -1e-4) : (n))))))))))))))),
|
|
1460
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return powf(sinf((asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))) + (2f * (k * asinf(fmaxf(-1.0f, fminf(1.0f, sqrtf(fabsf(fminf(fmaxf((m / copysignf(fmaxf(fabsf(n), 1.0e-4f), n)), -1.0e4f), 1.0e4f)))))))))), 2.0f);\n}",
|
|
1461
|
+
py: "import torch\n\ndef spear_fn(m, n, k):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))) * torch.sin((torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)) + (2 * (k * torch.asin(torch.clamp(torch.sqrt(torch.abs((m / (abs(n) < 1e-4 ? 1e-4 : n)))), -1.0, 1.0)))))))",
|
|
1462
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCFgIDZW52A3NpbgABA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAIKogIBnwIAIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABRAAAAAAAAABAIAIgACABmUQtQxzr4jYaP6UgAaajRAAAAAAAiMPApUQAAAAAAIjDQKSZn0QAAAAAAADwv6VEAAAAAAAA8D+kEAGioqAQACAAIAGZRC1DHOviNho/pSABpqNEAAAAAACIw8ClRAAAAAAAiMNApJmfRAAAAAAAAPC/pUQAAAAAAADwP6QQAUQAAAAAAAAAQCACIAAgAZlELUMc6+I2Gj+lIAGmo0QAAAAAAIjDwKVEAAAAAACIw0CkmZ9EAAAAAAAA8L+lRAAAAAAAAPA/pBABoqKgEACiCw==",
|
|
1435
1463
|
},
|
|
1436
1464
|
meta: {
|
|
1437
|
-
metric:
|
|
1438
|
-
level:
|
|
1439
|
-
formulaCost:
|
|
1465
|
+
metric: 8.312261599931228e-32,
|
|
1466
|
+
level: 2,
|
|
1467
|
+
formulaCost: 76,
|
|
1440
1468
|
exactCost: 48,
|
|
1441
|
-
speedupVsExact:
|
|
1469
|
+
speedupVsExact: 0.631578947368421,
|
|
1442
1470
|
vsIterative: null,
|
|
1443
1471
|
},
|
|
1444
1472
|
},
|
|
@@ -1469,6 +1497,13 @@ export const kernels = {
|
|
|
1469
1497
|
py: "import torch\n\ndef spear_fn(a, b, ap, bp):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.abs((((-torch.cos((a - b))) + (-torch.cos((ap - b)))) - ((-torch.cos((a - bp))) - (-torch.cos((ap - bp))))))",
|
|
1470
1498
|
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AgsBA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAQooASYAIAAgAaEQAJogAiABoRAAmqAgACADoRAAmiACIAOhEACaoaGZCw==",
|
|
1471
1499
|
},
|
|
1500
|
+
fast: {
|
|
1501
|
+
js: "((a, b, ap, bp) => Math.abs((((-Math.cos((a - b))) + (-Math.cos((ap - b)))) - ((-Math.cos((a - bp))) - (-Math.cos((ap - bp)))))))",
|
|
1502
|
+
eval: ((a, b, ap, bp) => Math.abs((((-Math.cos((a - b))) + (-Math.cos((ap - b)))) - ((-Math.cos((a - bp))) - (-Math.cos((ap - bp))))))),
|
|
1503
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fabsf((((-cosf((a - b))) + (-cosf((ap - b)))) - ((-cosf((a - bp))) - (-cosf((ap - bp))))));\n}",
|
|
1504
|
+
py: "import torch\n\ndef spear_fn(a, b, ap, bp):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.abs((((-torch.cos((a - b))) + (-torch.cos((ap - b)))) - ((-torch.cos((a - bp))) - (-torch.cos((ap - bp))))))",
|
|
1505
|
+
wasmBase64: "AGFzbQEAAAABDgJgBHx8fHwBfGABfAF8AgsBA2VudgNjb3MAAQMCAQAHCQEFc3BlYXIAAQooASYAIAAgAaEQAJogAiABoRAAmqAgACADoRAAmiACIAOhEACaoaGZCw==",
|
|
1506
|
+
},
|
|
1472
1507
|
meta: {
|
|
1473
1508
|
metric: 2.1055469858256505e-32,
|
|
1474
1509
|
level: 2,
|
|
@@ -1556,37 +1591,51 @@ export const kernels = {
|
|
|
1556
1591
|
"qfi_dephasing": {
|
|
1557
1592
|
id: "qfi_dephasing",
|
|
1558
1593
|
precise: {
|
|
1559
|
-
js: "((n, t, g) => ((
|
|
1560
|
-
eval: ((n, t, g) => ((
|
|
1561
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1562
|
-
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1563
|
-
wasmBase64: "
|
|
1594
|
+
js: "((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t)))))))))",
|
|
1595
|
+
eval: ((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t))))))))),
|
|
1596
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(n, 2.0f) * (powf(t, 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(n, 2.0f) * (g * t))))))));\n}",
|
|
1597
|
+
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((n * n) * ((t * t) * torch.exp(torch.clamp((-((n * n) * (g * t))), -50.0, 50.0))))",
|
|
1598
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCCwEDZW52A2V4cAABAwIBAAcJAQVzcGVhcgABCjIBMAAgACAAoiABIAGiIAAgAKIgAiABoqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKKiCw==",
|
|
1599
|
+
},
|
|
1600
|
+
fast: {
|
|
1601
|
+
js: "((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t)))))))))",
|
|
1602
|
+
eval: ((n, t, g) => ((n) * (n) * ((t) * (t) * Math.exp(Math.max(-50, Math.min(50, (-((n) * (n) * (g * t))))))))),
|
|
1603
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(n, 2.0f) * (powf(t, 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(powf(n, 2.0f) * (g * t))))))));\n}",
|
|
1604
|
+
py: "import torch\n\ndef spear_fn(n, t, g):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((n * n) * ((t * t) * torch.exp(torch.clamp((-((n * n) * (g * t))), -50.0, 50.0))))",
|
|
1605
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCCwEDZW52A2V4cAABAwIBAAcJAQVzcGVhcgABCjIBMAAgACAAoiABIAGiIAAgAKIgAiABoqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKKiCw==",
|
|
1564
1606
|
},
|
|
1565
1607
|
meta: {
|
|
1566
|
-
metric: 1.
|
|
1567
|
-
level:
|
|
1568
|
-
formulaCost:
|
|
1608
|
+
metric: 1.6734673238482507e-31,
|
|
1609
|
+
level: 2,
|
|
1610
|
+
formulaCost: 28,
|
|
1569
1611
|
exactCost: 22,
|
|
1570
|
-
speedupVsExact: 0.
|
|
1571
|
-
vsIterative: {"label":"BFGS optimisation","speedup":
|
|
1612
|
+
speedupVsExact: 0.7857142857142857,
|
|
1613
|
+
vsIterative: {"label":"BFGS optimisation","speedup":28.6},
|
|
1572
1614
|
},
|
|
1573
1615
|
},
|
|
1574
1616
|
"amp_damp_fid": {
|
|
1575
1617
|
id: "amp_damp_fid",
|
|
1576
1618
|
precise: {
|
|
1577
|
-
js: "((th, t) => ((
|
|
1578
|
-
eval: ((th, t) => ((
|
|
1579
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1580
|
-
py: "import torch\n\ndef spear_fn(th, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((
|
|
1581
|
-
wasmBase64: "
|
|
1619
|
+
js: "((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))))))",
|
|
1620
|
+
eval: ((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t))))))))),
|
|
1621
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((powf(cosf(th), 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t)))))) + (powf(sinf(th), 2.0f) * (2f - expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t))))))));\n}",
|
|
1622
|
+
py: "import torch\n\ndef spear_fn(th, g, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.cos(th) * torch.cos(th)) * torch.exp(torch.clamp((-(g * t)), -50.0, 50.0))) + ((torch.sin(th) * torch.sin(th)) * (2 - torch.exp(torch.clamp((-(g * t)), -50.0, 50.0)))))",
|
|
1623
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCHwMDZW52A2V4cAABA2VudgNzaW4AAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAMKWwFZACAAEAIgABACoiABIAKimkQAAAAAAABJwKVEAAAAAAAASUCkEACiIAAQASAAEAGiRAAAAAAAAABAIAEgAqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKGioAs=",
|
|
1624
|
+
},
|
|
1625
|
+
fast: {
|
|
1626
|
+
js: "((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))))))",
|
|
1627
|
+
eval: ((th, g, t) => (((Math.cos(th)) * (Math.cos(th)) * Math.exp(Math.max(-50, Math.min(50, (-(g * t)))))) + ((Math.sin(th)) * (Math.sin(th)) * (2 - Math.exp(Math.max(-50, Math.min(50, (-(g * t))))))))),
|
|
1628
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((powf(cosf(th), 2.0f) * expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t)))))) + (powf(sinf(th), 2.0f) * (2f - expf(fmaxf(-50.0f, fminf(50.0f, (-(g * t))))))));\n}",
|
|
1629
|
+
py: "import torch\n\ndef spear_fn(th, g, t):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.cos(th) * torch.cos(th)) * torch.exp(torch.clamp((-(g * t)), -50.0, 50.0))) + ((torch.sin(th) * torch.sin(th)) * (2 - torch.exp(torch.clamp((-(g * t)), -50.0, 50.0)))))",
|
|
1630
|
+
wasmBase64: "AGFzbQEAAAABDQJgA3x8fAF8YAF8AXwCHwMDZW52A2V4cAABA2VudgNzaW4AAQNlbnYDY29zAAEDAgEABwkBBXNwZWFyAAMKWwFZACAAEAIgABACoiABIAKimkQAAAAAAABJwKVEAAAAAAAASUCkEACiIAAQASAAEAGiRAAAAAAAAABAIAEgAqKaRAAAAAAAAEnApUQAAAAAAABJQKQQAKGioAs=",
|
|
1582
1631
|
},
|
|
1583
1632
|
meta: {
|
|
1584
|
-
metric: 0
|
|
1585
|
-
level:
|
|
1586
|
-
formulaCost:
|
|
1633
|
+
metric: 0,
|
|
1634
|
+
level: 5,
|
|
1635
|
+
formulaCost: 90,
|
|
1587
1636
|
exactCost: 24,
|
|
1588
|
-
speedupVsExact: 0.
|
|
1589
|
-
vsIterative: {"label":"Kraus ops 4×4 matmul","speedup":0.
|
|
1637
|
+
speedupVsExact: 0.26666666666666666,
|
|
1638
|
+
vsIterative: {"label":"Kraus ops 4×4 matmul","speedup":0.5},
|
|
1590
1639
|
},
|
|
1591
1640
|
},
|
|
1592
1641
|
"loschmidt_rate": {
|
|
@@ -1617,14 +1666,21 @@ export const kernels = {
|
|
|
1617
1666
|
"bessel_i0e": {
|
|
1618
1667
|
id: "bessel_i0e",
|
|
1619
1668
|
precise: {
|
|
1620
|
-
js: "((x) => ((-0.
|
|
1621
|
-
eval: ((x) => ((-0.
|
|
1622
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.
|
|
1623
|
-
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.
|
|
1624
|
-
wasmBase64: "
|
|
1669
|
+
js: "((x) => ((-0.23493996284905358 * Math.min(1e4, Math.max(-1e4, ((x + -2.458142)) / (((0.798564 + x)) < 1e-4 && ((0.798564 + x)) > -1e-4 ? (((0.798564 + x)) >= 0 ? 1e-4 : -1e-4) : ((0.798564 + x)))))) + 0.2839492702683716))",
|
|
1670
|
+
eval: ((x) => ((-0.23493996284905358 * Math.min(1e4, Math.max(-1e4, ((x + -2.458142)) / (((0.798564 + x)) < 1e-4 && ((0.798564 + x)) > -1e-4 ? (((0.798564 + x)) >= 0 ? 1e-4 : -1e-4) : ((0.798564 + x)))))) + 0.2839492702683716)),
|
|
1671
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((-0.23494f * fminf(fmaxf(((x + -2.458142f) / copysignf(fmaxf(fabsf((0.798564f + x)), 1.0e-4f), (0.798564f + x))), -1.0e4f), 1.0e4f)) + 0.283949f);\n}",
|
|
1672
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((-0.23494 * ((x + -2.458142) / (abs((0.798564 + x)) < 1e-4 ? 1e-4 : (0.798564 + x)))) + 0.283949)",
|
|
1673
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACl0BWwBE3+V6QIMSzr8gAERrZFdaRqoDwKBECmr4FtaN6T8gAKCZRC1DHOviNho/pUQKavgW1o3pPyAAoKajRAAAAAAAiMPApUQAAAAAAIjDQKSiRGqlYY85LNI/oAs=",
|
|
1674
|
+
},
|
|
1675
|
+
fast: {
|
|
1676
|
+
js: "((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578))))))",
|
|
1677
|
+
eval: ((x) => Math.min(1e4, Math.max(-1e4, (2.895344) / ((((x + (1.447672 + x)) * 0.661578)) < 1e-4 && (((x + (1.447672 + x)) * 0.661578)) > -1e-4 ? ((((x + (1.447672 + x)) * 0.661578)) >= 0 ? 1e-4 : -1e-4) : (((x + (1.447672 + x)) * 0.661578)))))),
|
|
1678
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(fmaxf((2.895344f / copysignf(fmaxf(fabsf(((x + (1.447672f + x)) * 0.661578f)), 1.0e-4f), ((x + (1.447672f + x)) * 0.661578f))), -1.0e4f), 1.0e4f);\n}",
|
|
1679
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (2.895344 / (abs(((x + (1.447672 + x)) * 0.661578)) < 1e-4 ? 1e-4 : ((x + (1.447672 + x)) * 0.661578)))",
|
|
1680
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AwIBAAcJAQVzcGVhcgAACmABXgBEzVt1HaopB0AgAETNW3Udqin3PyAAoKBETBk4oKUr5T+imUQtQxzr4jYaP6UgAETNW3Udqin3PyAAoKBETBk4oKUr5T+ipqNEAAAAAACIw8ClRAAAAAAAiMNApAs=",
|
|
1625
1681
|
},
|
|
1626
1682
|
meta: {
|
|
1627
|
-
metric: 0.
|
|
1683
|
+
metric: 0.00003054908318748102,
|
|
1628
1684
|
level: 2,
|
|
1629
1685
|
formulaCost: 8,
|
|
1630
1686
|
exactCost: 24,
|
|
@@ -1641,6 +1697,13 @@ export const kernels = {
|
|
|
1641
1697
|
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.229391 * ((torch.exp(torch.clamp(m, -50.0, 50.0)) * (torch.asin(torch.clamp(m, -1.0, 1.0)) ** 3)) + m)) + 1.642805)",
|
|
1642
1698
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AhYCA2VudgNleHAAAQNlbnYEYXNpbgABAwIBAAcJAQVzcGVhcgACCn4BfABECnUC8rJczT8gAEQAAAAAAABJwKVEAAAAAAAASUCkEAAgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAEgAEQAAAAAAADwv6VEAAAAAAAA8D+kEAGioqIgAKCiRB1ZwOrtSPo/oAs=",
|
|
1643
1699
|
},
|
|
1700
|
+
fast: {
|
|
1701
|
+
js: "((m) => (((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * ((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * Math.min(1e4, Math.max(-1e4, (Math.asin(Math.max(-1, Math.min(1, m)))) / ((((m) * (m)) * ((m) * (m))) < 1e-4 && (((m) * (m)) * ((m) * (m))) > -1e-4 ? ((((m) * (m)) * ((m) * (m))) >= 0 ? 1e-4 : -1e-4) : (((m) * (m)) * ((m) * (m))))))))",
|
|
1702
|
+
eval: ((m) => (((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * ((Math.asin(Math.max(-1, Math.min(1, m)))) * (Math.asin(Math.max(-1, Math.min(1, m))))) * Math.min(1e4, Math.max(-1e4, (Math.asin(Math.max(-1, Math.min(1, m)))) / ((((m) * (m)) * ((m) * (m))) < 1e-4 && (((m) * (m)) * ((m) * (m))) > -1e-4 ? ((((m) * (m)) * ((m) * (m))) >= 0 ? 1e-4 : -1e-4) : (((m) * (m)) * ((m) * (m)))))))),
|
|
1703
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return (powf(powf(asinf(fmaxf(-1.0f, fminf(1.0f, m))), 2.0f), 2.0f) * fminf(fmaxf((asinf(fmaxf(-1.0f, fminf(1.0f, m))) / copysignf(fmaxf(fabsf(powf(powf(m, 2.0f), 2.0f)), 1.0e-4f), powf(powf(m, 2.0f), 2.0f))), -1.0e4f), 1.0e4f));\n}",
|
|
1704
|
+
py: "import torch\n\ndef spear_fn(m):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return (((torch.asin(torch.clamp(m, -1.0, 1.0)) * torch.asin(torch.clamp(m, -1.0, 1.0))) * (torch.asin(torch.clamp(m, -1.0, 1.0)) * torch.asin(torch.clamp(m, -1.0, 1.0)))) * (torch.asin(torch.clamp(m, -1.0, 1.0)) / (abs(((m * m) * (m * m))) < 1e-4 ? 1e-4 : ((m * m) * (m * m)))))",
|
|
1705
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgwBA2VudgRhc2luAAEDAgEABwkBBXNwZWFyAAEKuAEBtQEAIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAoiAARAAAAAAAAPC/pUQAAAAAAADwP6QQACAARAAAAAAAAPC/pUQAAAAAAADwP6QQAKKiIABEAAAAAAAA8L+lRAAAAAAAAPA/pBAAIAAgAKIgACAAoqKZRC1DHOviNho/pSAAIACiIAAgAKKipqNEAAAAAACIw8ClRAAAAAAAiMNApKIL",
|
|
1706
|
+
},
|
|
1644
1707
|
meta: {
|
|
1645
1708
|
metric: 0.004333603318947968,
|
|
1646
1709
|
level: 2,
|
|
@@ -1653,18 +1716,18 @@ export const kernels = {
|
|
|
1653
1716
|
"kepler_solver": {
|
|
1654
1717
|
id: "kepler_solver",
|
|
1655
1718
|
precise: {
|
|
1656
|
-
js: "((
|
|
1657
|
-
eval: ((
|
|
1658
|
-
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((
|
|
1659
|
-
py: "import torch\n\ndef spear_fn(
|
|
1660
|
-
wasmBase64: "
|
|
1719
|
+
js: "((M, e) => ((0.2499447407678102 * (((M + (M + e)) + (0.749715 * (M + e))) + Math.min(3.875643, (2.049437 * (M + e))))) + -0.21378713578869088))",
|
|
1720
|
+
eval: ((M, e) => ((0.2499447407678102 * (((M + (M + e)) + (0.749715 * (M + e))) + Math.min(3.875643, (2.049437 * (M + e))))) + -0.21378713578869088)),
|
|
1721
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return ((0.249945f * (((M + (M + e)) + (0.749715f * (M + e))) + fminf(3.875643f, (2.049437f * (M + e))))) + -0.213787f);\n}",
|
|
1722
|
+
py: "import torch\n\ndef spear_fn(M, e):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return ((0.249945 * (((M + (M + e)) + (0.749715 * (M + e))) + torch.minimum(3.875643, (2.049437 * (M + e))))) + -0.213787)",
|
|
1723
|
+
wasmBase64: "AGFzbQEAAAABDAJgAnx8AXxgAXwBfAMCAQAHCQEFc3BlYXIAAApKAUgARCrVs3Mw/s8/IAAgACABoKBEr0LKT6r95z8gACABoKKgREjF/x1RAQ9AROay0Tk/ZQBAIAAgAaCipKCiRM9LQnpgXcu/oAs=",
|
|
1661
1724
|
},
|
|
1662
1725
|
meta: {
|
|
1663
|
-
metric: 0.
|
|
1726
|
+
metric: 0.006134991867434414,
|
|
1664
1727
|
level: 1,
|
|
1665
|
-
formulaCost:
|
|
1728
|
+
formulaCost: 11,
|
|
1666
1729
|
exactCost: 32,
|
|
1667
|
-
speedupVsExact:
|
|
1730
|
+
speedupVsExact: 2.909090909090909,
|
|
1668
1731
|
vsIterative: null,
|
|
1669
1732
|
},
|
|
1670
1733
|
},
|
|
@@ -1677,6 +1740,13 @@ export const kernels = {
|
|
|
1677
1740
|
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.exp(torch.clamp(x, -50.0, 50.0))",
|
|
1678
1741
|
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQocARoAIABEAAAAAAAAScClRAAAAAAAAElApBAACw==",
|
|
1679
1742
|
},
|
|
1743
|
+
fast: {
|
|
1744
|
+
js: "((x) => Math.min(1.491, Math.exp(Math.max(-50, Math.min(50, x)))))",
|
|
1745
|
+
eval: ((x) => Math.min(1.491, Math.exp(Math.max(-50, Math.min(50, x))))),
|
|
1746
|
+
c: "// Evolved by SPEAR — algebraic only, FP16 safe\n__device__ inline float spear_fn(const float x) {\n return fminf(1.491f, expf(fmaxf(-50.0f, fminf(50.0f, x))));\n}",
|
|
1747
|
+
py: "import torch\n\ndef spear_fn(x):\n # Evolved by SPEAR — zero transcendental ops (exp/erf/tanh free)\n return torch.minimum(1.491, torch.exp(torch.clamp(x, -50.0, 50.0)))",
|
|
1748
|
+
wasmBase64: "AGFzbQEAAAABCwJgAXwBfGABfAF8AgsBA2VudgNleHAAAQMCAQAHCQEFc3BlYXIAAQomASQAREJg5dAi2/c/IABEAAAAAAAAScClRAAAAAAAAElApBAApAs=",
|
|
1749
|
+
},
|
|
1680
1750
|
meta: {
|
|
1681
1751
|
metric: 0,
|
|
1682
1752
|
level: 5,
|
package/package.json
CHANGED