@descix/egpt-math-sdk 0.1.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.
Files changed (114) hide show
  1. package/README.md +224 -0
  2. package/dist/egpt-math-sdk.browser.js +5 -0
  3. package/dist/index.d.ts +100 -0
  4. package/dist/index.js +985 -0
  5. package/dist/notebooks/arithmetic-basics.html +166 -0
  6. package/dist/notebooks/complex-twiddle.html +148 -0
  7. package/dist/notebooks/double-slit-rosetta-qft.html +154 -0
  8. package/dist/notebooks/egpt-fft-test.html +202 -0
  9. package/dist/notebooks/egpt-matrix-test.html +241 -0
  10. package/dist/notebooks/egpt-polynomial-test.html +703 -0
  11. package/dist/notebooks/egpt-prime-composite-test.html +561 -0
  12. package/dist/notebooks/egpt-test-suite.html +1387 -0
  13. package/dist/notebooks/egpt-topology-test.html +410 -0
  14. package/dist/notebooks/factorization-basics.html +131 -0
  15. package/dist/notebooks/fft.html +155 -0
  16. package/dist/notebooks/frqtl-qft-benchmark.html +207 -0
  17. package/dist/notebooks/gallery-atomic-model.html +51 -0
  18. package/dist/notebooks/gallery-big-bang.html +62 -0
  19. package/dist/notebooks/gallery-blackbody.html +52 -0
  20. package/dist/notebooks/gallery-circuit-sat.html +104 -0
  21. package/dist/notebooks/gallery-collision-matrix-3d.html +51 -0
  22. package/dist/notebooks/gallery-double-slit.html +53 -0
  23. package/dist/notebooks/gallery-gun-chamber.html +62 -0
  24. package/dist/notebooks/gallery-particle-walk-3d.html +53 -0
  25. package/dist/notebooks/gallery-wave-interference.html +52 -0
  26. package/dist/notebooks/getting-started-hello-frqtl.html +53 -0
  27. package/dist/notebooks/iso-canonical-chain.html +203 -0
  28. package/dist/notebooks/iso-entropy-log.html +127 -0
  29. package/dist/notebooks/iso-fft-polynomial.html +136 -0
  30. package/dist/notebooks/iso-matrix-four-views.html +131 -0
  31. package/dist/notebooks/iso-number-theory-four-views.html +99 -0
  32. package/dist/notebooks/iso-pi-log-fraction-loop.html +140 -0
  33. package/dist/notebooks/matrix.html +202 -0
  34. package/dist/notebooks/notebooks.json +240 -0
  35. package/dist/notebooks/polynomials.html +201 -0
  36. package/dist/notebooks/prime-composite.html +268 -0
  37. package/dist/notebooks/rational-core.html +179 -0
  38. package/dist/notebooks/reference-egpt-fft-test.html +187 -0
  39. package/dist/notebooks/reference-order-finder-test.html +196 -0
  40. package/dist/notebooks/reference-prime-atom-polynomial-test.html +542 -0
  41. package/dist/notebooks/reference-solve-polynomial-system-test.html +471 -0
  42. package/dist/notebooks/scaled-vectors.html +112 -0
  43. package/dist/notebooks/stats.html +206 -0
  44. package/dist/notebooks/transcendentals.html +195 -0
  45. package/dist/notebooks/view-vendored-d3.html +78 -0
  46. package/dist/vendor/d3-array/src/array.js +4 -0
  47. package/dist/vendor/d3-array/src/ascending.js +3 -0
  48. package/dist/vendor/d3-array/src/bin.js +125 -0
  49. package/dist/vendor/d3-array/src/bisect.js +9 -0
  50. package/dist/vendor/d3-array/src/bisector.js +56 -0
  51. package/dist/vendor/d3-array/src/blur.js +115 -0
  52. package/dist/vendor/d3-array/src/constant.js +3 -0
  53. package/dist/vendor/d3-array/src/count.js +18 -0
  54. package/dist/vendor/d3-array/src/cross.js +33 -0
  55. package/dist/vendor/d3-array/src/cumsum.js +6 -0
  56. package/dist/vendor/d3-array/src/descending.js +7 -0
  57. package/dist/vendor/d3-array/src/deviation.js +6 -0
  58. package/dist/vendor/d3-array/src/difference.js +11 -0
  59. package/dist/vendor/d3-array/src/disjoint.js +15 -0
  60. package/dist/vendor/d3-array/src/every.js +10 -0
  61. package/dist/vendor/d3-array/src/extent.js +29 -0
  62. package/dist/vendor/d3-array/src/filter.js +11 -0
  63. package/dist/vendor/d3-array/src/fsum.js +69 -0
  64. package/dist/vendor/d3-array/src/greatest.js +29 -0
  65. package/dist/vendor/d3-array/src/greatestIndex.js +19 -0
  66. package/dist/vendor/d3-array/src/group.js +65 -0
  67. package/dist/vendor/d3-array/src/groupSort.js +10 -0
  68. package/dist/vendor/d3-array/src/identity.js +3 -0
  69. package/dist/vendor/d3-array/src/index.js +57 -0
  70. package/dist/vendor/d3-array/src/intersection.js +19 -0
  71. package/dist/vendor/d3-array/src/least.js +29 -0
  72. package/dist/vendor/d3-array/src/leastIndex.js +19 -0
  73. package/dist/vendor/d3-array/src/map.js +5 -0
  74. package/dist/vendor/d3-array/src/max.js +20 -0
  75. package/dist/vendor/d3-array/src/maxIndex.js +22 -0
  76. package/dist/vendor/d3-array/src/mean.js +19 -0
  77. package/dist/vendor/d3-array/src/median.js +9 -0
  78. package/dist/vendor/d3-array/src/merge.js +9 -0
  79. package/dist/vendor/d3-array/src/min.js +20 -0
  80. package/dist/vendor/d3-array/src/minIndex.js +22 -0
  81. package/dist/vendor/d3-array/src/mode.js +28 -0
  82. package/dist/vendor/d3-array/src/nice.js +18 -0
  83. package/dist/vendor/d3-array/src/number.js +20 -0
  84. package/dist/vendor/d3-array/src/pairs.js +15 -0
  85. package/dist/vendor/d3-array/src/permute.js +3 -0
  86. package/dist/vendor/d3-array/src/quantile.js +47 -0
  87. package/dist/vendor/d3-array/src/quickselect.js +53 -0
  88. package/dist/vendor/d3-array/src/range.js +13 -0
  89. package/dist/vendor/d3-array/src/rank.js +24 -0
  90. package/dist/vendor/d3-array/src/reduce.js +14 -0
  91. package/dist/vendor/d3-array/src/reverse.js +4 -0
  92. package/dist/vendor/d3-array/src/scan.js +6 -0
  93. package/dist/vendor/d3-array/src/shuffle.js +13 -0
  94. package/dist/vendor/d3-array/src/some.js +10 -0
  95. package/dist/vendor/d3-array/src/sort.js +39 -0
  96. package/dist/vendor/d3-array/src/subset.js +5 -0
  97. package/dist/vendor/d3-array/src/sum.js +18 -0
  98. package/dist/vendor/d3-array/src/superset.js +19 -0
  99. package/dist/vendor/d3-array/src/threshold/freedmanDiaconis.js +7 -0
  100. package/dist/vendor/d3-array/src/threshold/scott.js +7 -0
  101. package/dist/vendor/d3-array/src/threshold/sturges.js +5 -0
  102. package/dist/vendor/d3-array/src/ticks.js +55 -0
  103. package/dist/vendor/d3-array/src/transpose.js +15 -0
  104. package/dist/vendor/d3-array/src/union.js +11 -0
  105. package/dist/vendor/d3-array/src/variance.js +25 -0
  106. package/dist/vendor/d3-array/src/zip.js +5 -0
  107. package/dist/vendor/internmap/src/index.js +61 -0
  108. package/dist/vendor/manifest.json +11 -0
  109. package/dist/wasm/egpt_math_sdk_wasm.d.ts +214 -0
  110. package/dist/wasm/egpt_math_sdk_wasm.js +1120 -0
  111. package/dist/wasm/egpt_math_sdk_wasm_bg.wasm +0 -0
  112. package/dist/wasm/egpt_math_sdk_wasm_bg.wasm.d.ts +66 -0
  113. package/dist/wasm/manifest.json +5 -0
  114. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # @descix/egpt-math-sdk
2
+
3
+ **EGPT Math SDK — browser-first exact arithmetic over the rational field**
4
+
5
+ Provides the EGPT Math engine as a pluggable browser package: a bit-exact rational
6
+ arithmetic core (backed by the `egpt_math_sdk_wasm` Rust/WASM crate) behind a
7
+ stable `MathBackendProvider` interface that lets you swap implementations without
8
+ touching calling code.
9
+
10
+ ## What is this
11
+
12
+ EGPT Math replaces the standard floating-point math kernel with **bit-exact rational
13
+ arithmetic over prime-indexed information atoms**. Operations like matrix multiplication,
14
+ polynomial evaluation, and order-finding in quantum simulation run on exact `ℚ` values
15
+ instead of approximations — producing provably correct intermediate results that track
16
+ the EGPT compression chain.
17
+
18
+ This SDK package publishes the browser-runnable surface. The full EGPT math theory,
19
+ Lean proof chains (P=NP capstone, bijection chain), and canonical dev core live in the
20
+ FRAQTL monorepo (`lib/egpt/`).
21
+
22
+ ## Installation
23
+
24
+ ```
25
+ npm install @descix/egpt-math-sdk
26
+ ```
27
+
28
+ ## Browser Usage
29
+
30
+ ```js
31
+ import { createEgptMathSdk } from "@descix/egpt-math-sdk";
32
+
33
+ const sdk = await createEgptMathSdk({
34
+ wasmUrl: new URL("./wasm/egpt_math_sdk_wasm_bg.wasm", import.meta.url).toString(),
35
+ wasmModuleUrl: new URL("./wasm/egpt_math_sdk_wasm.js", import.meta.url).toString()
36
+ });
37
+
38
+ // Derived badge — never hardcoded (truth-in-labeling). Always "wasm-math" in
39
+ // this package: createEgptMathSdk() throws rather than returning an SDK for
40
+ // any other outcome (see §Publish surface below).
41
+ console.log("Backend:", sdk.activeMathBackend); // "wasm-math"
42
+
43
+ // Rational arithmetic — real Rust/WASM compute, no JS math core in this bundle.
44
+ const a = sdk.EGPTReal.fromRational(3n, 4n);
45
+ const b = sdk.EGPTReal.fromRational(1n, 2n);
46
+ const sum = sdk.EGPTMath.add(a, b);
47
+ console.log(sum.toMathString()); // "5/4"
48
+
49
+ // Matrix multiply, routed through the polynomial bijective chain.
50
+ const A = sdk.EGPTMatrix.from([[1n, 2n], [3n, 4n]]);
51
+ const B = sdk.EGPTMatrix.from([[5n, 6n], [7n, 8n]]);
52
+ console.log(sdk.EGPTMatrix.format(sdk.EGPTMatrix.matMul(A, B), "A x B"));
53
+ ```
54
+
55
+ ## Publish surface — WASM-only (CEO standing rule, 2026-07-10)
56
+
57
+ **No JS math-core source ships in `dist/`.** `dist/index.js` is built from
58
+ `src/browser/dist-entry.js` (NOT `src/browser/sdk-entry.js`, which remains the
59
+ DEV source entry used by the local IDE at `/egpt-src/index.js` and is
60
+ unaffected by this rule). Every arithmetic op in the published package is a
61
+ dispatch through the `WasmMathBackendProvider` (real Rust/WASM), never JS
62
+ BigInt PPF math — `scripts/verify-publish-surface.mjs` asserts this on every
63
+ build (probes the built bundle for symbols unique to the concrete
64
+ `lib/egpt/js/model/core/*` implementation, plus a size ceiling; wired into
65
+ `make verify-publish-surface` at the repo root, which also gates
66
+ `@descix/frqtl-sdk`'s equivalent rule for the physics engine).
67
+
68
+ **Shipped:** `EGPTReal`, `EGPTMath`, `EGPTPolynomial` (the 37-op provider
69
+ contract), `EGPTMatrix` (GEMM via the row-is-a-polynomial identity),
70
+ `EGPTFFT` (forward/inverse polynomial transform), the raw `wasm` arena-op
71
+ facade, `metadata`, `activeMathBackend`, `benchmarks.qftBaseline`.
72
+
73
+ **NOT shipped in this dist** (all still fully available in DEV via
74
+ `sdk-entry.js` / `/egpt-src/`) — because each is structurally coupled to the
75
+ concrete js-reference classes (duck-typed on `EGPTReal` instances,
76
+ `_getPPFRationalParts()`, etc.), and reimplementing them against the WASM
77
+ facade is future work, not this Bite's scope:
78
+
79
+ - `EGPTStat` / `EGPTStatData`, `Multilinear`, `OrderFinder`, `EGPTPrimeComposite`,
80
+ `PrimeAtomPolynomial`, `EGPTComplex` / `ComplexEGPTReal` / `TwiddleTable`,
81
+ `EGPTranscendental` (the class — the 37-op `exp2`/`log2` ops ARE shipped on
82
+ `EGPTReal`/`EGPTMath`).
83
+ - The codec system (`Encoding`, `Codec`, `TransformRegistry`, `buildCodecDsl`,
84
+ the encoding classes) and `math.codec`.
85
+ - `EGPTdsp` / `factorizeWithLogRoot` / `presetOptions` / `FraqtlSession` — these
86
+ are already fully WASM-routable (their source, `log-root-order-finding.js`,
87
+ dispatches every hot-loop op through the active backend), but that source
88
+ file statically imports `lib/egpt`'s multi-backend `MathBackendRegistry`
89
+ (shared with the DEV entry) — decoupling it needs a small DI-style refactor,
90
+ flagged as a follow-up rather than done here.
91
+ - `EGPTMatrix.toValueReps` / `.fromValueReps` — point-excluded: the correct op
92
+ (`EGPTPolynomial.toValueRepresentation`/`fromValueRepresentation`, evaluation
93
+ at canonical base nodes 2^0..2^D + Newton-DD inversion) isn't in the 37-op
94
+ provider contract, and substituting the wrong operation would silently
95
+ compute the wrong number — omission-with-a-loud-error was judged safer than
96
+ a silent wrong answer.
97
+
98
+ **Editor harness excluded.** The interactive playground previously shipped at
99
+ `dist/editor/` (a live exerciser of the FULL class surface, including the
100
+ excluded classes above) is excluded from this dist entirely — it remains
101
+ available in DEV via `/egpt-src/editor/`.
102
+
103
+ **Notebooks (`dist/notebooks/`) ship as data, not code**, so their presence
104
+ doesn't itself violate the no-core-source rule — but a subset of them
105
+ reference the excluded classes above and will throw a legible error at
106
+ cell-run time (FAIL LOUD, never a silently wrong answer). Known-runnable
107
+ against this dist: `arithmetic-basics`, `factorization-basics`, `polynomials`,
108
+ `rational-core`, `matrix` (all of `EGPTMatrix` except `toValueReps`/
109
+ `fromValueReps`), `fft`. Known-broken (reference an excluded class):
110
+ `egpt-matrix-test` (uses `toValueReps`), `stats`, `complex-twiddle`,
111
+ `transcendentals`, `prime-composite`, `double-slit-rosetta-qft` (uses
112
+ `math.codec`), the `iso-*`/`egpt-*-test` theorem notebooks (`OrderFinder`,
113
+ `PrimeAtomPolynomial`, `EGPTPrimeComposite`, `EGPTStat`).
114
+
115
+ ## The `MathBackendProvider` contract (BYO #4 — internal, M5)
116
+
117
+ **`MathBackendRegistry` is NOT exported by `@descix/egpt-math-sdk`** — not from
118
+ this package's published `dist/` (§Publish surface above: the dist-only
119
+ entry, `dist-entry.js`, has exactly one backend and never registers a second
120
+ one) and not from the DEV source entry either (`sdk-entry.js` imports
121
+ `MathBackendRegistry` for its own internal use but does not re-export it).
122
+ Do not `import { MathBackendRegistry } from "@descix/egpt-math-sdk"` — that
123
+ import throws (no such export). The registry is monorepo-internal:
124
+
125
+ ```js
126
+ // FRAQTL monorepo development ONLY — not a published package import.
127
+ import { MathBackendRegistry } from "lib/egpt/js/model/backend/MathBackendProvider.js";
128
+
129
+ // Register a custom backend
130
+ MathBackendRegistry.register({
131
+ id: "my-backend",
132
+ fromBigInt: (n) => /* ... */,
133
+ add: (a, b) => /* ... */,
134
+ // ... full 37-op surface (see lib/egpt/js/model/backend/README.md)
135
+ });
136
+
137
+ MathBackendRegistry.select("my-backend");
138
+ // All SDK codec chains and the order-finding QFT loop now execute on your backend.
139
+ ```
140
+
141
+ The contract is defined at `lib/egpt/js/model/backend/README.md` in the FRAQTL
142
+ repository. Status: **INTERNAL** — published only after M5 (V2 transport) proves
143
+ the dispatch path with honest performance numbers, and the registry itself is
144
+ exposed on a public entry (it is not, as of this Bite).
145
+
146
+ ## Packaging policy
147
+
148
+ Published payload is `dist/` and this `README.md` only (`package.json#files`).
149
+ Source trees (`src/`, `scripts/`, Rust crates) are not published.
150
+
151
+ Verification:
152
+ ```bash
153
+ npm run build
154
+ npm run verify:publish-surface
155
+ npm run pack:dry-run
156
+ ```
157
+
158
+ ## CHANGES (M5)
159
+
160
+ **M5.2 — V2 binary transport (2026-06-11)**
161
+
162
+ The integer hot-loop ops (`modPow`, `gcd`, `lcm`) now use Uint8Array binary limb
163
+ transport (`[sign_byte, ...le_magnitude_bytes]`) instead of string marshaling.
164
+ No SharedArrayBuffer — plain ArrayBuffer copies (no COOP/COEP headers required).
165
+ Builds on the `egpt_math_sdk_wasm` crate V2 exports: `mod_pow_v2`, `gcd_v2`, `lcm_v2`.
166
+
167
+ Honest performance (M2 Pro, 100 × modPow(2..101, N-1, N), N=39-bit semiprime):
168
+ - js-reference: 0.47 ms
169
+ - wasm-math V1 (string): 1.76 ms (3.77x)
170
+ - wasm-math V2 (binary): 2.06 ms (4.42x)
171
+ - V2 vs V1 ratio: 1.17x (V2 is slightly slower due to WASM call boundary overhead
172
+ — string parsing was not the dominant cost; boundary crossing is)
173
+
174
+ This confirms: the remaining overhead vs js-reference is WASM call boundary cost,
175
+ not serialization format. A future bulk-operation batching approach would be the next
176
+ meaningful step.
177
+
178
+ **M5.1 — Handle-model upgrade (2026-06-11)**
179
+
180
+ Codec transforms that call EGPTReal instance-method ops (`.toPrimeAtoms()`,
181
+ `.toAtomRoot()`, `.fromAtomVec()`, `.fromAtomRoot()`, `breakSymbolic*`) now route
182
+ through `MathBackendRegistry.active()` via a single dispatch shim
183
+ (`lib/egpt/js/model/backend/handleDispatch.js`). Codec chains running under the
184
+ wasm-math backend now genuinely execute those ops through WASM. 50/50 parity fixtures
185
+ pass (46 original + 4 new instance-op fixtures).
186
+
187
+ ## Architect publication recommendation (M5)
188
+
189
+ **Hold — do not publish as BYO #4 yet.**
190
+
191
+ Grounds: V2 binary transport shows the WASM overhead is dominated by call boundary
192
+ crossing (4.4x vs js-reference), not serialization. The advertised benefit of the BYO
193
+ contract is that third-party backends execute faster or differently than js-reference;
194
+ at 4.4x overhead, an integrator's first experience would be a slowdown. The contract
195
+ design is clean and correct (50/50 parity, FAIL-LOUD throughout); the value proposition
196
+ needs bulk-operation batching or a demonstration workload where WASM compute savings
197
+ dominate boundary cost. Recommendation: ship internally as M5, revisit publish after a
198
+ batching benchmark demonstrates net positive throughput.
199
+
200
+ CEO/EVP decision required before publication.
201
+
202
+ ## In-browser code editor scaffold — REMOVED from this dist (2026-07-10)
203
+
204
+ The interactive editor scaffold (`dist/editor/index.html` + examples +
205
+ theorem demos + tests) previously published here has been excluded from the
206
+ publish surface — see §Publish surface above. It remains available for local
207
+ development at `/egpt-src/editor/` (served by `lib/server/mounts.js` off
208
+ `sdk/egpt-math-sdk/src/editor/`).
209
+
210
+ ## Local Development
211
+
212
+ ```bash
213
+ # Build WASM bridge (requires wasm-pack + Rust toolchain)
214
+ npm run build:wasm-bridge
215
+
216
+ # Build SDK dist
217
+ npm run build
218
+
219
+ # Run parity suite (requires built WASM)
220
+ node --test lib/egpt/js/model/backend/test/parity.test.mjs
221
+
222
+ # V1 vs V2 transport timing
223
+ node sdk/egpt-math-sdk/src/browser/n39-timing.mjs
224
+ ```
@@ -0,0 +1,5 @@
1
+ import { createEgptMathSdk } from "./index.js";
2
+
3
+ if (typeof window !== "undefined") {
4
+ window.EgptMathSdk = { createEgptMathSdk };
5
+ }
@@ -0,0 +1,100 @@
1
+ export type EgptMathSdkInitOptions = {
2
+ wasmUrl?: string;
3
+ wasmModuleUrl?: string;
4
+ };
5
+
6
+ export declare class EGPTReal {
7
+ static fromBigInt(n: bigint | number | string): EGPTReal;
8
+ static fromRational(num: bigint | number, den: bigint | number): EGPTReal;
9
+ static fromRationalStr(str: string): EGPTReal;
10
+ static readonly ZERO: EGPTReal;
11
+ static readonly ONE: EGPTReal;
12
+ static fromAtomVec(atomVec: { sign: -1 | 0 | 1; factors: { prime: bigint; exponent: bigint }[] }): EGPTReal;
13
+ static fromAtomRoot(term: { leadingCoeff: EGPTReal; roots: { value: EGPTReal; multiplicity: bigint }[] }): EGPTReal;
14
+ static gcd(a: bigint | number, b: bigint | number): bigint;
15
+ static lcm(a: bigint | number, b: bigint | number): bigint;
16
+ static modPow(base: bigint | number, exp: bigint | number, mod: bigint | number): bigint;
17
+
18
+ toCanonicalStr(): string;
19
+ toMathString(): string;
20
+ toString(): string;
21
+ add(other: EGPTReal): EGPTReal;
22
+ subtract(other: EGPTReal): EGPTReal;
23
+ multiply(other: EGPTReal): EGPTReal;
24
+ divide(other: EGPTReal): EGPTReal;
25
+ normalDivide(other: EGPTReal): EGPTReal;
26
+ mod(other: EGPTReal): EGPTReal;
27
+ equals(other: EGPTReal): boolean;
28
+ compare(other: EGPTReal): -1 | 0 | 1;
29
+ pow(expNum: bigint | number, expDen?: bigint | number): EGPTReal;
30
+ sqrt(): EGPTReal;
31
+ exp2(): EGPTReal;
32
+ log2(): EGPTReal;
33
+ getIntegerBitLength(): bigint;
34
+ breakSymbolicToApproximateBigInt(): bigint;
35
+ breakSymbolicToApproximateJSNumber(): number;
36
+ breakSymbolicToString(): string;
37
+ toPrimeAtoms(): { sign: -1 | 0 | 1; factors: { prime: bigint; exponent: bigint }[] };
38
+ toAtomRoot(): { leadingCoeff: EGPTReal; roots: { value: EGPTReal; multiplicity: bigint }[] };
39
+ }
40
+
41
+ export declare const EGPTMath: {
42
+ add(a: EGPTReal, b: EGPTReal): EGPTReal;
43
+ subtract(a: EGPTReal, b: EGPTReal): EGPTReal;
44
+ multiply(a: EGPTReal, b: EGPTReal): EGPTReal;
45
+ divide(a: EGPTReal, b: EGPTReal): EGPTReal;
46
+ normalDivide(a: EGPTReal, b: EGPTReal): EGPTReal;
47
+ mod(a: EGPTReal, b: EGPTReal): EGPTReal;
48
+ equals(a: EGPTReal, b: EGPTReal): boolean;
49
+ compare(a: EGPTReal, b: EGPTReal): -1 | 0 | 1;
50
+ pow(base: EGPTReal, expNum: bigint | number, expDen?: bigint | number): EGPTReal;
51
+ sqrt(a: EGPTReal): EGPTReal;
52
+ getIntegerBitLength(a: EGPTReal): bigint;
53
+ };
54
+
55
+ export declare const EGPTPolynomial: {
56
+ add(a: EGPTReal[], b: EGPTReal[]): EGPTReal[];
57
+ multiply(a: EGPTReal[], b: EGPTReal[]): EGPTReal[];
58
+ divide(dividend: EGPTReal[], divisor: EGPTReal[]): { quotient: EGPTReal[]; remainder: EGPTReal[] };
59
+ forwardTransform(coeffs: EGPTReal[], n: number): EGPTReal[];
60
+ inverseTransform(samples: EGPTReal[], n: number): EGPTReal[];
61
+ evaluateAt(poly: EGPTReal[], x: EGPTReal): EGPTReal;
62
+ gcd(a: EGPTReal[], b: EGPTReal[]): EGPTReal[];
63
+ };
64
+
65
+ export declare const EGPTMatrix: {
66
+ zeros(rows: number, cols: number): EGPTReal[][];
67
+ identity(n: number): EGPTReal[][];
68
+ from(rows: Array<Array<unknown>>): EGPTReal[][];
69
+ shape(M: EGPTReal[][]): { rows: number; cols: number };
70
+ transpose(M: EGPTReal[][]): EGPTReal[][];
71
+ equals(A: EGPTReal[][], B: EGPTReal[][]): boolean;
72
+ dotViaPolynomial(a: EGPTReal[], b: EGPTReal[]): EGPTReal;
73
+ matVec(M: EGPTReal[][], v: EGPTReal[]): EGPTReal[];
74
+ gemm(A: EGPTReal[][], B: EGPTReal[][], alpha?: EGPTReal, beta?: EGPTReal, C?: EGPTReal[][] | null): EGPTReal[][];
75
+ matMul(A: EGPTReal[][], B: EGPTReal[][]): EGPTReal[][];
76
+ evaluateRowsAt(M: EGPTReal[][], x: EGPTReal): EGPTReal[];
77
+ format(M: EGPTReal[][], label?: string): string;
78
+ print(M: EGPTReal[][], label?: string): void;
79
+ // toValueReps/fromValueReps are NOT part of this facade — see wasm-facade.js
80
+ // module doc (the correct op isn't in the 37-op provider contract).
81
+ };
82
+
83
+ export declare const EGPTFFT: {
84
+ forward(coeffs: EGPTReal[], n?: number): EGPTReal[];
85
+ inverse(values: EGPTReal[], n?: number): EGPTReal[];
86
+ };
87
+
88
+ export type EgptMathSdk = {
89
+ EGPTReal: typeof EGPTReal;
90
+ EGPTMath: typeof EGPTMath;
91
+ EGPTPolynomial: typeof EGPTPolynomial;
92
+ EGPTMatrix: typeof EGPTMatrix;
93
+ EGPTFFT: typeof EGPTFFT;
94
+ wasm: Record<string, (...args: unknown[]) => unknown>;
95
+ activeMathBackend: string;
96
+ benchmarks: { qftBaseline: Record<string, unknown> };
97
+ metadata: Record<string, unknown>;
98
+ };
99
+
100
+ export declare function createEgptMathSdk(options?: EgptMathSdkInitOptions): Promise<EgptMathSdk>;