@danielsimonjr/mathts-tensor 0.2.19 → 0.2.21

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 (45) hide show
  1. package/README.md +21 -21
  2. package/dist/Tensor.d.ts +187 -0
  3. package/dist/Tensor.d.ts.map +1 -0
  4. package/dist/contraction-sequence.d.ts +95 -0
  5. package/dist/contraction-sequence.d.ts.map +1 -0
  6. package/dist/index.d.ts +37 -1129
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +1 -1
  9. package/dist/named-index.d.ts +76 -0
  10. package/dist/named-index.d.ts.map +1 -0
  11. package/dist/operations/cholesky.d.ts +49 -0
  12. package/dist/operations/cholesky.d.ts.map +1 -0
  13. package/dist/operations/concatenate.d.ts +35 -0
  14. package/dist/operations/concatenate.d.ts.map +1 -0
  15. package/dist/operations/eig.d.ts +52 -0
  16. package/dist/operations/eig.d.ts.map +1 -0
  17. package/dist/operations/flip.d.ts +35 -0
  18. package/dist/operations/flip.d.ts.map +1 -0
  19. package/dist/operations/gather.d.ts +33 -0
  20. package/dist/operations/gather.d.ts.map +1 -0
  21. package/dist/operations/kron.d.ts +39 -0
  22. package/dist/operations/kron.d.ts.map +1 -0
  23. package/dist/operations/lu.d.ts +50 -0
  24. package/dist/operations/lu.d.ts.map +1 -0
  25. package/dist/operations/pad.d.ts +51 -0
  26. package/dist/operations/pad.d.ts.map +1 -0
  27. package/dist/operations/pinv.d.ts +40 -0
  28. package/dist/operations/pinv.d.ts.map +1 -0
  29. package/dist/operations/qr.d.ts +51 -0
  30. package/dist/operations/qr.d.ts.map +1 -0
  31. package/dist/operations/random.d.ts +62 -0
  32. package/dist/operations/random.d.ts.map +1 -0
  33. package/dist/operations/roll.d.ts +44 -0
  34. package/dist/operations/roll.d.ts.map +1 -0
  35. package/dist/operations/scatter.d.ts +55 -0
  36. package/dist/operations/scatter.d.ts.map +1 -0
  37. package/dist/operations/slice.d.ts +44 -0
  38. package/dist/operations/slice.d.ts.map +1 -0
  39. package/dist/operations/solve.d.ts +56 -0
  40. package/dist/operations/solve.d.ts.map +1 -0
  41. package/dist/operations/stack.d.ts +51 -0
  42. package/dist/operations/stack.d.ts.map +1 -0
  43. package/dist/operations/svd.d.ts +68 -0
  44. package/dist/operations/svd.d.ts.map +1 -0
  45. package/package.json +11 -11
@@ -0,0 +1,44 @@
1
+ /**
2
+ * roll — cyclic shift along given axes.
3
+ *
4
+ * Each element is moved `shifts[k]` positions forward along `axes[k]`
5
+ * (wrapping around at the axis boundaries). Negative shifts move backward.
6
+ *
7
+ * When `axes` is omitted, `shifts` must be a single number and the tensor is
8
+ * treated as a flattened 1-D array that is shifted by that amount, then
9
+ * reshaped back to the original shape — exactly matching NumPy `np.roll(t, n)`.
10
+ *
11
+ * Implementation: for each output flat index, the corresponding input flat
12
+ * index is computed by decoding the multi-index, un-shifting each specified
13
+ * axis (with modulo wrap), then re-encoding to a flat input index.
14
+ *
15
+ * Axis-label semantics: cyclic shifting does not change the semantic identity
16
+ * of any axis (it is the same axis with reordered elements), so all axis
17
+ * labels from the input are preserved unchanged in the output.
18
+ */
19
+ import { Tensor } from '../Tensor.js';
20
+ /**
21
+ * Cyclically shift a tensor along given axes.
22
+ *
23
+ * @param t - Input tensor of any rank.
24
+ * @param shifts - Number of positions to shift. A single number when `axes` is
25
+ * omitted (flat shift); an array of the same length as `axes`
26
+ * when `axes` is provided.
27
+ * @param axes - Axes to shift along. Supports negative indexing. When
28
+ * omitted, the tensor is treated as flattened and `shifts` must
29
+ * be a single number.
30
+ * @returns A new `Tensor` with the same shape as `t`, with axis labels
31
+ * preserved from `t`.
32
+ *
33
+ * @throws {Error} If `axes` is provided and `shifts` array length !== `axes`
34
+ * length, or if any axis value is out of range.
35
+ *
36
+ * @example
37
+ * // Shift a rank-1 tensor [1,2,3,4,5] by 2: → [4,5,1,2,3]
38
+ * const r = roll(t, 2, [0]);
39
+ *
40
+ * // Flat shift (no axes):
41
+ * const flat = roll(matrix, 3);
42
+ */
43
+ export declare function roll(t: Tensor, shifts: number | readonly number[], axes?: readonly number[]): Tensor;
44
+ //# sourceMappingURL=roll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roll.d.ts","sourceRoot":"","sources":["../../src/operations/roll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,IAAI,CAClB,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAkFR"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * scatter — inverse of gather. Writes `updates` into a copy of `t` at the
3
+ * given `indices` along `axis` (NumPy `np.put_along_axis` / JAX `scatter`).
4
+ *
5
+ * For each position `i` in `indices`, the corresponding "slice" of `updates`
6
+ * along `axis` is written into the matching "slice" of the output at position
7
+ * `indices[i]`. All positions of `t` not referenced by `indices` are copied
8
+ * unchanged.
9
+ *
10
+ * Duplicate-index semantics: **last-wins** — when the same index appears more
11
+ * than once in `indices`, the last occurrence overwrites earlier ones. This
12
+ * mirrors NumPy's default scatter behaviour. Document-level note: if
13
+ * deterministic accumulation (e.g. `add`) is needed, use `ScatterOpts.reduce`.
14
+ *
15
+ * Axis-label semantics: the output has exactly the same shape as `t`
16
+ * (scatter never changes the size of any axis), so all axis labels from `t`
17
+ * are preserved unchanged.
18
+ */
19
+ import { Tensor } from '../Tensor.js';
20
+ /** Configures how `scatter` combines updates with the existing values. */
21
+ export interface ScatterOpts {
22
+ /**
23
+ * How to combine `updates` with existing values at the target positions.
24
+ * - `'overwrite'` (default) — last-wins; target is replaced.
25
+ * - `'add'` — target is incremented by the update value.
26
+ */
27
+ reduce?: 'overwrite' | 'add';
28
+ }
29
+ /**
30
+ * Scatter `updates` into a copy of `t` at `indices` along `axis`.
31
+ *
32
+ * @param t - Destination tensor (not mutated). Any rank.
33
+ * @param axis - The axis along which to scatter. Supports negative indexing.
34
+ * @param indices - Target positions along `axis`. Must all be in
35
+ * `[0, t.shape[axis])`. Duplicates are allowed (last-wins
36
+ * by default, or add-accumulate when `opts.reduce === 'add'`).
37
+ * @param updates - Source tensor. Must have the same rank as `t` with
38
+ * `updates.shape[axis] === indices.length` and all other
39
+ * dimensions equal to `t.shape`.
40
+ * @param opts - Optional scatter options.
41
+ * @returns A new `Tensor` with the same shape as `t`, with axis labels
42
+ * preserved from `t`.
43
+ *
44
+ * @throws {Error} If `axis` is out of range, `updates` rank mismatches,
45
+ * or `updates` shape is incompatible.
46
+ * @throws {RangeError} If any index in `indices` is outside `[0, shape[axis])`.
47
+ *
48
+ * @example
49
+ * // Round-trip with gather: scatter zeros back to a masked copy
50
+ * const zeros = new Tensor([3, 4], new Float64Array(12));
51
+ * const result = scatter(zeros, 0, [0, 2], gather(t, 0, [0, 2]));
52
+ * // result[0, :] === t[0, :], result[1, :] === 0, result[2, :] === t[2, :]
53
+ */
54
+ export declare function scatter(t: Tensor, axis: number, indices: readonly number[], updates: Tensor, opts?: ScatterOpts): Tensor;
55
+ //# sourceMappingURL=scatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scatter.d.ts","sourceRoot":"","sources":["../../src/operations/scatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,OAAO,CACrB,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,GACjB,MAAM,CAsFR"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * slice — extract a sub-tensor by per-axis [start, stop, step] ranges.
3
+ *
4
+ * Mirrors NumPy / JAX basic slicing semantics:
5
+ * - Negative indices wrap around: -1 refers to the last element.
6
+ * - `null` range for an axis means "take the entire axis".
7
+ * - `step` must be >= 1 (reverse-step slicing is deferred).
8
+ * - Output shape for axis i: Math.ceil((stop - start) / step).
9
+ *
10
+ * Axis-label semantics: labels from the input axes are preserved in the
11
+ * output. A slice is still the same logical axis — just smaller — so the
12
+ * label name and tags are carried forward (dimension is updated to match the
13
+ * new axis size; the id is re-minted since the Index type is immutable and
14
+ * dimension is part of the index identity).
15
+ */
16
+ import { Tensor } from '../Tensor.js';
17
+ /** Defines the start, stop, and step of a slice along one axis. */
18
+ export interface SliceRange {
19
+ /** Default 0. Supports negative indexing: -1 means shape[axis]-1. */
20
+ start?: number;
21
+ /** Default = shape[axis]. Supports negative indexing. */
22
+ stop?: number;
23
+ /** Default 1. Must be >= 1 (no reverse step). */
24
+ step?: number;
25
+ }
26
+ /**
27
+ * Extract a sub-tensor by per-axis `SliceRange` triples.
28
+ *
29
+ * @param t - Input tensor of any rank.
30
+ * @param ranges - Array of length `t.shape.length`. Each element is either a
31
+ * `SliceRange` or `null` (which means "take the entire axis").
32
+ * Must have the same length as `t.shape`.
33
+ * @returns A new `Tensor` whose shape[i] = ceil((stop_i - start_i) / step_i),
34
+ * carrying preserved axis labels (same name/tags, updated dim).
35
+ *
36
+ * @throws {RangeError} If `step` is not a positive integer.
37
+ * @throws {Error} If `ranges.length !== t.shape.length`.
38
+ *
39
+ * @example
40
+ * // Extract rows 1–3 (exclusive), all columns from a 5×4 tensor:
41
+ * const sub = slice(t, [{ start: 1, stop: 3 }, null]);
42
+ */
43
+ export declare function slice(t: Tensor, ranges: (SliceRange | null)[]): Tensor;
44
+ //# sourceMappingURL=slice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../../src/operations/slice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,CA0EtE"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * tensorSolve — named-index linear solver for rank-N tensors.
3
+ *
4
+ * Reshapes tensor A into a square matrix and tensor b into a column vector (or
5
+ * multi-column RHS matrix), solves A·x = b via LU decomposition with partial
6
+ * pivoting, and reshapes the solution back.
7
+ *
8
+ * Axis matching:
9
+ * - When A has `axisLabels` and `b` has `axisLabels`, the "row" axes of A
10
+ * are matched to axes of `b` by Index identity (ignoring prime level).
11
+ * - Otherwise `rowAxesA` / `rowAxesB` (integer indices) must be provided,
12
+ * or the first axes of each tensor are used by default.
13
+ *
14
+ * Constraints:
15
+ * - The reshaped A must be square (numRows_A × numRows_A).
16
+ * - A must be non-singular (LU decomposition throws if pivot is zero).
17
+ * - For multi-RHS, the RHS col dimension must match A's row dimension.
18
+ *
19
+ * Result shape:
20
+ * - `x` has shape [...colDimsA, ...colDimsB] where colDimsA are the axes
21
+ * of A not used as row axes and colDimsB are the axes of b not used as
22
+ * row (contracting) axes.
23
+ * - When A is square as a whole tensor (rank 2), the result has the same
24
+ * shape as b.
25
+ *
26
+ * Axis labels: propagated from A's col axes and b's col axes.
27
+ */
28
+ import { Tensor } from '../Tensor.js';
29
+ import { Index } from '../named-index.js';
30
+ /** Configures the row (contracting) axes of A and b for `tensorSolve`. */
31
+ export interface TensorSolveOpts {
32
+ /**
33
+ * Axis indices (integers) or Index objects of A that form the "contracting"
34
+ * (row) side of the square matrix. Default: first `ceil(rank/2)` axes.
35
+ */
36
+ rowAxesA?: ReadonlyArray<number | Index>;
37
+ /**
38
+ * Axis indices (integers) or Index objects of b that form the "contracting"
39
+ * (row) side matched to A's row dimension. Default: first axis of b.
40
+ */
41
+ rowAxesB?: ReadonlyArray<number | Index>;
42
+ }
43
+ /** Contains the solution tensor x from `tensorSolve`. */
44
+ export interface TensorSolveResult {
45
+ /** Solution tensor x satisfying A·x ≈ b. */
46
+ x: Tensor;
47
+ }
48
+ /**
49
+ * Solve A·x = b for x using LU decomposition.
50
+ *
51
+ * @param A - Coefficient tensor (rank ≥ 2 when reshaped to square).
52
+ * @param b - Right-hand side tensor.
53
+ * @param opts - Optional axis-selection overrides.
54
+ */
55
+ export declare function tensorSolve(A: Tensor, b: Tensor, opts?: TensorSolveOpts): TensorSolveResult;
56
+ //# sourceMappingURL=solve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solve.d.ts","sourceRoot":"","sources":["../../src/operations/solve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;CAC1C;AAED,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;CACX;AAoED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,iBAAiB,CA8J3F"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * stack — stack same-shape tensors along a new axis (NumPy `stack`).
3
+ *
4
+ * All input tensors must have identical shapes. A new axis is inserted at
5
+ * position `axis` in the output, making the output rank = input rank + 1.
6
+ * `stack([a, b], 0)` is equivalent to NumPy's `np.stack([a, b], axis=0)`.
7
+ *
8
+ * Axis-label semantics:
9
+ * - The new axis gets `undefined` label by default (it has no correspondence
10
+ * to any input axis).
11
+ * - Pass `opts.newAxisLabel` (an `Index`) to label the new axis explicitly.
12
+ * - The remaining axes inherit labels from `tensors[0]`. If labels disagree
13
+ * across inputs for a given axis, `tensors[0]`'s label is used silently
14
+ * (no error, no warning — document this choice here).
15
+ * - If `tensors[0]` has no `axisLabels`, the output also carries none.
16
+ */
17
+ import { Tensor } from '../Tensor.js';
18
+ import { Index } from '../named-index.js';
19
+ /** Configures the label of the new axis that `stack` inserts. */
20
+ export interface StackOpts {
21
+ /**
22
+ * Optional label for the newly created axis. If omitted, the new axis
23
+ * carries no label (`axisLabels[axis] === undefined` in the output, or more
24
+ * precisely: the output `axisLabels` array contains `undefined` at that
25
+ * position — encoded as `null` in the array but TypeScript sees it as the
26
+ * slot being absent when axisLabels is stripped to only defined entries).
27
+ *
28
+ * In practice: if `tensors[0].axisLabels` is defined, an `Index` for the
29
+ * new axis is created either from this option or as a placeholder.
30
+ */
31
+ newAxisLabel?: Index;
32
+ }
33
+ /**
34
+ * Stack same-shape tensors along a new axis.
35
+ *
36
+ * @param tensors - Array of tensors, all with the same shape. Must be non-empty.
37
+ * @param axis - Position of the new axis in the output. Supports negative
38
+ * indexing relative to the output rank. E.g. `axis=0` inserts
39
+ * a new leading axis; `axis=-1` appends a new trailing axis.
40
+ * @param opts - Optional `newAxisLabel` for the inserted axis.
41
+ * @returns A tensor of rank `inputRank + 1` with `shape[axis] === tensors.length`.
42
+ *
43
+ * @throws {Error} If `tensors` is empty, or if any tensor's shape differs from
44
+ * `tensors[0]`.
45
+ *
46
+ * @example
47
+ * // Stack two row-vectors [a, b, c] and [d, e, f] → 2×3 matrix:
48
+ * const matrix = stack([v1, v2], 0);
49
+ */
50
+ export declare function stack(tensors: Tensor[], axis: number, opts?: StackOpts): Tensor;
51
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/operations/stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAuF/E"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * tensorSvd — truncated SVD for rank-N tensors.
3
+ *
4
+ * Partitions the axes of `t` into "row" axes (joining with U) and "col" axes
5
+ * (the remaining axes, joining with V), permutes + reshapes `t` into a 2-D
6
+ * matrix, calls the existing DenseMatrix SVD primitive, optionally truncates
7
+ * the singular-value spectrum, and reshapes U / S / V back into Tensors.
8
+ *
9
+ * Phase-2 note: `rowAxes` is positional-integer-only. The named-Index overload
10
+ * (accepting `ReadonlyArray<Index>`) is reserved for the Phase-1-enabled
11
+ * follow-up once `Index` is part of the Tensor surface.
12
+ *
13
+ * The `joiningIndexName` option is accepted for forward-compatibility with the
14
+ * labelled-tensor extension but is unused in Phase 2 — the output Tensors carry
15
+ * no `axisLabels`.
16
+ */
17
+ import { Tensor } from '../Tensor.js';
18
+ /** Configures the truncation (maximum dimension and cutoff) for `tensorSvd`. */
19
+ export interface TensorSvdOpts {
20
+ /** If set, keep at most `maxdim` singular values. */
21
+ maxdim?: number;
22
+ /**
23
+ * If set, drop singular values whose absolute value is strictly less than
24
+ * `cutoff`. Default is 0 (no cutoff). The test is `s >= cutoff`.
25
+ */
26
+ cutoff?: number;
27
+ /**
28
+ * Accepted for forward-compatibility with the labelled-tensor extension
29
+ * (Phase-2-extension follow-up). Currently unused — output Tensors carry
30
+ * no `axisLabels` in Phase 2.
31
+ */
32
+ joiningIndexName?: string;
33
+ }
34
+ /** Contains the U, S, and V factors and the truncation data from `tensorSvd`. */
35
+ export interface TensorSvdResult {
36
+ /** U factor reshaped to [...rowDims, k]. */
37
+ U: Tensor;
38
+ /** Singular values as a rank-1 Tensor of shape [k]. */
39
+ S: Tensor;
40
+ /** V factor reshaped to [k, ...colDims]. */
41
+ V: Tensor;
42
+ /** Number of singular values retained after truncation. */
43
+ truncatedDim: number;
44
+ /** Sum of squares of the dropped singular values (Frobenius-norm squared of the discarded part). */
45
+ truncationError: number;
46
+ }
47
+ /**
48
+ * Truncated tensor SVD using the pure-JS DenseMatrix SVD primitive (synchronous).
49
+ *
50
+ * Compute the (optionally truncated) SVD of tensor `t` by partitioning its
51
+ * axes into "row" and "col" groups.
52
+ *
53
+ * @param t - Input tensor of rank ≥ 2 (U and V each need at least one axis).
54
+ * @param rowAxes - Axis indices (integers) whose dimensions form the row
55
+ * dimension of the effective 2-D matrix. The remaining axes
56
+ * form the column dimension. The order of `rowAxes` controls
57
+ * the layout of the U output tensor.
58
+ * @param opts - Optional truncation / naming settings.
59
+ */
60
+ export declare function tensorSvd(t: Tensor, rowAxes: ReadonlyArray<number>, opts?: TensorSvdOpts): TensorSvdResult;
61
+ /**
62
+ * Truncated tensor SVD routed through the AssemblyScript WASM SVD kernel
63
+ * (`svdWasm`) — the same result as {@link tensorSvd} but accelerated for large
64
+ * matricisations. Async because WASM instantiation is async; falls back to JS
65
+ * inside `svdWasm` when no binary is available.
66
+ */
67
+ export declare function tensorSvdWasm(t: Tensor, rowAxes: ReadonlyArray<number>, opts?: TensorSvdOpts): Promise<TensorSvdResult>;
68
+ //# sourceMappingURL=svd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svd.d.ts","sourceRoot":"","sources":["../../src/operations/svd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,uDAAuD;IACvD,CAAC,EAAE,MAAM,CAAC;IACV,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,oGAAoG;IACpG,eAAe,EAAE,MAAM,CAAC;CACzB;AAwHD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,IAAI,CAAC,EAAE,aAAa,GACnB,eAAe,CAGjB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,eAAe,CAAC,CAG1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-tensor",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "Rank-N dense Tensor type for MathTS with Float64Array-backed storage",
5
5
  "author": "Daniel Simon Jr.",
6
6
  "license": "MIT",
@@ -19,26 +19,26 @@
19
19
  "README.md"
20
20
  ],
21
21
  "scripts": {
22
- "build": "tsup src/index.ts --format esm --dts --clean",
22
+ "build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.dts.json",
23
23
  "dev": "tsup src/index.ts --format esm --dts --watch",
24
- "test": "vitest run",
24
+ "test": "bun test --isolate --timeout 30000",
25
25
  "test:watch": "vitest",
26
- "test:coverage": "vitest run --coverage",
26
+ "test:coverage": "bun test --isolate --timeout 30000 --coverage",
27
27
  "typecheck": "tsc --noEmit",
28
- "lint": "eslint src --ext .ts",
29
- "lint:fix": "eslint src --ext .ts --fix",
28
+ "lint": "oxlint src",
29
+ "lint:fix": "oxlint src --fix",
30
30
  "clean": "rm -rf dist",
31
31
  "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
32
32
  },
33
33
  "dependencies": {
34
- "@danielsimonjr/mathts-core": "^0.14.0",
35
- "@danielsimonjr/mathts-matrix": "^0.7.1"
34
+ "@danielsimonjr/mathts-core": "^0.15.4",
35
+ "@danielsimonjr/mathts-matrix": "^0.7.4"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^25.5.2",
38
+ "@types/node": "^26.4.0",
39
39
  "tsup": "^8.0.0",
40
- "typescript": "^5.3.0",
41
- "vitest": "^4.1.5"
40
+ "typescript": "^7.0.2",
41
+ "vitest": "^5.0.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"