@iyulab/u-numflow 0.6.0 → 0.6.2

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/README.md CHANGED
@@ -104,6 +104,23 @@ Exported functions: `mean`, `std_dev`, `variance`, `normal_cdf`, `normal_sf` (up
104
104
  `rfft(data) -> Float64Array` — the DFT of a real sequence of any length, interleaved as
105
105
  `[re0, im0, re1, im1, …]` (bins `k` and `n − k` are conjugates, so `0..=n/2` describes the spectrum).
106
106
 
107
+ ### TypeScript
108
+
109
+ Every exported function declares its return type, and the declarations are
110
+ generated from the same structs the binding serialises, so they cannot drift
111
+ from what it actually returns:
112
+
113
+ ```ts
114
+ export function estimate_lambda(data: any): LambdaEstimateDto;
115
+ ```
116
+
117
+ An absent optional value is declared `T | undefined`, which is what the binding
118
+ sends. Nothing needs an `as` cast -- and a wrong assumption about a result's
119
+ shape is a compile error rather than something that fails at run time.
120
+
121
+ Inputs are still `any`: they are validated at the boundary, and a rejected one
122
+ says what was wrong.
123
+
107
124
  ## Related
108
125
 
109
126
  - [u-metaheur](https://github.com/iyulab/u-metaheur) — Metaheuristic optimization (GA, SA, ALNS, CP)
@@ -41,7 +41,7 @@ exports.box_cox = box_cox;
41
41
  * @param {Float64Array} data
42
42
  * @param {number} lambda_min
43
43
  * @param {number} lambda_max
44
- * @returns {any}
44
+ * @returns {LambdaEstimateDto}
45
45
  */
46
46
  function estimate_lambda(data, lambda_min, lambda_max) {
47
47
  const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
@@ -1,5 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Output of [`estimate_lambda`]: `{ lambda, at_bound }`.
5
+ */
6
+ export interface LambdaEstimateDto {
7
+ lambda: number;
8
+ at_bound: boolean;
9
+ }
10
+
3
11
 
4
12
  /**
5
13
  * Apply the Box-Cox power transformation to positive data.
@@ -26,7 +34,7 @@ export function box_cox(data: Float64Array, lambda: number): Float64Array;
26
34
  * has fewer than 2 elements, or the range is not finite with
27
35
  * `lambda_min < lambda_max`.
28
36
  */
29
- export function estimate_lambda(data: Float64Array, lambda_min: number, lambda_max: number): any;
37
+ export function estimate_lambda(data: Float64Array, lambda_min: number, lambda_max: number): LambdaEstimateDto;
30
38
 
31
39
  /**
32
40
  * Arithmetic mean of `data` using Kahan compensated summation.
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "iyulab"
6
6
  ],
7
7
  "description": "Foundational mathematical primitives: statistics, probability distributions, random sampling, and collections.",
8
- "version": "0.6.0",
8
+ "version": "0.6.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/u_numflow.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Output of [`estimate_lambda`]: `{ lambda, at_bound }`.
5
+ */
6
+ export interface LambdaEstimateDto {
7
+ lambda: number;
8
+ at_bound: boolean;
9
+ }
10
+
3
11
 
4
12
  /**
5
13
  * Apply the Box-Cox power transformation to positive data.
@@ -26,7 +34,7 @@ export function box_cox(data: Float64Array, lambda: number): Float64Array;
26
34
  * has fewer than 2 elements, or the range is not finite with
27
35
  * `lambda_min < lambda_max`.
28
36
  */
29
- export function estimate_lambda(data: Float64Array, lambda_min: number, lambda_max: number): any;
37
+ export function estimate_lambda(data: Float64Array, lambda_min: number, lambda_max: number): LambdaEstimateDto;
30
38
 
31
39
  /**
32
40
  * Arithmetic mean of `data` using Kahan compensated summation.
package/u_numflow_bg.js CHANGED
@@ -38,7 +38,7 @@ export function box_cox(data, lambda) {
38
38
  * @param {Float64Array} data
39
39
  * @param {number} lambda_min
40
40
  * @param {number} lambda_max
41
- * @returns {any}
41
+ * @returns {LambdaEstimateDto}
42
42
  */
43
43
  export function estimate_lambda(data, lambda_min, lambda_max) {
44
44
  const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
package/u_numflow_bg.wasm CHANGED
Binary file