@iyulab/u-doe 0.3.0 → 0.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/README.md +14 -2
- package/package.json +2 -2
- package/u_doe.d.ts +51 -22
- package/u_doe.js +2 -2
- package/u_doe_bg.js +119 -74
- package/u_doe_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -138,6 +138,10 @@ await init();
|
|
|
138
138
|
const design = full_factorial(3); // 2^3 = 8 runs
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
> **Note:** All analysis functions take **native JS arrays/objects** — pass values
|
|
142
|
+
> directly, not `JSON.stringify(...)` strings. A string argument is rejected with a
|
|
143
|
+
> descriptive error naming the offending parameter.
|
|
144
|
+
|
|
141
145
|
### Functions
|
|
142
146
|
|
|
143
147
|
#### `full_factorial(k) -> DesignMatrix`
|
|
@@ -177,7 +181,9 @@ Generate a Definitive Screening Design (k = 2..12).
|
|
|
177
181
|
|
|
178
182
|
Perform DOE ANOVA on a coded design matrix.
|
|
179
183
|
|
|
180
|
-
**Input:** `design`: `[[f64]]`, `responses`: `Float64Array`, `factor_names`: `["A","B"]`, `effect_names`: `["A","B","
|
|
184
|
+
**Input:** `design`: `[[f64]]`, `responses`: `Float64Array`, `factor_names`: `["A","B"]`, `effect_names`: `["A","B","A:B"]`
|
|
185
|
+
|
|
186
|
+
Interaction effect names join factor names with `":"` (e.g. `"A:B"`). An unknown entry in `effect_names` is an error (since 0.5.0; previously silently skipped).
|
|
181
187
|
|
|
182
188
|
**Output:**
|
|
183
189
|
```json
|
|
@@ -194,9 +200,15 @@ Estimate main effects and interactions for a 2-level factorial design.
|
|
|
194
200
|
|
|
195
201
|
**Output:**
|
|
196
202
|
```json
|
|
197
|
-
{ "effects": [
|
|
203
|
+
{ "effects": [
|
|
204
|
+
{ "name": "A", "columns": [0], "estimate": 21.6, "sum_of_squares": 1870.6, "percent_contribution": 45.2 },
|
|
205
|
+
{ "name": "A:C", "columns": [0, 2], "estimate": -18.1, "sum_of_squares": 1314.1, "percent_contribution": 31.7 }
|
|
206
|
+
],
|
|
207
|
+
"half_normal": [[18.1, 0.57], [21.6, 1.15]] }
|
|
198
208
|
```
|
|
199
209
|
|
|
210
|
+
Interaction names join factor names with `":"` (since 0.5.0; previously bare concatenation `"AC"`). `columns` holds the design-matrix column indices of the term's factors — use it for display formatting (e.g. `"A × C"`) instead of parsing `name`.
|
|
211
|
+
|
|
200
212
|
#### `fit_rsm(design, responses, factor_names) -> RsmModel`
|
|
201
213
|
|
|
202
214
|
Fit a second-order Response Surface Model via OLS.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"iyulab"
|
|
6
6
|
],
|
|
7
7
|
"description": "Design of Experiments (DOE) framework: factorial, Plackett-Burman, CCD, Box-Behnken, Taguchi, effects analysis, RSM, and desirability optimization.",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.5.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"factorial",
|
|
31
31
|
"statistics"
|
|
32
32
|
]
|
|
33
|
-
}
|
|
33
|
+
}
|
package/u_doe.d.ts
CHANGED
|
@@ -41,66 +41,70 @@ export function definitive_screening(k: number): any;
|
|
|
41
41
|
/**
|
|
42
42
|
* Compute Derringer-Suich desirability for multiple responses.
|
|
43
43
|
*
|
|
44
|
-
* `
|
|
44
|
+
* `specs`: native array of response specification objects, each:
|
|
45
45
|
* `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
|
|
46
46
|
* `responses`: flat array of observed response values (one per spec).
|
|
47
47
|
*
|
|
48
48
|
* Returns `{ individual: [f64], overall: f64 }`.
|
|
49
49
|
*
|
|
50
50
|
* # Errors
|
|
51
|
-
* Returns an error string if
|
|
52
|
-
* or goal string is
|
|
51
|
+
* Returns an error string if `specs` has the wrong shape (native JS values,
|
|
52
|
+
* not JSON strings), specs/responses length mismatch, or goal string is
|
|
53
|
+
* unrecognised.
|
|
53
54
|
*/
|
|
54
|
-
export function desirability(
|
|
55
|
+
export function desirability(specs: any, responses: Float64Array): any;
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* Perform DOE ANOVA.
|
|
58
59
|
*
|
|
59
|
-
* `
|
|
60
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
60
61
|
* `responses`: flat array of response values, one per run.
|
|
61
|
-
* `
|
|
62
|
-
* `
|
|
62
|
+
* `factor_names`: native array of factor name strings used as column labels.
|
|
63
|
+
* `effect_names`: native array of effect names to include (e.g. `["A","B","A:B"]`).
|
|
63
64
|
*
|
|
64
65
|
* Returns an ANOVA result object with `effects`, `residual_ss`, `residual_df`,
|
|
65
66
|
* `total_ss`, `r_squared`, `r_squared_adj`.
|
|
66
67
|
*
|
|
67
68
|
* # Errors
|
|
68
|
-
* Returns an error string if dimensions do not match or
|
|
69
|
+
* Returns an error string if dimensions do not match or an argument has the
|
|
70
|
+
* wrong shape (arguments are native JS values, not JSON strings).
|
|
69
71
|
*/
|
|
70
|
-
export function doe_anova(
|
|
72
|
+
export function doe_anova(design: any, responses: Float64Array, factor_names: any, effect_names: any): any;
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* Estimate main effects and interactions for a 2-level factorial design,
|
|
74
76
|
* plus half-normal plot data for identifying active effects.
|
|
75
77
|
*
|
|
76
|
-
* `
|
|
78
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
77
79
|
* `responses`: flat array of response values, one per run.
|
|
78
|
-
* `
|
|
80
|
+
* `factor_names`: native array of factor name strings.
|
|
79
81
|
* `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
|
|
80
82
|
*
|
|
81
|
-
* Returns `{ effects: [{ name, estimate, sum_of_squares, percent_contribution }],
|
|
83
|
+
* Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
|
|
82
84
|
* half_normal: [[abs_effect, quantile]] }`.
|
|
83
85
|
*
|
|
84
86
|
* # Errors
|
|
85
|
-
* Returns an error string if dimensions do not match or
|
|
87
|
+
* Returns an error string if dimensions do not match or an argument has the
|
|
88
|
+
* wrong shape (arguments are native JS values, not JSON strings).
|
|
86
89
|
*/
|
|
87
|
-
export function estimate_effects(
|
|
90
|
+
export function estimate_effects(design: any, responses: Float64Array, factor_names: any, max_order: number): any;
|
|
88
91
|
|
|
89
92
|
/**
|
|
90
93
|
* Fit a second-order Response Surface Model (RSM) using OLS.
|
|
91
94
|
*
|
|
92
|
-
* `
|
|
95
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix.
|
|
93
96
|
* `responses`: flat array of response values, one per run.
|
|
94
|
-
* `
|
|
97
|
+
* `factor_names`: native array of factor name strings.
|
|
95
98
|
*
|
|
96
99
|
* Returns `{ coefficients: [f64], r_squared: f64, factor_count: usize }`.
|
|
97
100
|
* Coefficient order: [intercept, linear..., quadratic..., interactions...].
|
|
98
101
|
*
|
|
99
102
|
* # Errors
|
|
100
|
-
* Returns an error string if dimensions do not match,
|
|
103
|
+
* Returns an error string if dimensions do not match, an argument has the
|
|
104
|
+
* wrong shape (arguments are native JS values, not JSON strings),
|
|
101
105
|
* or the model matrix is singular.
|
|
102
106
|
*/
|
|
103
|
-
export function fit_rsm(
|
|
107
|
+
export function fit_rsm(design: any, responses: Float64Array, factor_names: any): any;
|
|
104
108
|
|
|
105
109
|
/**
|
|
106
110
|
* Generate a 2^(k-p) fractional factorial design.
|
|
@@ -140,7 +144,7 @@ export function plackett_burman(k: number): any;
|
|
|
140
144
|
/**
|
|
141
145
|
* Compute Taguchi Signal-to-Noise ratios.
|
|
142
146
|
*
|
|
143
|
-
* `
|
|
147
|
+
* `responses`: native array-of-arrays `[[f64]]` — one inner array per run,
|
|
144
148
|
* containing the replicate measurements for that run.
|
|
145
149
|
* `goal`: `"LargerIsBetter"` | `"SmallerIsBetter"` | `"NominalIsBest"`
|
|
146
150
|
*
|
|
@@ -150,19 +154,44 @@ export function plackett_burman(k: number): any;
|
|
|
150
154
|
* Returns an error string if the goal string is unrecognised, or if the
|
|
151
155
|
* response data violates the requirements for the chosen goal.
|
|
152
156
|
*/
|
|
153
|
-
export function signal_to_noise(
|
|
157
|
+
export function signal_to_noise(responses: any, goal: string): any;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generate a Simplex Centroid Design for `q`-component mixture experiments.
|
|
161
|
+
*
|
|
162
|
+
* Produces 2^q − 1 points: the centroid of every non-empty subset of the
|
|
163
|
+
* q components. Example: q=3 → 7 points (3 vertices + 3 edge midpoints +
|
|
164
|
+
* 1 overall centroid), q=4 → 15 points.
|
|
165
|
+
*
|
|
166
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
167
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
168
|
+
*/
|
|
169
|
+
export function simplex_centroid(q: number): any;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Generate a Simplex Lattice Design {q, m} for mixture experiments.
|
|
173
|
+
*
|
|
174
|
+
* Each of the `q` components takes values in {0, 1/m, 2/m, ..., 1} subject
|
|
175
|
+
* to the constraint that all components sum to 1.0 for every run.
|
|
176
|
+
*
|
|
177
|
+
* Run count: C(q + m − 1, m) (e.g. {3,2} → 6 runs, {3,3} → 10 runs).
|
|
178
|
+
*
|
|
179
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
180
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
181
|
+
*/
|
|
182
|
+
export function simplex_lattice(q: number, m: number): any;
|
|
154
183
|
|
|
155
184
|
/**
|
|
156
185
|
* Compute the steepest ascent path from a fitted RSM model.
|
|
157
186
|
*
|
|
158
|
-
* `
|
|
187
|
+
* `coefficients`: native array of model coefficients (from `fit_rsm`).
|
|
159
188
|
* `factor_count`: number of factors in the model.
|
|
160
189
|
* `n_steps`: number of steps along the ascent path.
|
|
161
190
|
* `step_size`: step size in coded units.
|
|
162
191
|
*
|
|
163
192
|
* Returns `{ steps: [{ coded: [f64], step_number: usize }] }`.
|
|
164
193
|
*/
|
|
165
|
-
export function steepest_ascent(
|
|
194
|
+
export function steepest_ascent(coefficients: any, factor_count: number, n_steps: number, step_size: number): any;
|
|
166
195
|
|
|
167
196
|
/**
|
|
168
197
|
* Get a Taguchi orthogonal array.
|
package/u_doe.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./u_doe.d.ts" */
|
|
2
|
-
|
|
3
2
|
import * as wasm from "./u_doe_bg.wasm";
|
|
4
3
|
import { __wbg_set_wasm } from "./u_doe_bg.js";
|
|
4
|
+
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
box_behnken, ccd, definitive_screening, desirability, doe_anova, estimate_effects, fit_rsm, fractional_factorial, full_factorial, plackett_burman, signal_to_noise, steepest_ascent, taguchi_array, two_level_factorial_power
|
|
8
|
+
box_behnken, ccd, definitive_screening, desirability, doe_anova, estimate_effects, fit_rsm, fractional_factorial, full_factorial, plackett_burman, signal_to_noise, simplex_centroid, simplex_lattice, steepest_ascent, taguchi_array, two_level_factorial_power
|
|
9
9
|
} from "./u_doe_bg.js";
|
package/u_doe_bg.js
CHANGED
|
@@ -67,23 +67,24 @@ export function definitive_screening(k) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Compute Derringer-Suich desirability for multiple responses.
|
|
69
69
|
*
|
|
70
|
-
* `
|
|
70
|
+
* `specs`: native array of response specification objects, each:
|
|
71
71
|
* `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
|
|
72
72
|
* `responses`: flat array of observed response values (one per spec).
|
|
73
73
|
*
|
|
74
74
|
* Returns `{ individual: [f64], overall: f64 }`.
|
|
75
75
|
*
|
|
76
76
|
* # Errors
|
|
77
|
-
* Returns an error string if
|
|
78
|
-
* or goal string is
|
|
79
|
-
*
|
|
77
|
+
* Returns an error string if `specs` has the wrong shape (native JS values,
|
|
78
|
+
* not JSON strings), specs/responses length mismatch, or goal string is
|
|
79
|
+
* unrecognised.
|
|
80
|
+
* @param {any} specs
|
|
80
81
|
* @param {Float64Array} responses
|
|
81
82
|
* @returns {any}
|
|
82
83
|
*/
|
|
83
|
-
export function desirability(
|
|
84
|
+
export function desirability(specs, responses) {
|
|
84
85
|
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
85
86
|
const len0 = WASM_VECTOR_LEN;
|
|
86
|
-
const ret = wasm.desirability(
|
|
87
|
+
const ret = wasm.desirability(specs, ptr0, len0);
|
|
87
88
|
if (ret[2]) {
|
|
88
89
|
throw takeFromExternrefTable0(ret[1]);
|
|
89
90
|
}
|
|
@@ -93,26 +94,27 @@ export function desirability(specs_json, responses) {
|
|
|
93
94
|
/**
|
|
94
95
|
* Perform DOE ANOVA.
|
|
95
96
|
*
|
|
96
|
-
* `
|
|
97
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
97
98
|
* `responses`: flat array of response values, one per run.
|
|
98
|
-
* `
|
|
99
|
-
* `
|
|
99
|
+
* `factor_names`: native array of factor name strings used as column labels.
|
|
100
|
+
* `effect_names`: native array of effect names to include (e.g. `["A","B","A:B"]`).
|
|
100
101
|
*
|
|
101
102
|
* Returns an ANOVA result object with `effects`, `residual_ss`, `residual_df`,
|
|
102
103
|
* `total_ss`, `r_squared`, `r_squared_adj`.
|
|
103
104
|
*
|
|
104
105
|
* # Errors
|
|
105
|
-
* Returns an error string if dimensions do not match or
|
|
106
|
-
*
|
|
106
|
+
* Returns an error string if dimensions do not match or an argument has the
|
|
107
|
+
* wrong shape (arguments are native JS values, not JSON strings).
|
|
108
|
+
* @param {any} design
|
|
107
109
|
* @param {Float64Array} responses
|
|
108
|
-
* @param {any}
|
|
109
|
-
* @param {any}
|
|
110
|
+
* @param {any} factor_names
|
|
111
|
+
* @param {any} effect_names
|
|
110
112
|
* @returns {any}
|
|
111
113
|
*/
|
|
112
|
-
export function doe_anova(
|
|
114
|
+
export function doe_anova(design, responses, factor_names, effect_names) {
|
|
113
115
|
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
114
116
|
const len0 = WASM_VECTOR_LEN;
|
|
115
|
-
const ret = wasm.doe_anova(
|
|
117
|
+
const ret = wasm.doe_anova(design, ptr0, len0, factor_names, effect_names);
|
|
116
118
|
if (ret[2]) {
|
|
117
119
|
throw takeFromExternrefTable0(ret[1]);
|
|
118
120
|
}
|
|
@@ -123,26 +125,27 @@ export function doe_anova(design_json, responses, factor_names_json, effect_name
|
|
|
123
125
|
* Estimate main effects and interactions for a 2-level factorial design,
|
|
124
126
|
* plus half-normal plot data for identifying active effects.
|
|
125
127
|
*
|
|
126
|
-
* `
|
|
128
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
127
129
|
* `responses`: flat array of response values, one per run.
|
|
128
|
-
* `
|
|
130
|
+
* `factor_names`: native array of factor name strings.
|
|
129
131
|
* `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
|
|
130
132
|
*
|
|
131
|
-
* Returns `{ effects: [{ name, estimate, sum_of_squares, percent_contribution }],
|
|
133
|
+
* Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
|
|
132
134
|
* half_normal: [[abs_effect, quantile]] }`.
|
|
133
135
|
*
|
|
134
136
|
* # Errors
|
|
135
|
-
* Returns an error string if dimensions do not match or
|
|
136
|
-
*
|
|
137
|
+
* Returns an error string if dimensions do not match or an argument has the
|
|
138
|
+
* wrong shape (arguments are native JS values, not JSON strings).
|
|
139
|
+
* @param {any} design
|
|
137
140
|
* @param {Float64Array} responses
|
|
138
|
-
* @param {any}
|
|
141
|
+
* @param {any} factor_names
|
|
139
142
|
* @param {number} max_order
|
|
140
143
|
* @returns {any}
|
|
141
144
|
*/
|
|
142
|
-
export function estimate_effects(
|
|
145
|
+
export function estimate_effects(design, responses, factor_names, max_order) {
|
|
143
146
|
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
144
147
|
const len0 = WASM_VECTOR_LEN;
|
|
145
|
-
const ret = wasm.estimate_effects(
|
|
148
|
+
const ret = wasm.estimate_effects(design, ptr0, len0, factor_names, max_order);
|
|
146
149
|
if (ret[2]) {
|
|
147
150
|
throw takeFromExternrefTable0(ret[1]);
|
|
148
151
|
}
|
|
@@ -152,25 +155,26 @@ export function estimate_effects(design_json, responses, factor_names_json, max_
|
|
|
152
155
|
/**
|
|
153
156
|
* Fit a second-order Response Surface Model (RSM) using OLS.
|
|
154
157
|
*
|
|
155
|
-
* `
|
|
158
|
+
* `design`: native array-of-arrays `[[f64]]` — the coded design matrix.
|
|
156
159
|
* `responses`: flat array of response values, one per run.
|
|
157
|
-
* `
|
|
160
|
+
* `factor_names`: native array of factor name strings.
|
|
158
161
|
*
|
|
159
162
|
* Returns `{ coefficients: [f64], r_squared: f64, factor_count: usize }`.
|
|
160
163
|
* Coefficient order: [intercept, linear..., quadratic..., interactions...].
|
|
161
164
|
*
|
|
162
165
|
* # Errors
|
|
163
|
-
* Returns an error string if dimensions do not match,
|
|
166
|
+
* Returns an error string if dimensions do not match, an argument has the
|
|
167
|
+
* wrong shape (arguments are native JS values, not JSON strings),
|
|
164
168
|
* or the model matrix is singular.
|
|
165
|
-
* @param {any}
|
|
169
|
+
* @param {any} design
|
|
166
170
|
* @param {Float64Array} responses
|
|
167
|
-
* @param {any}
|
|
171
|
+
* @param {any} factor_names
|
|
168
172
|
* @returns {any}
|
|
169
173
|
*/
|
|
170
|
-
export function fit_rsm(
|
|
174
|
+
export function fit_rsm(design, responses, factor_names) {
|
|
171
175
|
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
172
176
|
const len0 = WASM_VECTOR_LEN;
|
|
173
|
-
const ret = wasm.fit_rsm(
|
|
177
|
+
const ret = wasm.fit_rsm(design, ptr0, len0, factor_names);
|
|
174
178
|
if (ret[2]) {
|
|
175
179
|
throw takeFromExternrefTable0(ret[1]);
|
|
176
180
|
}
|
|
@@ -240,7 +244,7 @@ export function plackett_burman(k) {
|
|
|
240
244
|
/**
|
|
241
245
|
* Compute Taguchi Signal-to-Noise ratios.
|
|
242
246
|
*
|
|
243
|
-
* `
|
|
247
|
+
* `responses`: native array-of-arrays `[[f64]]` — one inner array per run,
|
|
244
248
|
* containing the replicate measurements for that run.
|
|
245
249
|
* `goal`: `"LargerIsBetter"` | `"SmallerIsBetter"` | `"NominalIsBest"`
|
|
246
250
|
*
|
|
@@ -249,14 +253,56 @@ export function plackett_burman(k) {
|
|
|
249
253
|
* # Errors
|
|
250
254
|
* Returns an error string if the goal string is unrecognised, or if the
|
|
251
255
|
* response data violates the requirements for the chosen goal.
|
|
252
|
-
* @param {any}
|
|
256
|
+
* @param {any} responses
|
|
253
257
|
* @param {string} goal
|
|
254
258
|
* @returns {any}
|
|
255
259
|
*/
|
|
256
|
-
export function signal_to_noise(
|
|
260
|
+
export function signal_to_noise(responses, goal) {
|
|
257
261
|
const ptr0 = passStringToWasm0(goal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
258
262
|
const len0 = WASM_VECTOR_LEN;
|
|
259
|
-
const ret = wasm.signal_to_noise(
|
|
263
|
+
const ret = wasm.signal_to_noise(responses, ptr0, len0);
|
|
264
|
+
if (ret[2]) {
|
|
265
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
266
|
+
}
|
|
267
|
+
return takeFromExternrefTable0(ret[0]);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Generate a Simplex Centroid Design for `q`-component mixture experiments.
|
|
272
|
+
*
|
|
273
|
+
* Produces 2^q − 1 points: the centroid of every non-empty subset of the
|
|
274
|
+
* q components. Example: q=3 → 7 points (3 vertices + 3 edge midpoints +
|
|
275
|
+
* 1 overall centroid), q=4 → 15 points.
|
|
276
|
+
*
|
|
277
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
278
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
279
|
+
* @param {number} q
|
|
280
|
+
* @returns {any}
|
|
281
|
+
*/
|
|
282
|
+
export function simplex_centroid(q) {
|
|
283
|
+
const ret = wasm.simplex_centroid(q);
|
|
284
|
+
if (ret[2]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
+
}
|
|
287
|
+
return takeFromExternrefTable0(ret[0]);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Generate a Simplex Lattice Design {q, m} for mixture experiments.
|
|
292
|
+
*
|
|
293
|
+
* Each of the `q` components takes values in {0, 1/m, 2/m, ..., 1} subject
|
|
294
|
+
* to the constraint that all components sum to 1.0 for every run.
|
|
295
|
+
*
|
|
296
|
+
* Run count: C(q + m − 1, m) (e.g. {3,2} → 6 runs, {3,3} → 10 runs).
|
|
297
|
+
*
|
|
298
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
299
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
300
|
+
* @param {number} q
|
|
301
|
+
* @param {number} m
|
|
302
|
+
* @returns {any}
|
|
303
|
+
*/
|
|
304
|
+
export function simplex_lattice(q, m) {
|
|
305
|
+
const ret = wasm.simplex_lattice(q, m);
|
|
260
306
|
if (ret[2]) {
|
|
261
307
|
throw takeFromExternrefTable0(ret[1]);
|
|
262
308
|
}
|
|
@@ -266,20 +312,20 @@ export function signal_to_noise(responses_json, goal) {
|
|
|
266
312
|
/**
|
|
267
313
|
* Compute the steepest ascent path from a fitted RSM model.
|
|
268
314
|
*
|
|
269
|
-
* `
|
|
315
|
+
* `coefficients`: native array of model coefficients (from `fit_rsm`).
|
|
270
316
|
* `factor_count`: number of factors in the model.
|
|
271
317
|
* `n_steps`: number of steps along the ascent path.
|
|
272
318
|
* `step_size`: step size in coded units.
|
|
273
319
|
*
|
|
274
320
|
* Returns `{ steps: [{ coded: [f64], step_number: usize }] }`.
|
|
275
|
-
* @param {any}
|
|
321
|
+
* @param {any} coefficients
|
|
276
322
|
* @param {number} factor_count
|
|
277
323
|
* @param {number} n_steps
|
|
278
324
|
* @param {number} step_size
|
|
279
325
|
* @returns {any}
|
|
280
326
|
*/
|
|
281
|
-
export function steepest_ascent(
|
|
282
|
-
const ret = wasm.steepest_ascent(
|
|
327
|
+
export function steepest_ascent(coefficients, factor_count, n_steps, step_size) {
|
|
328
|
+
const ret = wasm.steepest_ascent(coefficients, factor_count, n_steps, step_size);
|
|
283
329
|
if (ret[2]) {
|
|
284
330
|
throw takeFromExternrefTable0(ret[1]);
|
|
285
331
|
}
|
|
@@ -336,7 +382,7 @@ export function two_level_factorial_power(k, p, n_replicates, effect_size, sigma
|
|
|
336
382
|
const ret = wasm.two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha);
|
|
337
383
|
return ret;
|
|
338
384
|
}
|
|
339
|
-
export function
|
|
385
|
+
export function __wbg_Error_9dc85fe1bc224456(arg0, arg1) {
|
|
340
386
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
341
387
|
return ret;
|
|
342
388
|
}
|
|
@@ -347,46 +393,46 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
347
393
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
348
394
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
349
395
|
}
|
|
350
|
-
export function
|
|
396
|
+
export function __wbg___wbindgen_boolean_get_b131b2f36d6b2f55(arg0) {
|
|
351
397
|
const v = arg0;
|
|
352
398
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
353
399
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
354
400
|
}
|
|
355
|
-
export function
|
|
401
|
+
export function __wbg___wbindgen_debug_string_56c147eb1a51f0c4(arg0, arg1) {
|
|
356
402
|
const ret = debugString(arg1);
|
|
357
403
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
358
404
|
const len1 = WASM_VECTOR_LEN;
|
|
359
405
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
360
406
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
361
407
|
}
|
|
362
|
-
export function
|
|
408
|
+
export function __wbg___wbindgen_in_ce8569b2fc6f5088(arg0, arg1) {
|
|
363
409
|
const ret = arg0 in arg1;
|
|
364
410
|
return ret;
|
|
365
411
|
}
|
|
366
|
-
export function
|
|
412
|
+
export function __wbg___wbindgen_is_function_147961669f068cd4(arg0) {
|
|
367
413
|
const ret = typeof(arg0) === 'function';
|
|
368
414
|
return ret;
|
|
369
415
|
}
|
|
370
|
-
export function
|
|
416
|
+
export function __wbg___wbindgen_is_object_3a2c414391dbf751(arg0) {
|
|
371
417
|
const val = arg0;
|
|
372
418
|
const ret = typeof(val) === 'object' && val !== null;
|
|
373
419
|
return ret;
|
|
374
420
|
}
|
|
375
|
-
export function
|
|
421
|
+
export function __wbg___wbindgen_is_undefined_4410e3c20a99fa97(arg0) {
|
|
376
422
|
const ret = arg0 === undefined;
|
|
377
423
|
return ret;
|
|
378
424
|
}
|
|
379
|
-
export function
|
|
425
|
+
export function __wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c(arg0, arg1) {
|
|
380
426
|
const ret = arg0 == arg1;
|
|
381
427
|
return ret;
|
|
382
428
|
}
|
|
383
|
-
export function
|
|
429
|
+
export function __wbg___wbindgen_number_get_588ed6b97f0d7e14(arg0, arg1) {
|
|
384
430
|
const obj = arg1;
|
|
385
431
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
386
432
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
387
433
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
388
434
|
}
|
|
389
|
-
export function
|
|
435
|
+
export function __wbg___wbindgen_string_get_fa2687d531ed17a5(arg0, arg1) {
|
|
390
436
|
const obj = arg1;
|
|
391
437
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
392
438
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -394,22 +440,22 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
|
394
440
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
395
441
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
396
442
|
}
|
|
397
|
-
export function
|
|
443
|
+
export function __wbg___wbindgen_throw_bbadd78c1bac3a77(arg0, arg1) {
|
|
398
444
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
399
445
|
}
|
|
400
|
-
export function
|
|
446
|
+
export function __wbg_call_91f00ddc43e01490() { return handleError(function (arg0, arg1) {
|
|
401
447
|
const ret = arg0.call(arg1);
|
|
402
448
|
return ret;
|
|
403
449
|
}, arguments); }
|
|
404
|
-
export function
|
|
450
|
+
export function __wbg_done_6a8439e544ec6206(arg0) {
|
|
405
451
|
const ret = arg0.done;
|
|
406
452
|
return ret;
|
|
407
453
|
}
|
|
408
|
-
export function
|
|
454
|
+
export function __wbg_get_44e98e27bda25b5b() { return handleError(function (arg0, arg1) {
|
|
409
455
|
const ret = Reflect.get(arg0, arg1);
|
|
410
456
|
return ret;
|
|
411
457
|
}, arguments); }
|
|
412
|
-
export function
|
|
458
|
+
export function __wbg_get_unchecked_46e778e3cec74b5e(arg0, arg1) {
|
|
413
459
|
const ret = arg0[arg1 >>> 0];
|
|
414
460
|
return ret;
|
|
415
461
|
}
|
|
@@ -417,7 +463,7 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
|
417
463
|
const ret = arg0[arg1];
|
|
418
464
|
return ret;
|
|
419
465
|
}
|
|
420
|
-
export function
|
|
466
|
+
export function __wbg_instanceof_ArrayBuffer_a581da923203f29f(arg0) {
|
|
421
467
|
let result;
|
|
422
468
|
try {
|
|
423
469
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -427,7 +473,7 @@ export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
|
427
473
|
const ret = result;
|
|
428
474
|
return ret;
|
|
429
475
|
}
|
|
430
|
-
export function
|
|
476
|
+
export function __wbg_instanceof_Uint8Array_b6fe1ac89eba107e(arg0) {
|
|
431
477
|
let result;
|
|
432
478
|
try {
|
|
433
479
|
result = arg0 instanceof Uint8Array;
|
|
@@ -437,52 +483,52 @@ export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
|
437
483
|
const ret = result;
|
|
438
484
|
return ret;
|
|
439
485
|
}
|
|
440
|
-
export function
|
|
486
|
+
export function __wbg_isArray_139f48e3c057ede8(arg0) {
|
|
441
487
|
const ret = Array.isArray(arg0);
|
|
442
488
|
return ret;
|
|
443
489
|
}
|
|
444
|
-
export function
|
|
490
|
+
export function __wbg_iterator_9b36cebf3be7b7cd() {
|
|
445
491
|
const ret = Symbol.iterator;
|
|
446
492
|
return ret;
|
|
447
493
|
}
|
|
448
|
-
export function
|
|
494
|
+
export function __wbg_length_68a9d5278d084f4f(arg0) {
|
|
449
495
|
const ret = arg0.length;
|
|
450
496
|
return ret;
|
|
451
497
|
}
|
|
452
|
-
export function
|
|
498
|
+
export function __wbg_length_fb04d16d7bdf6d4c(arg0) {
|
|
453
499
|
const ret = arg0.length;
|
|
454
500
|
return ret;
|
|
455
501
|
}
|
|
456
|
-
export function
|
|
457
|
-
const ret = new Uint8Array(arg0);
|
|
458
|
-
return ret;
|
|
459
|
-
}
|
|
460
|
-
export function __wbg_new_a70fbab9066b301f() {
|
|
502
|
+
export function __wbg_new_0b303268aa395a38() {
|
|
461
503
|
const ret = new Array();
|
|
462
504
|
return ret;
|
|
463
505
|
}
|
|
464
|
-
export function
|
|
506
|
+
export function __wbg_new_20b778a4c5c691c3() {
|
|
465
507
|
const ret = new Object();
|
|
466
508
|
return ret;
|
|
467
509
|
}
|
|
468
|
-
export function
|
|
510
|
+
export function __wbg_new_b06772b280cc6e52(arg0) {
|
|
511
|
+
const ret = new Uint8Array(arg0);
|
|
512
|
+
return ret;
|
|
513
|
+
}
|
|
514
|
+
export function __wbg_next_8cb028b6ba50743f() { return handleError(function (arg0) {
|
|
469
515
|
const ret = arg0.next();
|
|
470
516
|
return ret;
|
|
471
517
|
}, arguments); }
|
|
472
|
-
export function
|
|
518
|
+
export function __wbg_next_cfd0b146c9538df8(arg0) {
|
|
473
519
|
const ret = arg0.next;
|
|
474
520
|
return ret;
|
|
475
521
|
}
|
|
476
|
-
export function
|
|
522
|
+
export function __wbg_prototypesetcall_956c7493c68e29b4(arg0, arg1, arg2) {
|
|
477
523
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
478
524
|
}
|
|
479
|
-
export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
|
|
480
|
-
arg0[arg1 >>> 0] = arg2;
|
|
481
|
-
}
|
|
482
525
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
483
526
|
arg0[arg1] = arg2;
|
|
484
527
|
}
|
|
485
|
-
export function
|
|
528
|
+
export function __wbg_set_da33c120a6584674(arg0, arg1, arg2) {
|
|
529
|
+
arg0[arg1 >>> 0] = arg2;
|
|
530
|
+
}
|
|
531
|
+
export function __wbg_value_3d3defe09fb1ffca(arg0) {
|
|
486
532
|
const ret = arg0.value;
|
|
487
533
|
return ret;
|
|
488
534
|
}
|
|
@@ -603,8 +649,7 @@ function getFloat64ArrayMemory0() {
|
|
|
603
649
|
}
|
|
604
650
|
|
|
605
651
|
function getStringFromWasm0(ptr, len) {
|
|
606
|
-
|
|
607
|
-
return decodeText(ptr, len);
|
|
652
|
+
return decodeText(ptr >>> 0, len);
|
|
608
653
|
}
|
|
609
654
|
|
|
610
655
|
let cachedUint8ArrayMemory0 = null;
|
package/u_doe_bg.wasm
CHANGED
|
Binary file
|