@danielsimonjr/mathts-matrix 0.7.1 → 0.7.3
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/dist/backends/Backend.d.ts +146 -0
- package/dist/backends/Backend.d.ts.map +1 -0
- package/dist/backends/BackendManager.d.ts +189 -0
- package/dist/backends/BackendManager.d.ts.map +1 -0
- package/dist/backends/GPUBackend.d.ts +128 -0
- package/dist/backends/GPUBackend.d.ts.map +1 -0
- package/dist/backends/GPUMatrixBackend.d.ts +123 -0
- package/dist/backends/GPUMatrixBackend.d.ts.map +1 -0
- package/dist/backends/JSBackend.d.ts +93 -0
- package/dist/backends/JSBackend.d.ts.map +1 -0
- package/dist/backends/ParallelBackend.d.ts +131 -0
- package/dist/backends/ParallelBackend.d.ts.map +1 -0
- package/dist/backends/WASMBackend.d.ts +156 -0
- package/dist/backends/WASMBackend.d.ts.map +1 -0
- package/dist/backends/WasmLoader.d.ts +326 -0
- package/dist/backends/WasmLoader.d.ts.map +1 -0
- package/dist/backends/gpu/BatchExecutor.d.ts +190 -0
- package/dist/backends/gpu/BatchExecutor.d.ts.map +1 -0
- package/dist/backends/gpu/Sync.d.ts +167 -0
- package/dist/backends/gpu/Sync.d.ts.map +1 -0
- package/dist/backends/gpu/builtin-shaders.d.ts +178 -0
- package/dist/backends/gpu/builtin-shaders.d.ts.map +1 -0
- package/dist/backends/gpu/index.d.ts +13 -0
- package/dist/backends/gpu/index.d.ts.map +1 -0
- package/dist/backends/index.d.ts +18 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/register-backends.d.ts +18 -0
- package/dist/backends/register-backends.d.ts.map +1 -0
- package/dist/backends/wasm/detect.d.ts +58 -0
- package/dist/backends/wasm/detect.d.ts.map +1 -0
- package/dist/backends/wasm/fft-wasm.d.ts +120 -0
- package/dist/backends/wasm/fft-wasm.d.ts.map +1 -0
- package/dist/backends/wasm/index.d.ts +9 -0
- package/dist/backends/wasm/index.d.ts.map +1 -0
- package/dist/backends/wasm/integrity.d.ts +18 -0
- package/dist/backends/wasm/integrity.d.ts.map +1 -0
- package/dist/backends/wasm/resolve.d.ts +12 -0
- package/dist/backends/wasm/resolve.d.ts.map +1 -0
- package/dist/{chunk-4VMDO6W2.js → chunk-PNKVD2UK.js} +2 -7
- package/dist/config.d.ts +145 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +14 -3037
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -9
- package/dist/{integrity-LIWCCDIJ.js → integrity-IBNQNHXP.js} +1 -1
- package/dist/operations/cholesky.d.ts +24 -0
- package/dist/operations/cholesky.d.ts.map +1 -0
- package/dist/operations/common.d.ts +61 -0
- package/dist/operations/common.d.ts.map +1 -0
- package/dist/operations/condest.d.ts +27 -0
- package/dist/operations/condest.d.ts.map +1 -0
- package/dist/operations/eig-wasm.d.ts +35 -0
- package/dist/operations/eig-wasm.d.ts.map +1 -0
- package/dist/operations/eig.d.ts +75 -0
- package/dist/operations/eig.d.ts.map +1 -0
- package/dist/operations/expm.d.ts +46 -0
- package/dist/operations/expm.d.ts.map +1 -0
- package/dist/operations/index.d.ts +21 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/logm.d.ts +59 -0
- package/dist/operations/logm.d.ts.map +1 -0
- package/dist/operations/lu.d.ts +51 -0
- package/dist/operations/lu.d.ts.map +1 -0
- package/dist/operations/pinv.d.ts +36 -0
- package/dist/operations/pinv.d.ts.map +1 -0
- package/dist/operations/qr-family.d.ts +52 -0
- package/dist/operations/qr-family.d.ts.map +1 -0
- package/dist/operations/qr-pivoted.d.ts +39 -0
- package/dist/operations/qr-pivoted.d.ts.map +1 -0
- package/dist/operations/qr.d.ts +35 -0
- package/dist/operations/qr.d.ts.map +1 -0
- package/dist/operations/schur.d.ts +58 -0
- package/dist/operations/schur.d.ts.map +1 -0
- package/dist/operations/sqrtm.d.ts +76 -0
- package/dist/operations/sqrtm.d.ts.map +1 -0
- package/dist/operations/svd-wasm.d.ts +23 -0
- package/dist/operations/svd-wasm.d.ts.map +1 -0
- package/dist/operations/svd.d.ts +70 -0
- package/dist/operations/svd.d.ts.map +1 -0
- package/dist/parallel-matrix.d.ts +223 -0
- package/dist/parallel-matrix.d.ts.map +1 -0
- package/dist/{resolve-DDCEWHWX.js → resolve-2SX6WJ6R.js} +1 -1
- package/dist/typed-operations.d.ts +162 -0
- package/dist/typed-operations.d.ts.map +1 -0
- package/dist/types/DenseMatrix.d.ts +213 -0
- package/dist/types/DenseMatrix.d.ts.map +1 -0
- package/dist/types/Matrix.d.ts +188 -0
- package/dist/types/Matrix.d.ts.map +1 -0
- package/dist/types/SparseMatrix.d.ts +214 -0
- package/dist/types/SparseMatrix.d.ts.map +1 -0
- package/dist/types/dense/arithmetic.d.ts +8 -0
- package/dist/types/dense/arithmetic.d.ts.map +1 -0
- package/dist/types/dense/reduction.d.ts +8 -0
- package/dist/types/dense/reduction.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/wasm/mathts-as.wasm +0 -0
- package/dist/wasm/wasm-manifest.json +1 -1
- package/package.json +70 -70
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparse Matrix Implementation (CSR Format)
|
|
3
|
+
*
|
|
4
|
+
* Compressed Sparse Row (CSR) format sparse matrix for efficient storage
|
|
5
|
+
* and operations on matrices with many zero elements.
|
|
6
|
+
*
|
|
7
|
+
* CSR stores:
|
|
8
|
+
* - values: Non-zero values in row-major order
|
|
9
|
+
* - colIndices: Column index for each non-zero value
|
|
10
|
+
* - rowPointers: Index into values/colIndices where each row starts
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import { Matrix, MatrixEntry, SliceSpec } from './Matrix.js';
|
|
15
|
+
import { DenseMatrix } from './DenseMatrix.js';
|
|
16
|
+
/**
|
|
17
|
+
* Sparse matrix using Compressed Sparse Row (CSR) format
|
|
18
|
+
*
|
|
19
|
+
* Efficient for:
|
|
20
|
+
* - Row slicing and iteration
|
|
21
|
+
* - Sparse matrix-vector multiplication
|
|
22
|
+
* - Matrices with many zeros (typically < 10% non-zero)
|
|
23
|
+
*/
|
|
24
|
+
export declare class SparseMatrix extends Matrix<number> {
|
|
25
|
+
readonly type: 'SparseMatrix';
|
|
26
|
+
readonly rows: number;
|
|
27
|
+
readonly cols: number;
|
|
28
|
+
/**
|
|
29
|
+
* Non-zero values in row-major order
|
|
30
|
+
*/
|
|
31
|
+
private readonly _data;
|
|
32
|
+
/**
|
|
33
|
+
* Column indices for each non-zero value
|
|
34
|
+
*/
|
|
35
|
+
private readonly _colIndices;
|
|
36
|
+
/**
|
|
37
|
+
* Row pointers: rowPointers[i] = index of first non-zero in row i
|
|
38
|
+
* rowPointers[rows] = total number of non-zeros (nnz)
|
|
39
|
+
*/
|
|
40
|
+
private readonly _rowPointers;
|
|
41
|
+
/**
|
|
42
|
+
* Create a sparse matrix from CSR components
|
|
43
|
+
*
|
|
44
|
+
* @param rows - Number of rows
|
|
45
|
+
* @param cols - Number of columns
|
|
46
|
+
* @param values - Non-zero values
|
|
47
|
+
* @param colIndices - Column index for each value
|
|
48
|
+
* @param rowPointers - Row start indices
|
|
49
|
+
*/
|
|
50
|
+
constructor(rows: number, cols: number, values: Float64Array | number[], colIndices: Int32Array | number[], rowPointers: Int32Array | number[]);
|
|
51
|
+
/**
|
|
52
|
+
* Create a sparse matrix from a dense matrix
|
|
53
|
+
*
|
|
54
|
+
* @param dense - Dense matrix to convert
|
|
55
|
+
* @param dropTolerance - Values below this threshold are treated as zero
|
|
56
|
+
*/
|
|
57
|
+
static fromDense(dense: DenseMatrix, dropTolerance?: number): SparseMatrix;
|
|
58
|
+
/**
|
|
59
|
+
* Create a sparse matrix from coordinate (COO) format
|
|
60
|
+
*
|
|
61
|
+
* @param rows - Number of rows
|
|
62
|
+
* @param cols - Number of columns
|
|
63
|
+
* @param entries - Array of {row, col, value} entries
|
|
64
|
+
*/
|
|
65
|
+
static fromCOO(rows: number, cols: number, entries: Array<{
|
|
66
|
+
row: number;
|
|
67
|
+
col: number;
|
|
68
|
+
value: number;
|
|
69
|
+
}>): SparseMatrix;
|
|
70
|
+
/**
|
|
71
|
+
* Create a zero sparse matrix
|
|
72
|
+
*/
|
|
73
|
+
static zeros(rows: number, cols: number): SparseMatrix;
|
|
74
|
+
/**
|
|
75
|
+
* Create a sparse identity matrix
|
|
76
|
+
*/
|
|
77
|
+
static identity(n: number): SparseMatrix;
|
|
78
|
+
/**
|
|
79
|
+
* Create a sparse diagonal matrix
|
|
80
|
+
*/
|
|
81
|
+
static diag(values: number[]): SparseMatrix;
|
|
82
|
+
/**
|
|
83
|
+
* Number of non-zero elements
|
|
84
|
+
*/
|
|
85
|
+
get nnz(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Sparsity: fraction of zero elements
|
|
88
|
+
*/
|
|
89
|
+
get sparsity(): number;
|
|
90
|
+
/**
|
|
91
|
+
* Density: fraction of non-zero elements
|
|
92
|
+
*/
|
|
93
|
+
get density(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Get element at (row, col) - O(log(nnz_in_row)) for sorted columns
|
|
96
|
+
*/
|
|
97
|
+
get(row: number, col: number): number;
|
|
98
|
+
/**
|
|
99
|
+
* Set element at (row, col) - returns new matrix (immutable)
|
|
100
|
+
*/
|
|
101
|
+
set(row: number, col: number, value: number): SparseMatrix;
|
|
102
|
+
/**
|
|
103
|
+
* Get a row as a sparse 1×n matrix
|
|
104
|
+
*/
|
|
105
|
+
row(index: number): SparseMatrix;
|
|
106
|
+
/**
|
|
107
|
+
* Get a column as a sparse m×1 matrix
|
|
108
|
+
*/
|
|
109
|
+
column(index: number): SparseMatrix;
|
|
110
|
+
/**
|
|
111
|
+
* Get a submatrix
|
|
112
|
+
*/
|
|
113
|
+
slice(spec: SliceSpec): SparseMatrix;
|
|
114
|
+
/**
|
|
115
|
+
* Get the diagonal elements
|
|
116
|
+
*/
|
|
117
|
+
diagonal(k?: number): SparseMatrix;
|
|
118
|
+
/**
|
|
119
|
+
* Sparse matrix addition
|
|
120
|
+
*/
|
|
121
|
+
add(other: Matrix<number>): SparseMatrix;
|
|
122
|
+
private addSparse;
|
|
123
|
+
/**
|
|
124
|
+
* Sparse matrix subtraction
|
|
125
|
+
*/
|
|
126
|
+
subtract(other: Matrix<number>): SparseMatrix;
|
|
127
|
+
/**
|
|
128
|
+
* Element-wise multiplication (Hadamard product)
|
|
129
|
+
*/
|
|
130
|
+
multiplyElementwise(other: Matrix<number>): SparseMatrix;
|
|
131
|
+
/**
|
|
132
|
+
* Sparse matrix multiplication
|
|
133
|
+
*/
|
|
134
|
+
multiply(other: Matrix<number>): SparseMatrix;
|
|
135
|
+
private multiplySparse;
|
|
136
|
+
/**
|
|
137
|
+
* Scalar multiplication
|
|
138
|
+
*/
|
|
139
|
+
scale(scalar: number): SparseMatrix;
|
|
140
|
+
/**
|
|
141
|
+
* Sparse matrix transpose
|
|
142
|
+
*/
|
|
143
|
+
transpose(): SparseMatrix;
|
|
144
|
+
/**
|
|
145
|
+
* Negate all elements
|
|
146
|
+
*/
|
|
147
|
+
negate(): SparseMatrix;
|
|
148
|
+
/**
|
|
149
|
+
* Sum of all elements
|
|
150
|
+
*/
|
|
151
|
+
sum(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Frobenius norm
|
|
154
|
+
*/
|
|
155
|
+
norm(): number;
|
|
156
|
+
/**
|
|
157
|
+
* Trace (sum of diagonal elements)
|
|
158
|
+
*/
|
|
159
|
+
trace(): number;
|
|
160
|
+
/**
|
|
161
|
+
* Convert to dense matrix
|
|
162
|
+
*/
|
|
163
|
+
toDense(): DenseMatrix;
|
|
164
|
+
/**
|
|
165
|
+
* Convert to nested array
|
|
166
|
+
*/
|
|
167
|
+
toArray(): number[][];
|
|
168
|
+
/**
|
|
169
|
+
* Convert to flat array (row-major)
|
|
170
|
+
*/
|
|
171
|
+
toFlatArray(): number[];
|
|
172
|
+
/**
|
|
173
|
+
* Clone the matrix
|
|
174
|
+
*/
|
|
175
|
+
clone(): SparseMatrix;
|
|
176
|
+
/**
|
|
177
|
+
* Get the CSR components
|
|
178
|
+
*/
|
|
179
|
+
getCSR(): {
|
|
180
|
+
values: Float64Array;
|
|
181
|
+
colIndices: Int32Array;
|
|
182
|
+
rowPointers: Int32Array;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Iterate over non-zero entries
|
|
186
|
+
*/
|
|
187
|
+
entries(): IterableIterator<MatrixEntry<number>>;
|
|
188
|
+
/**
|
|
189
|
+
* Iterate over non-zero values
|
|
190
|
+
*/
|
|
191
|
+
values(): IterableIterator<number>;
|
|
192
|
+
/**
|
|
193
|
+
* Iterate over all values (including zeros, row-major)
|
|
194
|
+
*/
|
|
195
|
+
allValues(): IterableIterator<number>;
|
|
196
|
+
/**
|
|
197
|
+
* Support for...of iteration (iterates over non-zero values)
|
|
198
|
+
*/
|
|
199
|
+
[Symbol.iterator](): IterableIterator<number>;
|
|
200
|
+
/**
|
|
201
|
+
* Apply a function to each non-zero element
|
|
202
|
+
*/
|
|
203
|
+
mapNonZeros(fn: (value: number, row: number, col: number) => number): SparseMatrix;
|
|
204
|
+
/**
|
|
205
|
+
* Apply a function to each element (including zeros)
|
|
206
|
+
* Warning: This may create a dense result
|
|
207
|
+
*/
|
|
208
|
+
map(fn: (value: number, row: number, col: number) => number): SparseMatrix;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Type guard for SparseMatrix
|
|
212
|
+
*/
|
|
213
|
+
export declare function isSparseMatrix(value: unknown): value is SparseMatrix;
|
|
214
|
+
//# sourceMappingURL=SparseMatrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparseMatrix.d.ts","sourceRoot":"","sources":["../../src/types/SparseMatrix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,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;;OAEG;IACH,GAAG,IAAI,MAAM,CAMZ;IAED;;OAEG;IACH,IAAI,IAAI,MAAM,CAMb;IAED;;OAEG;IACH,KAAK,IAAI,MAAM,CAUd;IAMD;;OAEG;IACH,OAAO,IAAI,WAAW,CAarB;IAED;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE,EAAE,CAEpB;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE,CAEtB;IAED;;OAEG;IACH,KAAK,IAAI,YAAY,CAQpB;IAED;;OAEG;IACH,MAAM,IAAI;QACR,MAAM,EAAE,YAAY,CAAC;QACrB,UAAU,EAAE,UAAU,CAAC;QACvB,WAAW,EAAE,UAAU,CAAC;KACzB,CAMA;IAMD;;OAEG;IACF,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAahD;IAED;;OAEG;IACF,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAIlC;IAED;;OAEG;IACF,SAAS,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAMrC;IAED;;OAEG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAE5C;IAMD;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,YAAY,CAiBjF;IAED;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,YAAY,CAazE;CACF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Matrix } from '../Matrix.js';
|
|
2
|
+
export declare function add(a: Matrix<number>, b: Matrix<number>): Float64Array;
|
|
3
|
+
export declare function subtract(a: Matrix<number>, b: Matrix<number>): Float64Array;
|
|
4
|
+
export declare function multiplyElementwise(a: Matrix<number>, b: Matrix<number>): Float64Array;
|
|
5
|
+
export declare function multiply(a: Matrix<number>, b: Matrix<number>): Float64Array;
|
|
6
|
+
export declare function scale(a: Matrix<number>, scalar: number): Float64Array;
|
|
7
|
+
export declare function transpose(a: Matrix<number>): Float64Array;
|
|
8
|
+
//# sourceMappingURL=arithmetic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arithmetic.d.ts","sourceRoot":"","sources":["../../../src/types/dense/arithmetic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAmB3C,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,YAAY,CAMtE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,YAAY,CAM3E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,YAAY,CAMtF;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,YAAY,CAoB3E;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAKrE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,YAAY,CAUzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Matrix } from '../Matrix.js';
|
|
2
|
+
export declare function sum(a: Matrix<number>): number;
|
|
3
|
+
export declare function mean(a: Matrix<number>): number;
|
|
4
|
+
export declare function min(a: Matrix<number>): number;
|
|
5
|
+
export declare function max(a: Matrix<number>): number;
|
|
6
|
+
export declare function norm(a: Matrix<number>): number;
|
|
7
|
+
export declare function trace(a: Matrix<number>): number;
|
|
8
|
+
//# sourceMappingURL=reduction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduction.d.ts","sourceRoot":"","sources":["../../../src/types/dense/reduction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAQ7C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAE9C;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAS7C;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAS7C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAS9C;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAS/C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matrix Type Exports
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export { Matrix, isMatrix } from './Matrix.js';
|
|
6
|
+
export type { MatrixDimensions, MatrixIndex, SliceSpec, MatrixEntry, MatrixType, } from './Matrix.js';
|
|
7
|
+
export { DenseMatrix, isDenseMatrix } from './DenseMatrix.js';
|
|
8
|
+
export { SparseMatrix, isSparseMatrix } from './SparseMatrix.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/wasm/mathts-as.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@danielsimonjr/mathts-matrix",
|
|
3
|
-
"version": "0.7.
|
|
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 --
|
|
23
|
-
"copy:wasm": "node scripts/copy-wasm.mjs",
|
|
24
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
25
|
-
"test": "
|
|
26
|
-
"test:watch": "vitest",
|
|
27
|
-
"test:coverage": "
|
|
28
|
-
"typecheck": "tsc --noEmit",
|
|
29
|
-
"lint": "
|
|
30
|
-
"lint:fix": "
|
|
31
|
-
"clean": "rm -rf dist",
|
|
32
|
-
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake && node scripts/copy-wasm.mjs"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@danielsimonjr/mathts-core": "^0.
|
|
36
|
-
"@danielsimonjr/mathts-gpu": "^0.2.0",
|
|
37
|
-
"@danielsimonjr/mathts-parallel": "^0.6.
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@types/node": "^
|
|
41
|
-
"tsup": "^8.0.0",
|
|
42
|
-
"typescript": "^
|
|
43
|
-
"vitest": "^
|
|
44
|
-
"@webgpu/types": "^0.1.
|
|
45
|
-
},
|
|
46
|
-
"publishConfig": {
|
|
47
|
-
"access": "public"
|
|
48
|
-
},
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "git+https://github.com/danielsimonjr/MathTS.git",
|
|
52
|
-
"directory": "matrix"
|
|
53
|
-
},
|
|
54
|
-
"keywords": [
|
|
55
|
-
"math",
|
|
56
|
-
"matrix",
|
|
57
|
-
"linear-algebra",
|
|
58
|
-
"typescript",
|
|
59
|
-
"wasm",
|
|
60
|
-
"webgpu"
|
|
61
|
-
],
|
|
62
|
-
"peerDependencies": {
|
|
63
|
-
"@webgpu/types": "^0.1.
|
|
64
|
-
},
|
|
65
|
-
"peerDependenciesMeta": {
|
|
66
|
-
"@webgpu/types": {
|
|
67
|
-
"optional": true
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@danielsimonjr/mathts-matrix",
|
|
3
|
+
"version": "0.7.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 --clean && tsc -p tsconfig.dts.json && node scripts/copy-wasm.mjs",
|
|
23
|
+
"copy:wasm": "node scripts/copy-wasm.mjs",
|
|
24
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
25
|
+
"test": "bun test --isolate --timeout 30000",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"test:coverage": "bun test --isolate --timeout 30000 --coverage",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"lint": "oxlint src",
|
|
30
|
+
"lint:fix": "oxlint src --fix",
|
|
31
|
+
"clean": "rm -rf dist",
|
|
32
|
+
"build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake && node scripts/copy-wasm.mjs"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@danielsimonjr/mathts-core": "^0.15.0",
|
|
36
|
+
"@danielsimonjr/mathts-gpu": "^0.2.0",
|
|
37
|
+
"@danielsimonjr/mathts-parallel": "^0.6.5"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^26.4.0",
|
|
41
|
+
"tsup": "^8.0.0",
|
|
42
|
+
"typescript": "^7.0.2",
|
|
43
|
+
"vitest": "^5.0.0",
|
|
44
|
+
"@webgpu/types": "^0.1.72"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/danielsimonjr/MathTS.git",
|
|
52
|
+
"directory": "matrix"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"math",
|
|
56
|
+
"matrix",
|
|
57
|
+
"linear-algebra",
|
|
58
|
+
"typescript",
|
|
59
|
+
"wasm",
|
|
60
|
+
"webgpu"
|
|
61
|
+
],
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@webgpu/types": "^0.1.72"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"@webgpu/types": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|