@danielsimonjr/mathts-matrix 0.1.3 → 0.1.5

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.
@@ -2,8 +2,13 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
+ var __esm = (fn, res, err) => function __init() {
6
+ if (err) throw err[0];
7
+ try {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ } catch (e) {
10
+ throw err = [e], e;
11
+ }
7
12
  };
8
13
  var __export = (target, all) => {
9
14
  for (var name in all)
@@ -3,7 +3,7 @@ import {
3
3
  eigvals,
4
4
  powerIteration
5
5
  } from "./chunk-VCPLE6ED.js";
6
- import "./chunk-PNKVD2UK.js";
6
+ import "./chunk-4VMDO6W2.js";
7
7
  export {
8
8
  eig,
9
9
  eigvals,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as _danielsimonjr_mathts_parallel from '@danielsimonjr/mathts-parallel';
2
1
  import { ComputePool, ComputePoolConfig } from '@danielsimonjr/mathts-parallel';
3
2
  import * as typed_function from 'typed-function';
4
3
 
@@ -855,6 +854,96 @@ declare class JSBackend implements MatrixBackend {
855
854
  */
856
855
  declare const jsBackend: JSBackend;
857
856
 
857
+ /**
858
+ * Stub type declarations for workerpool.
859
+ * The actual workerpool package ships raw .ts sources without pre-built .d.ts files.
860
+ * This stub prevents TypeScript from diving into the raw source during type-checking.
861
+ */
862
+ declare module 'workerpool' {
863
+ export interface ExecOptions<T = unknown> {
864
+ on?: (payload: unknown) => void;
865
+ transfer?: Transferable[];
866
+ metadata?: T;
867
+ }
868
+
869
+ export interface PoolStats {
870
+ totalWorkers: number;
871
+ busyWorkers: number;
872
+ idleWorkers: number;
873
+ pendingTasks: number;
874
+ activeTasks: number;
875
+ }
876
+
877
+ export interface PoolOptions {
878
+ minWorkers?: number | 'max';
879
+ maxWorkers?: number;
880
+ maxQueueSize?: number;
881
+ workerType?: 'auto' | 'web' | 'process' | 'thread';
882
+ queueStrategy?: 'fifo' | 'lifo';
883
+ script?: string;
884
+ workerTerminateTimeout?: number;
885
+ forkArgs?: string[];
886
+ forkOpts?: Record<string, unknown>;
887
+ workerOpts?: Record<string, unknown>;
888
+ workerThreadOpts?: Record<string, unknown>;
889
+ emitStdStreams?: boolean;
890
+ onCreateWorker?: (arg: Record<string, unknown>) => Record<string, unknown> | void;
891
+ onTerminateWorker?: (arg: Record<string, unknown>) => void;
892
+ debugPortStart?: number;
893
+ }
894
+
895
+ export interface WorkerpoolPromise<T, E = unknown> extends Promise<T> {
896
+ readonly resolved: boolean;
897
+ readonly rejected: boolean;
898
+ readonly pending: boolean;
899
+ cancel(): this;
900
+ timeout(delay: number): this;
901
+ }
902
+
903
+ export type WorkerProxy<T extends Record<string, (...args: unknown[]) => unknown>> = {
904
+ [K in keyof T]: (...args: Parameters<T[K]>) => WorkerpoolPromise<ReturnType<T[K]>>;
905
+ };
906
+
907
+ export class Pool {
908
+ constructor(script?: string | PoolOptions, options?: PoolOptions);
909
+ exec<T>(
910
+ method: string | ((...args: unknown[]) => T),
911
+ params?: unknown[],
912
+ options?: ExecOptions
913
+ ): WorkerpoolPromise<T>;
914
+ proxy<T extends Record<string, (...args: unknown[]) => unknown>>(): Promise<WorkerProxy<T>>;
915
+ stats(): PoolStats;
916
+ terminate(force?: boolean, timeout?: number): Promise<void>;
917
+ }
918
+
919
+ export interface TransferDescriptor<T = unknown> {
920
+ message: T;
921
+ transfer: Transferable[];
922
+ }
923
+
924
+ export class Transfer<T = unknown> {
925
+ message: T;
926
+ transfer: Transferable[];
927
+ constructor(message: T, transfer: Transferable[]);
928
+ }
929
+
930
+ export class CancellationError extends Error {}
931
+ export class TimeoutError extends Error {}
932
+ export class TerminateError extends Error {}
933
+
934
+ export function pool(script?: string | PoolOptions, options?: PoolOptions): Pool;
935
+
936
+ export function worker(
937
+ methods?: Record<string, (...args: unknown[]) => unknown>,
938
+ options?: {
939
+ onTerminate?: (code: number | undefined) => void | PromiseLike<void>;
940
+ abortListenerTimeout?: number;
941
+ }
942
+ ): void;
943
+
944
+ export function workerEmit(payload: unknown): void;
945
+ }
946
+
858
947
  /**
859
948
  * Configuration for ParallelBackend
860
949
  */
@@ -961,7 +1050,7 @@ declare class ParallelBackend {
961
1050
  /**
962
1051
  * Get pool statistics
963
1052
  */
964
- getStats(): _danielsimonjr_mathts_parallel.PoolStats;
1053
+ getStats(): undefined;
965
1054
  private checkDimensionsMatch;
966
1055
  private checkMultiplyDimensions;
967
1056
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  __esm,
8
8
  __export,
9
9
  __toCommonJS
10
- } from "./chunk-PNKVD2UK.js";
10
+ } from "./chunk-4VMDO6W2.js";
11
11
 
12
12
  // src/types/Matrix.ts
13
13
  function isMatrix(value) {
@@ -127,6 +127,130 @@ var init_Matrix = __esm({
127
127
  }
128
128
  });
129
129
 
130
+ // src/types/dense/arithmetic.ts
131
+ function add(a, b) {
132
+ const result = new Float64Array(a.rows * a.cols);
133
+ for (let i = 0; i < a.rows; i++) {
134
+ for (let j = 0; j < a.cols; j++) {
135
+ result[i * a.cols + j] = a.get(i, j) + b.get(i, j);
136
+ }
137
+ }
138
+ return result;
139
+ }
140
+ function subtract(a, b) {
141
+ const result = new Float64Array(a.rows * a.cols);
142
+ for (let i = 0; i < a.rows; i++) {
143
+ for (let j = 0; j < a.cols; j++) {
144
+ result[i * a.cols + j] = a.get(i, j) - b.get(i, j);
145
+ }
146
+ }
147
+ return result;
148
+ }
149
+ function multiplyElementwise(a, b) {
150
+ const result = new Float64Array(a.rows * a.cols);
151
+ for (let i = 0; i < a.rows; i++) {
152
+ for (let j = 0; j < a.cols; j++) {
153
+ result[i * a.cols + j] = a.get(i, j) * b.get(i, j);
154
+ }
155
+ }
156
+ return result;
157
+ }
158
+ function multiply(a, b) {
159
+ const result = new Float64Array(a.rows * b.cols);
160
+ for (let i = 0; i < a.rows; i++) {
161
+ for (let j = 0; j < b.cols; j++) {
162
+ let sum3 = 0;
163
+ for (let k = 0; k < a.cols; k++) {
164
+ sum3 += a.get(i, k) * b.get(k, j);
165
+ }
166
+ result[i * b.cols + j] = sum3;
167
+ }
168
+ }
169
+ return result;
170
+ }
171
+ function scale(a, scalar) {
172
+ const result = new Float64Array(a.rows * a.cols);
173
+ for (let i = 0; i < a.rows; i++) {
174
+ for (let j = 0; j < a.cols; j++) {
175
+ result[i * a.cols + j] = a.get(i, j) * scalar;
176
+ }
177
+ }
178
+ return result;
179
+ }
180
+ function transpose(a) {
181
+ const result = new Float64Array(a.cols * a.rows);
182
+ for (let i = 0; i < a.rows; i++) {
183
+ for (let j = 0; j < a.cols; j++) {
184
+ result[j * a.rows + i] = a.get(i, j);
185
+ }
186
+ }
187
+ return result;
188
+ }
189
+ var init_arithmetic = __esm({
190
+ "src/types/dense/arithmetic.ts"() {
191
+ "use strict";
192
+ }
193
+ });
194
+
195
+ // src/types/dense/reduction.ts
196
+ function sum(a) {
197
+ let total = 0;
198
+ for (let i = 0; i < a.rows; i++) {
199
+ for (let j = 0; j < a.cols; j++) {
200
+ total += a.get(i, j);
201
+ }
202
+ }
203
+ return total;
204
+ }
205
+ function mean(a) {
206
+ return sum(a) / a.length;
207
+ }
208
+ function min(a) {
209
+ let minVal = Infinity;
210
+ for (let i = 0; i < a.rows; i++) {
211
+ for (let j = 0; j < a.cols; j++) {
212
+ const val = a.get(i, j);
213
+ if (val < minVal) minVal = val;
214
+ }
215
+ }
216
+ return minVal;
217
+ }
218
+ function max(a) {
219
+ let maxVal = -Infinity;
220
+ for (let i = 0; i < a.rows; i++) {
221
+ for (let j = 0; j < a.cols; j++) {
222
+ const val = a.get(i, j);
223
+ if (val > maxVal) maxVal = val;
224
+ }
225
+ }
226
+ return maxVal;
227
+ }
228
+ function norm(a) {
229
+ let sumSquared = 0;
230
+ for (let i = 0; i < a.rows; i++) {
231
+ for (let j = 0; j < a.cols; j++) {
232
+ const val = a.get(i, j);
233
+ sumSquared += val * val;
234
+ }
235
+ }
236
+ return Math.sqrt(sumSquared);
237
+ }
238
+ function trace(a) {
239
+ if (!a.isSquare) {
240
+ throw new Error("Trace is only defined for square matrices");
241
+ }
242
+ let traceSum = 0;
243
+ for (let i = 0; i < a.rows; i++) {
244
+ traceSum += a.get(i, i);
245
+ }
246
+ return traceSum;
247
+ }
248
+ var init_reduction = __esm({
249
+ "src/types/dense/reduction.ts"() {
250
+ "use strict";
251
+ }
252
+ });
253
+
130
254
  // src/types/SparseMatrix.ts
131
255
  var SparseMatrix_exports = {};
132
256
  __export(SparseMatrix_exports, {
@@ -547,9 +671,9 @@ var init_SparseMatrix = __esm({
547
671
  entries.push({ row: i, col: otherCol, value: other._data[otherIdx] });
548
672
  otherIdx++;
549
673
  } else {
550
- const sum2 = this._data[thisIdx] + other._data[otherIdx];
551
- if (sum2 !== 0) {
552
- entries.push({ row: i, col: thisCol, value: sum2 });
674
+ const sum3 = this._data[thisIdx] + other._data[otherIdx];
675
+ if (sum3 !== 0) {
676
+ entries.push({ row: i, col: thisCol, value: sum3 });
553
677
  }
554
678
  thisIdx++;
555
679
  otherIdx++;
@@ -602,13 +726,13 @@ var init_SparseMatrix = __esm({
602
726
  const rowStart = this._rowPointers[i];
603
727
  const rowEnd = this._rowPointers[i + 1];
604
728
  for (let j = 0; j < other.cols; j++) {
605
- let sum2 = 0;
729
+ let sum3 = 0;
606
730
  for (let k = rowStart; k < rowEnd; k++) {
607
731
  const col = this._colIndices[k];
608
- sum2 += this._data[k] * other.get(col, j);
732
+ sum3 += this._data[k] * other.get(col, j);
609
733
  }
610
- if (sum2 !== 0) {
611
- entries.push({ row: i, col: j, value: sum2 });
734
+ if (sum3 !== 0) {
735
+ entries.push({ row: i, col: j, value: sum3 });
612
736
  }
613
737
  }
614
738
  }
@@ -707,11 +831,11 @@ var init_SparseMatrix = __esm({
707
831
  if (!this.isSquare) {
708
832
  throw new Error("Trace is only defined for square matrices");
709
833
  }
710
- let sum2 = 0;
834
+ let sum3 = 0;
711
835
  for (let i = 0; i < this.rows; i++) {
712
- sum2 += this.get(i, i);
836
+ sum3 += this.get(i, i);
713
837
  }
714
- return sum2;
838
+ return sum3;
715
839
  }
716
840
  // =========================================================================
717
841
  // Conversion Methods
@@ -857,6 +981,8 @@ var init_DenseMatrix = __esm({
857
981
  "src/types/DenseMatrix.ts"() {
858
982
  "use strict";
859
983
  init_Matrix();
984
+ init_arithmetic();
985
+ init_reduction();
860
986
  DenseMatrix = class _DenseMatrix extends Matrix {
861
987
  type = "DenseMatrix";
862
988
  rows;
@@ -1121,80 +1247,40 @@ var init_DenseMatrix = __esm({
1121
1247
  */
1122
1248
  add(other) {
1123
1249
  this.checkDimensionsMatch(other);
1124
- const result = new Float64Array(this.rows * this.cols);
1125
- for (let i = 0; i < this.rows; i++) {
1126
- for (let j = 0; j < this.cols; j++) {
1127
- result[i * this.cols + j] = this.get(i, j) + other.get(i, j);
1128
- }
1129
- }
1130
- return new _DenseMatrix(this.rows, this.cols, result);
1250
+ return new _DenseMatrix(this.rows, this.cols, add(this, other));
1131
1251
  }
1132
1252
  /**
1133
1253
  * Matrix subtraction
1134
1254
  */
1135
1255
  subtract(other) {
1136
1256
  this.checkDimensionsMatch(other);
1137
- const result = new Float64Array(this.rows * this.cols);
1138
- for (let i = 0; i < this.rows; i++) {
1139
- for (let j = 0; j < this.cols; j++) {
1140
- result[i * this.cols + j] = this.get(i, j) - other.get(i, j);
1141
- }
1142
- }
1143
- return new _DenseMatrix(this.rows, this.cols, result);
1257
+ return new _DenseMatrix(this.rows, this.cols, subtract(this, other));
1144
1258
  }
1145
1259
  /**
1146
1260
  * Element-wise multiplication (Hadamard product)
1147
1261
  */
1148
1262
  multiplyElementwise(other) {
1149
1263
  this.checkDimensionsMatch(other);
1150
- const result = new Float64Array(this.rows * this.cols);
1151
- for (let i = 0; i < this.rows; i++) {
1152
- for (let j = 0; j < this.cols; j++) {
1153
- result[i * this.cols + j] = this.get(i, j) * other.get(i, j);
1154
- }
1155
- }
1156
- return new _DenseMatrix(this.rows, this.cols, result);
1264
+ return new _DenseMatrix(this.rows, this.cols, multiplyElementwise(this, other));
1157
1265
  }
1158
1266
  /**
1159
1267
  * Matrix multiplication
1160
1268
  */
1161
1269
  multiply(other) {
1162
1270
  this.checkMultiplyDimensions(other);
1163
- const result = new Float64Array(this.rows * other.cols);
1164
- for (let i = 0; i < this.rows; i++) {
1165
- for (let j = 0; j < other.cols; j++) {
1166
- let sum2 = 0;
1167
- for (let k = 0; k < this.cols; k++) {
1168
- sum2 += this.get(i, k) * other.get(k, j);
1169
- }
1170
- result[i * other.cols + j] = sum2;
1171
- }
1172
- }
1173
- return new _DenseMatrix(this.rows, other.cols, result);
1271
+ return new _DenseMatrix(this.rows, other.cols, multiply(this, other));
1174
1272
  }
1175
1273
  /**
1176
1274
  * Scalar multiplication
1177
1275
  */
1178
1276
  scale(scalar) {
1179
- const result = new Float64Array(this.rows * this.cols);
1180
- for (let i = 0; i < this.rows; i++) {
1181
- for (let j = 0; j < this.cols; j++) {
1182
- result[i * this.cols + j] = this.get(i, j) * scalar;
1183
- }
1184
- }
1185
- return new _DenseMatrix(this.rows, this.cols, result);
1277
+ return new _DenseMatrix(this.rows, this.cols, scale(this, scalar));
1186
1278
  }
1187
1279
  /**
1188
1280
  * Matrix transpose
1189
1281
  */
1190
1282
  transpose() {
1191
- const result = new Float64Array(this.cols * this.rows);
1192
- for (let i = 0; i < this.rows; i++) {
1193
- for (let j = 0; j < this.cols; j++) {
1194
- result[j * this.rows + i] = this.get(i, j);
1195
- }
1196
- }
1197
- return new _DenseMatrix(this.cols, this.rows, result);
1283
+ return new _DenseMatrix(this.cols, this.rows, transpose(this));
1198
1284
  }
1199
1285
  /**
1200
1286
  * Negate all elements
@@ -1209,71 +1295,37 @@ var init_DenseMatrix = __esm({
1209
1295
  * Sum of all elements
1210
1296
  */
1211
1297
  sum() {
1212
- let total = 0;
1213
- for (let i = 0; i < this.rows; i++) {
1214
- for (let j = 0; j < this.cols; j++) {
1215
- total += this.get(i, j);
1216
- }
1217
- }
1218
- return total;
1298
+ return sum(this);
1219
1299
  }
1220
1300
  /**
1221
1301
  * Mean of all elements
1222
1302
  */
1223
1303
  mean() {
1224
- return this.sum() / this.length;
1304
+ return mean(this);
1225
1305
  }
1226
1306
  /**
1227
1307
  * Minimum element
1228
1308
  */
1229
1309
  min() {
1230
- let minVal = Infinity;
1231
- for (let i = 0; i < this.rows; i++) {
1232
- for (let j = 0; j < this.cols; j++) {
1233
- const val = this.get(i, j);
1234
- if (val < minVal) minVal = val;
1235
- }
1236
- }
1237
- return minVal;
1310
+ return min(this);
1238
1311
  }
1239
1312
  /**
1240
1313
  * Maximum element
1241
1314
  */
1242
1315
  max() {
1243
- let maxVal = -Infinity;
1244
- for (let i = 0; i < this.rows; i++) {
1245
- for (let j = 0; j < this.cols; j++) {
1246
- const val = this.get(i, j);
1247
- if (val > maxVal) maxVal = val;
1248
- }
1249
- }
1250
- return maxVal;
1316
+ return max(this);
1251
1317
  }
1252
1318
  /**
1253
1319
  * Frobenius norm (sqrt of sum of squared elements)
1254
1320
  */
1255
1321
  norm() {
1256
- let sum2 = 0;
1257
- for (let i = 0; i < this.rows; i++) {
1258
- for (let j = 0; j < this.cols; j++) {
1259
- const val = this.get(i, j);
1260
- sum2 += val * val;
1261
- }
1262
- }
1263
- return Math.sqrt(sum2);
1322
+ return norm(this);
1264
1323
  }
1265
1324
  /**
1266
1325
  * Trace (sum of diagonal elements)
1267
1326
  */
1268
1327
  trace() {
1269
- if (!this.isSquare) {
1270
- throw new Error("Trace is only defined for square matrices");
1271
- }
1272
- let sum2 = 0;
1273
- for (let i = 0; i < this.rows; i++) {
1274
- sum2 += this.get(i, i);
1275
- }
1276
- return sum2;
1328
+ return trace(this);
1277
1329
  }
1278
1330
  // =========================================================================
1279
1331
  // Conversion Methods
@@ -1693,13 +1745,13 @@ var JSBackend = class {
1693
1745
  if (a.length !== b.length) {
1694
1746
  throw new Error(`Vector lengths must match: ${a.length} vs ${b.length}`);
1695
1747
  }
1696
- let sum2 = 0;
1748
+ let sum3 = 0;
1697
1749
  const aValues = Array.from(a.values());
1698
1750
  const bValues = Array.from(b.values());
1699
1751
  for (let i = 0; i < aValues.length; i++) {
1700
- sum2 += aValues[i] * bValues[i];
1752
+ sum3 += aValues[i] * bValues[i];
1701
1753
  }
1702
- return sum2;
1754
+ return sum3;
1703
1755
  }
1704
1756
  // =========================================================================
1705
1757
  // Utility Methods
@@ -1929,13 +1981,13 @@ var ParallelBackend = class {
1929
1981
  }
1930
1982
  const elementCount = a.length;
1931
1983
  if (!this.shouldParallelize(elementCount) || !this.isReady()) {
1932
- let sum2 = 0;
1984
+ let sum3 = 0;
1933
1985
  const aValues = Array.from(a.values());
1934
1986
  const bValues = Array.from(b.values());
1935
1987
  for (let i = 0; i < aValues.length; i++) {
1936
- sum2 += aValues[i] * bValues[i];
1988
+ sum3 += aValues[i] * bValues[i];
1937
1989
  }
1938
- return sum2;
1990
+ return sum3;
1939
1991
  }
1940
1992
  const aData = a.toFloat64Array();
1941
1993
  const bData = b.toFloat64Array();
@@ -2459,7 +2511,7 @@ var WASMBackend = class {
2459
2511
  Date
2460
2512
  };
2461
2513
  const isNode = typeof process !== "undefined" && process.versions?.node !== void 0;
2462
- const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-P3NYUEMQ.js");
2514
+ const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-X3CLNVGW.js");
2463
2515
  let instance;
2464
2516
  if (isNode) {
2465
2517
  const fs = await import("fs");
@@ -2823,15 +2875,15 @@ var WASMBackend = class {
2823
2875
  }
2824
2876
  const minDim = Math.min(m, n);
2825
2877
  for (let k = 0; k < minDim; k++) {
2826
- let norm3 = 0;
2878
+ let norm4 = 0;
2827
2879
  for (let i = k; i < m; i++) {
2828
2880
  const val = r[i * n + k];
2829
- norm3 += val * val;
2881
+ norm4 += val * val;
2830
2882
  }
2831
- norm3 = Math.sqrt(norm3);
2832
- if (norm3 < 1e-14) continue;
2883
+ norm4 = Math.sqrt(norm4);
2884
+ if (norm4 < 1e-14) continue;
2833
2885
  const sign = r[k * n + k] >= 0 ? 1 : -1;
2834
- const u1 = r[k * n + k] + sign * norm3;
2886
+ const u1 = r[k * n + k] + sign * norm4;
2835
2887
  const v = new Float64Array(m - k);
2836
2888
  v[0] = 1;
2837
2889
  for (let i = 1; i < m - k; i++) v[i] = r[(k + i) * n + k] / u1;
@@ -2899,14 +2951,14 @@ var WASMBackend = class {
2899
2951
  for (let col = 0; col < n; col++) {
2900
2952
  for (let i = 0; i < n; i++) b[i] = i === col ? 1 : 0;
2901
2953
  for (let i = 0; i < n; i++) {
2902
- let sum2 = b[perm[i]];
2903
- for (let j = 0; j < i; j++) sum2 -= luData[i * n + j] * x[j];
2904
- x[i] = sum2;
2954
+ let sum3 = b[perm[i]];
2955
+ for (let j = 0; j < i; j++) sum3 -= luData[i * n + j] * x[j];
2956
+ x[i] = sum3;
2905
2957
  }
2906
2958
  for (let i = n - 1; i >= 0; i--) {
2907
- let sum2 = x[i];
2908
- for (let j = i + 1; j < n; j++) sum2 -= luData[i * n + j] * x[j];
2909
- x[i] = sum2 / luData[i * n + i];
2959
+ let sum3 = x[i];
2960
+ for (let j = i + 1; j < n; j++) sum3 -= luData[i * n + j] * x[j];
2961
+ x[i] = sum3 / luData[i * n + i];
2910
2962
  }
2911
2963
  for (let i = 0; i < n; i++) result[i * n + col] = x[i];
2912
2964
  }
@@ -2982,17 +3034,17 @@ var WASMBackend = class {
2982
3034
  const l = new Float64Array(n * n);
2983
3035
  for (let i = 0; i < n; i++) {
2984
3036
  for (let j = 0; j <= i; j++) {
2985
- let sum2 = aData[i * n + j];
3037
+ let sum3 = aData[i * n + j];
2986
3038
  for (let k = 0; k < j; k++) {
2987
- sum2 -= l[i * n + k] * l[j * n + k];
3039
+ sum3 -= l[i * n + k] * l[j * n + k];
2988
3040
  }
2989
3041
  if (i === j) {
2990
- if (sum2 <= 0) {
3042
+ if (sum3 <= 0) {
2991
3043
  return { l: DenseMatrix.zeros(n, n), positiveDefinite: false };
2992
3044
  }
2993
- l[i * n + j] = Math.sqrt(sum2);
3045
+ l[i * n + j] = Math.sqrt(sum3);
2994
3046
  } else {
2995
- l[i * n + j] = sum2 / l[j * n + j];
3047
+ l[i * n + j] = sum3 / l[j * n + j];
2996
3048
  }
2997
3049
  }
2998
3050
  }
@@ -5005,7 +5057,7 @@ var RustWasmLoader = class _RustWasmLoader {
5005
5057
  try {
5006
5058
  const path = wasmPath || await this.findWasmPath();
5007
5059
  const isNode = typeof process !== "undefined" && process.versions?.node !== void 0;
5008
- const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-P3NYUEMQ.js");
5060
+ const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-X3CLNVGW.js");
5009
5061
  let binarySize = 0;
5010
5062
  if (isNode) {
5011
5063
  const loadStart = performance.now();
@@ -6151,7 +6203,7 @@ var WasmLoader = class _WasmLoader {
6151
6203
  if (this.compiledModule) return;
6152
6204
  const path = wasmPath || await this.getDefaultWasmPath();
6153
6205
  const startTime = performance.now();
6154
- const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-P3NYUEMQ.js");
6206
+ const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-X3CLNVGW.js");
6155
6207
  if (this.isNode) {
6156
6208
  const fs = await import("fs");
6157
6209
  const { promisify } = await import("util");
@@ -6229,7 +6281,7 @@ var WasmLoader = class _WasmLoader {
6229
6281
  const fs = await import("fs");
6230
6282
  const { promisify } = await import("util");
6231
6283
  const readFile = promisify(fs.readFile);
6232
- const { verifyWasmIntegrity } = await import("./integrity-P3NYUEMQ.js");
6284
+ const { verifyWasmIntegrity } = await import("./integrity-X3CLNVGW.js");
6233
6285
  const readStart = performance.now();
6234
6286
  const buffer = await readFile(path);
6235
6287
  const readEnd = performance.now();
@@ -6250,7 +6302,7 @@ var WasmLoader = class _WasmLoader {
6250
6302
  return instance.exports;
6251
6303
  }
6252
6304
  async loadBrowserWasm(path, totalStart) {
6253
- const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-P3NYUEMQ.js");
6305
+ const { loadWasmManifest, verifyWasmIntegrity } = await import("./integrity-X3CLNVGW.js");
6254
6306
  const manifest = await loadWasmManifest(path);
6255
6307
  if (!manifest && typeof WebAssembly.instantiateStreaming === "function") {
6256
6308
  const instStart2 = performance.now();
@@ -6595,9 +6647,9 @@ var WasmLoader = class _WasmLoader {
6595
6647
  */
6596
6648
  getPoolStats() {
6597
6649
  const f64InUse = this.float64Pool.filter((e) => e.inUse).length;
6598
- const f64Bytes = this.float64Pool.reduce((sum2, e) => sum2 + e.size, 0);
6650
+ const f64Bytes = this.float64Pool.reduce((sum3, e) => sum3 + e.size, 0);
6599
6651
  const i32InUse = this.int32Pool.filter((e) => e.inUse).length;
6600
- const i32Bytes = this.int32Pool.reduce((sum2, e) => sum2 + e.size, 0);
6652
+ const i32Bytes = this.int32Pool.reduce((sum3, e) => sum3 + e.size, 0);
6601
6653
  return {
6602
6654
  float64: {
6603
6655
  total: this.float64Pool.length,
@@ -6771,11 +6823,11 @@ function svdStep(d, e, U, V, start, end) {
6771
6823
  const a = dm1 * dm1 + (end > start + 1 ? e[end - 2] * e[end - 2] : 0);
6772
6824
  const b = dm1 * em1;
6773
6825
  const c = dn * dn + em1 * em1;
6774
- const trace2 = a + c;
6826
+ const trace3 = a + c;
6775
6827
  const det = a * c - b * b;
6776
- const disc = Math.sqrt(Math.max(0, trace2 * trace2 / 4 - det));
6777
- const e1 = trace2 / 2 + disc;
6778
- const e2 = trace2 / 2 - disc;
6828
+ const disc = Math.sqrt(Math.max(0, trace3 * trace3 / 4 - det));
6829
+ const e1 = trace3 / 2 + disc;
6830
+ const e2 = trace3 / 2 - disc;
6779
6831
  const shift = Math.abs(e1 - c) < Math.abs(e2 - c) ? e1 : e2;
6780
6832
  let f = d[start] * d[start] - shift;
6781
6833
  let g = d[start] * e[start];
@@ -6942,11 +6994,11 @@ function pinv(matrix2, options) {
6942
6994
  const result = Array.from({ length: n }, () => new Array(m).fill(0));
6943
6995
  for (let i = 0; i < n; i++) {
6944
6996
  for (let j = 0; j < m; j++) {
6945
- let sum2 = 0;
6997
+ let sum3 = 0;
6946
6998
  for (let l = 0; l < k; l++) {
6947
- sum2 += V[i][l] * Sinv[l] * U[j][l];
6999
+ sum3 += V[i][l] * Sinv[l] * U[j][l];
6948
7000
  }
6949
- result[i][j] = sum2;
7001
+ result[i][j] = sum3;
6950
7002
  }
6951
7003
  }
6952
7004
  return result;
@@ -6959,11 +7011,11 @@ function lowRankApprox(matrix2, r, options) {
6959
7011
  const result = Array.from({ length: m }, () => new Array(n).fill(0));
6960
7012
  for (let i = 0; i < m; i++) {
6961
7013
  for (let j = 0; j < n; j++) {
6962
- let sum2 = 0;
7014
+ let sum3 = 0;
6963
7015
  for (let l = 0; l < k; l++) {
6964
- sum2 += U[i][l] * S[l] * V[j][l];
7016
+ sum3 += U[i][l] * S[l] * V[j][l];
6965
7017
  }
6966
- result[i][j] = sum2;
7018
+ result[i][j] = sum3;
6967
7019
  }
6968
7020
  }
6969
7021
  return result;
@@ -6980,13 +7032,13 @@ function norm2(matrix2, options) {
6980
7032
  return S[0] || 0;
6981
7033
  }
6982
7034
  function normFro(matrix2) {
6983
- let sum2 = 0;
7035
+ let sum3 = 0;
6984
7036
  for (const row2 of matrix2) {
6985
7037
  for (const val of row2) {
6986
- sum2 += val * val;
7038
+ sum3 += val * val;
6987
7039
  }
6988
7040
  }
6989
- return Math.sqrt(sum2);
7041
+ return Math.sqrt(sum3);
6990
7042
  }
6991
7043
 
6992
7044
  // src/operations/eig-wasm.ts
@@ -7100,7 +7152,7 @@ async function spectralRadiusWasm(matrix2, options) {
7100
7152
  const n = matrix2.length;
7101
7153
  const wasmModule = wasmLoader.getModule();
7102
7154
  if (!wasmModule || n < WASM_EIG_THRESHOLD) {
7103
- const { powerIteration: powerIteration2 } = await import("./eig-D5URIBNL.js");
7155
+ const { powerIteration: powerIteration2 } = await import("./eig-A5GJGSJJ.js");
7104
7156
  const result = powerIteration2(matrix2, options);
7105
7157
  return Math.abs(result.value);
7106
7158
  }
@@ -7119,7 +7171,7 @@ async function spectralRadiusWasm(matrix2, options) {
7119
7171
  );
7120
7172
  return radius;
7121
7173
  } catch {
7122
- const { powerIteration: powerIteration2 } = await import("./eig-D5URIBNL.js");
7174
+ const { powerIteration: powerIteration2 } = await import("./eig-A5GJGSJJ.js");
7123
7175
  const result = powerIteration2(matrix2, options);
7124
7176
  return Math.abs(result.value);
7125
7177
  } finally {
@@ -7209,11 +7261,11 @@ function pinv2(A, opts) {
7209
7261
  const pinvData = new Float64Array(n * m);
7210
7262
  for (let i = 0; i < n; i++) {
7211
7263
  for (let j = 0; j < m; j++) {
7212
- let sum2 = 0;
7264
+ let sum3 = 0;
7213
7265
  for (let l = 0; l < k; l++) {
7214
- sum2 += V[i][l] * Sinv[l] * U[j][l];
7266
+ sum3 += V[i][l] * Sinv[l] * U[j][l];
7215
7267
  }
7216
- pinvData[i * m + j] = sum2;
7268
+ pinvData[i * m + j] = sum3;
7217
7269
  }
7218
7270
  }
7219
7271
  return new DenseMatrix(n, m, pinvData);
@@ -7260,11 +7312,11 @@ function qr(A, opts) {
7260
7312
  R[q * n + j] += dot;
7261
7313
  for (let i = 0; i < m; i++) Qcm[i + j * m] -= dot * Qcm[i + q * m];
7262
7314
  }
7263
- let norm3 = 0;
7264
- for (let i = 0; i < m; i++) norm3 += Qcm[i + j * m] * Qcm[i + j * m];
7265
- norm3 = Math.sqrt(norm3);
7266
- R[j * n + j] = norm3;
7267
- if (norm3 < 1e-14) {
7315
+ let norm4 = 0;
7316
+ for (let i = 0; i < m; i++) norm4 += Qcm[i + j * m] * Qcm[i + j * m];
7317
+ norm4 = Math.sqrt(norm4);
7318
+ R[j * n + j] = norm4;
7319
+ if (norm4 < 1e-14) {
7268
7320
  for (let trial = 0; trial < m; trial++) {
7269
7321
  for (let i = 0; i < m; i++) Qcm[i + j * m] = i === trial ? 1 : 0;
7270
7322
  for (let pass = 0; pass < 2; pass++) {
@@ -7283,7 +7335,7 @@ function qr(A, opts) {
7283
7335
  }
7284
7336
  }
7285
7337
  } else {
7286
- for (let i = 0; i < m; i++) Qcm[i + j * m] /= norm3;
7338
+ for (let i = 0; i < m; i++) Qcm[i + j * m] /= norm4;
7287
7339
  }
7288
7340
  for (let c = j + 1; c < n; c++) {
7289
7341
  let dot = 0;
@@ -7302,11 +7354,11 @@ function qr(A, opts) {
7302
7354
  for (let i = 0; i < m; i++) Qcm[i + nextCol * m] -= dot * Qcm[i + q * m];
7303
7355
  }
7304
7356
  }
7305
- let norm3 = 0;
7306
- for (let i = 0; i < m; i++) norm3 += Qcm[i + nextCol * m] * Qcm[i + nextCol * m];
7307
- norm3 = Math.sqrt(norm3);
7308
- if (norm3 > 1e-12) {
7309
- for (let i = 0; i < m; i++) Qcm[i + nextCol * m] /= norm3;
7357
+ let norm4 = 0;
7358
+ for (let i = 0; i < m; i++) norm4 += Qcm[i + nextCol * m] * Qcm[i + nextCol * m];
7359
+ norm4 = Math.sqrt(norm4);
7360
+ if (norm4 > 1e-12) {
7361
+ for (let i = 0; i < m; i++) Qcm[i + nextCol * m] /= norm4;
7310
7362
  nextCol++;
7311
7363
  }
7312
7364
  }
@@ -7395,21 +7447,21 @@ function cholesky(A) {
7395
7447
  const lData = new Float64Array(n * n);
7396
7448
  for (let i = 0; i < n; i++) {
7397
7449
  for (let j = 0; j <= i; j++) {
7398
- let sum2 = src[i * n + j];
7450
+ let sum3 = src[i * n + j];
7399
7451
  for (let k = 0; k < j; k++) {
7400
- sum2 -= lData[i * n + k] * lData[j * n + k];
7452
+ sum3 -= lData[i * n + k] * lData[j * n + k];
7401
7453
  }
7402
7454
  if (i === j) {
7403
- if (sum2 <= 0) {
7455
+ if (sum3 <= 0) {
7404
7456
  throw new Error("cholesky: matrix is not positive definite");
7405
7457
  }
7406
- lData[i * n + j] = Math.sqrt(sum2);
7458
+ lData[i * n + j] = Math.sqrt(sum3);
7407
7459
  } else {
7408
7460
  const ljj = lData[j * n + j];
7409
7461
  if (ljj === 0) {
7410
7462
  throw new Error("cholesky: matrix is not positive definite");
7411
7463
  }
7412
- lData[i * n + j] = sum2 / ljj;
7464
+ lData[i * n + j] = sum3 / ljj;
7413
7465
  }
7414
7466
  }
7415
7467
  }
@@ -7668,14 +7720,14 @@ function qrStepSingle(H, Q, start, end) {
7668
7720
  const b = H[end - 1][end];
7669
7721
  const c = H[end][end - 1];
7670
7722
  const d = H[end][end];
7671
- const trace2 = a + d;
7723
+ const trace3 = a + d;
7672
7724
  const det = a * d - b * c;
7673
- const disc = trace2 * trace2 - 4 * det;
7725
+ const disc = trace3 * trace3 - 4 * det;
7674
7726
  let shift;
7675
7727
  if (disc >= 0) {
7676
7728
  const sqrtDisc = Math.sqrt(disc);
7677
- const e1 = (trace2 + sqrtDisc) / 2;
7678
- const e2 = (trace2 - sqrtDisc) / 2;
7729
+ const e1 = (trace3 + sqrtDisc) / 2;
7730
+ const e2 = (trace3 - sqrtDisc) / 2;
7679
7731
  shift = Math.abs(e1 - d) < Math.abs(e2 - d) ? e1 : e2;
7680
7732
  } else {
7681
7733
  shift = d;
@@ -7749,8 +7801,8 @@ function schurRaw(A, maxIterations, tolerance) {
7749
7801
  while (end > 0 && iter < maxIterations) {
7750
7802
  let start = end;
7751
7803
  while (start > 0) {
7752
- const scale = Math.abs(H[start - 1][start - 1]) + Math.abs(H[start][start]);
7753
- if (Math.abs(H[start][start - 1]) <= tolerance * scale) {
7804
+ const scale2 = Math.abs(H[start - 1][start - 1]) + Math.abs(H[start][start]);
7805
+ if (Math.abs(H[start][start - 1]) <= tolerance * scale2) {
7754
7806
  H[start][start - 1] = 0;
7755
7807
  break;
7756
7808
  }
@@ -7822,7 +7874,7 @@ function matMul2(A, B2) {
7822
7874
  }
7823
7875
  return C;
7824
7876
  }
7825
- function transpose(A) {
7877
+ function transpose2(A) {
7826
7878
  const m = A.length;
7827
7879
  const n = A[0].length;
7828
7880
  return Array.from({ length: n }, (_, j) => Array.from({ length: m }, (_2, i) => A[i][j]));
@@ -7983,10 +8035,10 @@ function sqrtUpperTriangular(T) {
7983
8035
  }
7984
8036
  for (let j = 1; j < n; j++) {
7985
8037
  for (let i = j - 1; i >= 0; i--) {
7986
- let sum2 = 0;
7987
- for (let k = i + 1; k < j; k++) sum2 += U[i][k] * U[k][j];
8038
+ let sum3 = 0;
8039
+ for (let k = i + 1; k < j; k++) sum3 += U[i][k] * U[k][j];
7988
8040
  const denom = U[i][i] + U[j][j];
7989
- U[i][j] = Math.abs(denom) < 1e-14 ? 0 : (T[i][j] - sum2) / denom;
8041
+ U[i][j] = Math.abs(denom) < 1e-14 ? 0 : (T[i][j] - sum3) / denom;
7990
8042
  }
7991
8043
  }
7992
8044
  return U;
@@ -8038,8 +8090,8 @@ function logmSchur(A, tol) {
8038
8090
  if (norm12(MminI) >= tol) return null;
8039
8091
  let logT = logPade(MminI);
8040
8092
  if (numSqrt > 0) {
8041
- const scale = Math.pow(2, numSqrt);
8042
- logT = logT.map((row2) => row2.map((v) => v * scale));
8093
+ const scale2 = Math.pow(2, numSqrt);
8094
+ logT = logT.map((row2) => row2.map((v) => v * scale2));
8043
8095
  }
8044
8096
  const Qt = transposeArr(Q);
8045
8097
  return matMulArr(matMulArr(Q, logT), Qt);
@@ -8075,7 +8127,7 @@ function logmEig(A) {
8075
8127
  }
8076
8128
  }
8077
8129
  const V = vectors;
8078
- const Q = transpose(V);
8130
+ const Q = transpose2(V);
8079
8131
  const Qinv = matInv(Q);
8080
8132
  if (Qinv === null) {
8081
8133
  throw new Error(
@@ -8147,7 +8199,7 @@ function matMul3(A, B2) {
8147
8199
  }
8148
8200
  return C;
8149
8201
  }
8150
- function transpose2(A) {
8202
+ function transpose3(A) {
8151
8203
  const m = A.length;
8152
8204
  const n = A[0].length;
8153
8205
  return Array.from({ length: n }, (_, j) => Array.from({ length: m }, (_2, i) => A[i][j]));
@@ -8200,13 +8252,13 @@ function gramSchmidt(A) {
8200
8252
  for (let i = 0; i < m; i++) dot += Q[i][k] * v[i];
8201
8253
  for (let i = 0; i < m; i++) v[i] -= dot * Q[i][k];
8202
8254
  }
8203
- let norm3 = 0;
8204
- for (let i = 0; i < m; i++) norm3 += v[i] * v[i];
8205
- norm3 = Math.sqrt(norm3);
8206
- if (norm3 < 1e-14) {
8255
+ let norm4 = 0;
8256
+ for (let i = 0; i < m; i++) norm4 += v[i] * v[i];
8257
+ norm4 = Math.sqrt(norm4);
8258
+ if (norm4 < 1e-14) {
8207
8259
  for (let i = 0; i < m; i++) Q[i][j] = i === j ? 1 : 0;
8208
8260
  } else {
8209
- for (let i = 0; i < m; i++) Q[i][j] = v[i] / norm3;
8261
+ for (let i = 0; i < m; i++) Q[i][j] = v[i] / norm4;
8210
8262
  }
8211
8263
  }
8212
8264
  return Q;
@@ -8224,9 +8276,9 @@ function sqrtmSymmetric(A) {
8224
8276
  }
8225
8277
  const Ynewton = sqrtmNewton(Asym);
8226
8278
  if (Ynewton !== null) return Ynewton;
8227
- const Qraw = transpose2(vectors);
8279
+ const Qraw = transpose3(vectors);
8228
8280
  const Q = gramSchmidt(Qraw);
8229
- const Qt = transpose2(Q);
8281
+ const Qt = transpose3(Q);
8230
8282
  const Dsqrt = eye5(n);
8231
8283
  for (let i = 0; i < n; i++) Dsqrt[i][i] = Math.sqrt(Math.max(values[i].re, 0));
8232
8284
  return matMul3(matMul3(Q, Dsqrt), Qt);
@@ -8272,7 +8324,7 @@ function sqrtmGeneral(A) {
8272
8324
  const Ynewton = sqrtmNewton(A);
8273
8325
  if (Ynewton !== null) return Ynewton;
8274
8326
  const V = vectors;
8275
- const Q = transpose2(V);
8327
+ const Q = transpose3(V);
8276
8328
  const Qinv = matInv2(Q);
8277
8329
  if (Qinv === null) {
8278
8330
  throw new Error(
@@ -8341,9 +8393,9 @@ function sqrtmQuasiTriangular(T) {
8341
8393
  const sk = blockSize[bk];
8342
8394
  for (let ii = 0; ii < si; ii++) {
8343
8395
  for (let jj = 0; jj < sj; jj++) {
8344
- let sum2 = 0;
8345
- for (let kk = 0; kk < sk; kk++) sum2 += U[ri + ii][rk + kk] * U[rk + kk][rj + jj];
8346
- RHS[ii][jj] -= sum2;
8396
+ let sum3 = 0;
8397
+ for (let kk = 0; kk < sk; kk++) sum3 += U[ri + ii][rk + kk] * U[rk + kk][rj + jj];
8398
+ RHS[ii][jj] -= sum3;
8347
8399
  }
8348
8400
  }
8349
8401
  }
@@ -8479,7 +8531,7 @@ var diag = mathTyped("diag", {
8479
8531
  var random = mathTyped("random", {
8480
8532
  "number, number": (rows, cols) => DenseMatrix.random(rows, cols)
8481
8533
  });
8482
- var add = mathTyped("add", {
8534
+ var add2 = mathTyped("add", {
8483
8535
  // Matrix + Matrix
8484
8536
  "DenseMatrix, DenseMatrix": (a, b) => a.add(b),
8485
8537
  // Matrix + scalar
@@ -8489,7 +8541,7 @@ var add = mathTyped("add", {
8489
8541
  // Fallback for number + number (delegates to core)
8490
8542
  "number, number": (a, b) => a + b
8491
8543
  });
8492
- var subtract = mathTyped("subtract", {
8544
+ var subtract2 = mathTyped("subtract", {
8493
8545
  // Matrix - Matrix
8494
8546
  "DenseMatrix, DenseMatrix": (a, b) => a.subtract(b),
8495
8547
  // Matrix - scalar
@@ -8499,7 +8551,7 @@ var subtract = mathTyped("subtract", {
8499
8551
  // Fallback for number - number
8500
8552
  "number, number": (a, b) => a - b
8501
8553
  });
8502
- var multiply = mathTyped("multiply", {
8554
+ var multiply2 = mathTyped("multiply", {
8503
8555
  // Matrix * Matrix (matmul)
8504
8556
  "DenseMatrix, DenseMatrix": (a, b) => a.multiply(b),
8505
8557
  // Matrix * scalar (scale)
@@ -8525,32 +8577,32 @@ var unaryMinus = mathTyped("unaryMinus", {
8525
8577
  DenseMatrix: (a) => a.negate(),
8526
8578
  number: (a) => -a
8527
8579
  });
8528
- var transpose3 = mathTyped("transpose", {
8580
+ var transpose4 = mathTyped("transpose", {
8529
8581
  DenseMatrix: (a) => a.transpose()
8530
8582
  });
8531
- var sum = mathTyped("sum", {
8583
+ var sum2 = mathTyped("sum", {
8532
8584
  DenseMatrix: (a) => a.sum(),
8533
8585
  Array: (arr) => arr.reduce((acc, v) => acc + v, 0)
8534
8586
  });
8535
- var mean = mathTyped("mean", {
8587
+ var mean2 = mathTyped("mean", {
8536
8588
  DenseMatrix: (a) => a.mean(),
8537
8589
  Array: (arr) => arr.reduce((acc, v) => acc + v, 0) / arr.length
8538
8590
  });
8539
- var min = mathTyped("min", {
8591
+ var min2 = mathTyped("min", {
8540
8592
  DenseMatrix: (a) => a.min(),
8541
8593
  Array: (arr) => Math.min(...arr),
8542
8594
  "number, number": (a, b) => Math.min(a, b)
8543
8595
  });
8544
- var max = mathTyped("max", {
8596
+ var max2 = mathTyped("max", {
8545
8597
  DenseMatrix: (a) => a.max(),
8546
8598
  Array: (arr) => Math.max(...arr),
8547
8599
  "number, number": (a, b) => Math.max(a, b)
8548
8600
  });
8549
- var norm = mathTyped("norm", {
8601
+ var norm3 = mathTyped("norm", {
8550
8602
  DenseMatrix: (a) => a.norm(),
8551
8603
  Array: (arr) => Math.sqrt(arr.reduce((acc, v) => acc + v * v, 0))
8552
8604
  });
8553
- var trace = mathTyped("trace", {
8605
+ var trace2 = mathTyped("trace", {
8554
8606
  DenseMatrix: (a) => a.trace()
8555
8607
  });
8556
8608
  var abs = mathTyped("abs", {
@@ -8608,20 +8660,20 @@ var typedMatrixOperations = {
8608
8660
  diag,
8609
8661
  random,
8610
8662
  // Arithmetic
8611
- add,
8612
- subtract,
8613
- multiply,
8663
+ add: add2,
8664
+ subtract: subtract2,
8665
+ multiply: multiply2,
8614
8666
  dotMultiply,
8615
8667
  divide,
8616
8668
  unaryMinus,
8617
- transpose: transpose3,
8669
+ transpose: transpose4,
8618
8670
  // Reductions
8619
- sum,
8620
- mean,
8621
- min,
8622
- max,
8623
- norm,
8624
- trace,
8671
+ sum: sum2,
8672
+ mean: mean2,
8673
+ min: min2,
8674
+ max: max2,
8675
+ norm: norm3,
8676
+ trace: trace2,
8625
8677
  // Element-wise
8626
8678
  abs,
8627
8679
  sqrt,
@@ -8666,8 +8718,8 @@ async function pNorm(data) {
8666
8718
  async function pDistance(a, b) {
8667
8719
  return computePool2.distance(a, b);
8668
8720
  }
8669
- async function pHistogram(data, bins, min2, max2) {
8670
- return computePool2.histogram(data, bins, min2, max2);
8721
+ async function pHistogram(data, bins, min3, max3) {
8722
+ return computePool2.histogram(data, bins, min3, max3);
8671
8723
  }
8672
8724
  async function pAbs(data) {
8673
8725
  return computePool2.abs(data);
@@ -8918,11 +8970,11 @@ var parallelMatrixSum = mathTyped2("parallelMatrixSum", {
8918
8970
  return result.result;
8919
8971
  },
8920
8972
  Array: (arr) => {
8921
- let sum2 = 0;
8973
+ let sum3 = 0;
8922
8974
  for (let i = 0; i < arr.length; i++) {
8923
- sum2 += arr[i];
8975
+ sum3 += arr[i];
8924
8976
  }
8925
- return sum2;
8977
+ return sum3;
8926
8978
  }
8927
8979
  });
8928
8980
  var parallelMatrixMean = mathTyped2("parallelMatrixMean", {
@@ -8937,11 +8989,11 @@ var parallelMatrixMean = mathTyped2("parallelMatrixMean", {
8937
8989
  },
8938
8990
  Array: (arr) => {
8939
8991
  if (arr.length === 0) return NaN;
8940
- let sum2 = 0;
8992
+ let sum3 = 0;
8941
8993
  for (let i = 0; i < arr.length; i++) {
8942
- sum2 += arr[i];
8994
+ sum3 += arr[i];
8943
8995
  }
8944
- return sum2 / arr.length;
8996
+ return sum3 / arr.length;
8945
8997
  }
8946
8998
  });
8947
8999
  var parallelMatrixMin = mathTyped2("parallelMatrixMin", {
@@ -9017,11 +9069,11 @@ var parallelMatrixNorm = mathTyped2("parallelMatrixNorm", {
9017
9069
  return result.result;
9018
9070
  },
9019
9071
  Array: (arr) => {
9020
- let sum2 = 0;
9072
+ let sum3 = 0;
9021
9073
  for (let i = 0; i < arr.length; i++) {
9022
- sum2 += arr[i] * arr[i];
9074
+ sum3 += arr[i] * arr[i];
9023
9075
  }
9024
- return Math.sqrt(sum2);
9076
+ return Math.sqrt(sum3);
9025
9077
  }
9026
9078
  });
9027
9079
  var parallelMatrixDot = mathTyped2("parallelMatrixDot", {
@@ -9036,12 +9088,12 @@ var parallelMatrixDot = mathTyped2("parallelMatrixDot", {
9036
9088
  return result.result;
9037
9089
  },
9038
9090
  "Array, Array": (a, b) => {
9039
- let sum2 = 0;
9091
+ let sum3 = 0;
9040
9092
  const n = Math.min(a.length, b.length);
9041
9093
  for (let i = 0; i < n; i++) {
9042
- sum2 += a[i] * b[i];
9094
+ sum3 += a[i] * b[i];
9043
9095
  }
9044
- return sum2;
9096
+ return sum3;
9045
9097
  }
9046
9098
  });
9047
9099
  var parallelMatrixTrace = mathTyped2("parallelMatrixTrace", {
@@ -9222,8 +9274,8 @@ var parallelMatrixHistogram = mathTyped2("parallelMatrixHistogram", {
9222
9274
  const result = await pHistogram(a, bins);
9223
9275
  return result.result;
9224
9276
  },
9225
- "Float64Array, number, number, number": async (a, bins, min2, max2) => {
9226
- const result = await pHistogram(a, bins, min2, max2);
9277
+ "Float64Array, number, number, number": async (a, bins, min3, max3) => {
9278
+ const result = await pHistogram(a, bins, min3, max3);
9227
9279
  return result.result;
9228
9280
  }
9229
9281
  });
@@ -9302,7 +9354,7 @@ export {
9302
9354
  SyncManager,
9303
9355
  WASMBackend,
9304
9356
  abs,
9305
- add,
9357
+ add2 as add,
9306
9358
  backendManager,
9307
9359
  backendRegistry,
9308
9360
  cholesky,
@@ -9354,11 +9406,11 @@ export {
9354
9406
  pinv2 as matrixPinv,
9355
9407
  matrixSchur,
9356
9408
  matrixSqrtm,
9357
- max,
9358
- mean,
9359
- min,
9360
- multiply,
9361
- norm,
9409
+ max2 as max,
9410
+ mean2 as mean,
9411
+ min2 as min,
9412
+ multiply2 as multiply,
9413
+ norm3 as norm,
9362
9414
  norm2,
9363
9415
  normFro,
9364
9416
  ones,
@@ -9417,13 +9469,13 @@ export {
9417
9469
  sqrt,
9418
9470
  square,
9419
9471
  subset,
9420
- subtract,
9421
- sum,
9472
+ subtract2 as subtract,
9473
+ sum2 as sum,
9422
9474
  svd,
9423
9475
  svdWasm,
9424
9476
  terminateParallelMatrix,
9425
- trace,
9426
- transpose3 as transpose,
9477
+ trace2 as trace,
9478
+ transpose4 as transpose,
9427
9479
  typedMatrixOperations,
9428
9480
  unaryMinus,
9429
9481
  wasmBackend,
@@ -1,4 +1,4 @@
1
- import "./chunk-PNKVD2UK.js";
1
+ import "./chunk-4VMDO6W2.js";
2
2
 
3
3
  // src/backends/wasm/integrity.ts
4
4
  var ALGO = "sha384";
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "@danielsimonjr/mathts-matrix",
3
- "version": "0.1.3",
4
- "description": "Matrix operations for MathTS with WASM/WebGPU backend support",
5
- "author": "Daniel Simon Jr.",
6
- "license": "MIT",
7
- "type": "module",
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
15
- }
16
- },
17
- "files": [
18
- "dist",
19
- "README.md"
20
- ],
21
- "scripts": {
22
- "build": "tsup src/index.ts --format esm --dts --clean",
23
- "dev": "tsup src/index.ts --format esm --dts --watch",
24
- "test": "vitest run",
25
- "test:watch": "vitest",
26
- "test:coverage": "vitest run --coverage",
27
- "typecheck": "tsc --noEmit",
28
- "lint": "eslint src --ext .ts",
29
- "lint:fix": "eslint src --ext .ts --fix",
30
- "clean": "rm -rf dist",
31
- "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
32
- },
33
- "dependencies": {
34
- "@danielsimonjr/mathts-core": "*",
35
- "@danielsimonjr/mathts-parallel": "*"
36
- },
37
- "devDependencies": {
38
- "@types/node": "^25.5.2",
39
- "@webgpu/types": "^0.1.67",
40
- "tsup": "^8.0.0",
41
- "typescript": "^5.3.0",
42
- "vitest": "^4.1.5"
43
- },
44
- "publishConfig": {
45
- "access": "public"
46
- },
47
- "repository": {
48
- "type": "git",
49
- "url": "https://github.com/danielsimonjr/mathts",
50
- "directory": "matrix"
51
- },
52
- "keywords": [
53
- "math",
54
- "matrix",
55
- "linear-algebra",
56
- "typescript",
57
- "wasm",
58
- "webgpu"
59
- ]
60
- }
1
+ {
2
+ "name": "@danielsimonjr/mathts-matrix",
3
+ "version": "0.1.5",
4
+ "description": "Matrix operations for MathTS with WASM/WebGPU backend support",
5
+ "author": "Daniel Simon Jr.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "tsup src/index.ts --format esm --dts --clean",
23
+ "dev": "tsup src/index.ts --format esm --dts --watch",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest",
26
+ "test:coverage": "vitest run --coverage",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src --ext .ts",
29
+ "lint:fix": "eslint src --ext .ts --fix",
30
+ "clean": "rm -rf dist",
31
+ "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
32
+ },
33
+ "dependencies": {
34
+ "@danielsimonjr/mathts-core": "0.1.4",
35
+ "@danielsimonjr/mathts-parallel": "0.2.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^25.5.2",
39
+ "@webgpu/types": "^0.1.67",
40
+ "tsup": "^8.0.0",
41
+ "typescript": "^5.3.0",
42
+ "vitest": "^4.1.5"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/danielsimonjr/mathts",
50
+ "directory": "matrix"
51
+ },
52
+ "keywords": [
53
+ "math",
54
+ "matrix",
55
+ "linear-algebra",
56
+ "typescript",
57
+ "wasm",
58
+ "webgpu"
59
+ ]
60
+ }