@pawells/math-extended 1.0.5 → 2.0.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.
Files changed (106) hide show
  1. package/README.md +5 -5
  2. package/build/angles.d.ts +43 -3
  3. package/build/angles.d.ts.map +1 -1
  4. package/build/angles.js +61 -34
  5. package/build/angles.js.map +1 -1
  6. package/build/clamp.d.ts +5 -3
  7. package/build/clamp.d.ts.map +1 -1
  8. package/build/clamp.js +5 -3
  9. package/build/clamp.js.map +1 -1
  10. package/build/interpolation.d.ts +444 -67
  11. package/build/interpolation.d.ts.map +1 -1
  12. package/build/interpolation.js +444 -67
  13. package/build/interpolation.js.map +1 -1
  14. package/build/matrices/_exports.d.ts +13 -0
  15. package/build/matrices/_exports.d.ts.map +1 -0
  16. package/build/matrices/_exports.js +13 -0
  17. package/build/matrices/_exports.js.map +1 -0
  18. package/build/matrices/arithmetic.d.ts +170 -181
  19. package/build/matrices/arithmetic.d.ts.map +1 -1
  20. package/build/matrices/arithmetic.js +192 -202
  21. package/build/matrices/arithmetic.js.map +1 -1
  22. package/build/matrices/asserts.d.ts +244 -116
  23. package/build/matrices/asserts.d.ts.map +1 -1
  24. package/build/matrices/asserts.js +291 -94
  25. package/build/matrices/asserts.js.map +1 -1
  26. package/build/matrices/core.d.ts +40 -41
  27. package/build/matrices/core.d.ts.map +1 -1
  28. package/build/matrices/core.js +12 -13
  29. package/build/matrices/core.js.map +1 -1
  30. package/build/matrices/decompositions.d.ts +121 -124
  31. package/build/matrices/decompositions.d.ts.map +1 -1
  32. package/build/matrices/decompositions.js +168 -226
  33. package/build/matrices/decompositions.js.map +1 -1
  34. package/build/matrices/index.d.ts +3 -2
  35. package/build/matrices/index.d.ts.map +1 -1
  36. package/build/matrices/index.js +5 -2
  37. package/build/matrices/index.js.map +1 -1
  38. package/build/matrices/linear-algebra.d.ts +18 -13
  39. package/build/matrices/linear-algebra.d.ts.map +1 -1
  40. package/build/matrices/linear-algebra.js +58 -23
  41. package/build/matrices/linear-algebra.js.map +1 -1
  42. package/build/matrices/normalization.d.ts +8 -8
  43. package/build/matrices/transformations.d.ts +184 -168
  44. package/build/matrices/transformations.d.ts.map +1 -1
  45. package/build/matrices/transformations.js +99 -83
  46. package/build/matrices/transformations.js.map +1 -1
  47. package/build/matrices/types.d.ts +12 -12
  48. package/build/matrices/types.d.ts.map +1 -1
  49. package/build/quaternions/_exports.d.ts +11 -0
  50. package/build/quaternions/_exports.d.ts.map +1 -0
  51. package/build/quaternions/_exports.js +11 -0
  52. package/build/quaternions/_exports.js.map +1 -0
  53. package/build/quaternions/asserts.d.ts +115 -7
  54. package/build/quaternions/asserts.d.ts.map +1 -1
  55. package/build/quaternions/asserts.js +162 -8
  56. package/build/quaternions/asserts.js.map +1 -1
  57. package/build/quaternions/conversions.d.ts +31 -21
  58. package/build/quaternions/conversions.d.ts.map +1 -1
  59. package/build/quaternions/conversions.js +28 -18
  60. package/build/quaternions/conversions.js.map +1 -1
  61. package/build/quaternions/core.d.ts +73 -41
  62. package/build/quaternions/core.d.ts.map +1 -1
  63. package/build/quaternions/core.js +84 -49
  64. package/build/quaternions/core.js.map +1 -1
  65. package/build/quaternions/index.d.ts +3 -2
  66. package/build/quaternions/index.d.ts.map +1 -1
  67. package/build/quaternions/index.js +5 -2
  68. package/build/quaternions/index.js.map +1 -1
  69. package/build/quaternions/interpolation.d.ts +15 -9
  70. package/build/quaternions/interpolation.d.ts.map +1 -1
  71. package/build/quaternions/interpolation.js +15 -9
  72. package/build/quaternions/interpolation.js.map +1 -1
  73. package/build/quaternions/predefined.d.ts +9 -3
  74. package/build/quaternions/predefined.d.ts.map +1 -1
  75. package/build/quaternions/predefined.js +9 -3
  76. package/build/quaternions/predefined.js.map +1 -1
  77. package/build/quaternions/types.d.ts +3 -3
  78. package/build/random.d.ts +5 -2
  79. package/build/random.d.ts.map +1 -1
  80. package/build/random.js +20 -17
  81. package/build/random.js.map +1 -1
  82. package/build/vectors/_exports.d.ts +10 -0
  83. package/build/vectors/_exports.d.ts.map +1 -0
  84. package/build/vectors/_exports.js +10 -0
  85. package/build/vectors/_exports.js.map +1 -0
  86. package/build/vectors/asserts.d.ts +153 -49
  87. package/build/vectors/asserts.d.ts.map +1 -1
  88. package/build/vectors/asserts.js +202 -52
  89. package/build/vectors/asserts.js.map +1 -1
  90. package/build/vectors/core.d.ts +216 -137
  91. package/build/vectors/core.d.ts.map +1 -1
  92. package/build/vectors/core.js +217 -158
  93. package/build/vectors/core.js.map +1 -1
  94. package/build/vectors/index.d.ts +1 -0
  95. package/build/vectors/index.d.ts.map +1 -1
  96. package/build/vectors/index.js +3 -0
  97. package/build/vectors/index.js.map +1 -1
  98. package/build/vectors/interpolation.d.ts +39 -27
  99. package/build/vectors/interpolation.d.ts.map +1 -1
  100. package/build/vectors/interpolation.js +39 -27
  101. package/build/vectors/interpolation.js.map +1 -1
  102. package/build/vectors/predefined.d.ts +48 -24
  103. package/build/vectors/predefined.d.ts.map +1 -1
  104. package/build/vectors/predefined.js +38 -18
  105. package/build/vectors/predefined.js.map +1 -1
  106. package/package.json +12 -15
@@ -1,4 +1,4 @@
1
- import { IMatrix } from './types.js';
1
+ import { TMatrix } from './types.js';
2
2
  /**
3
3
  * Result of eigenvalue decomposition containing eigenvalues and their corresponding eigenvectors.
4
4
  *
@@ -10,20 +10,23 @@ type TEigenDecompositionResult = {
10
10
  /** Array of eigenvalues λ in descending order */
11
11
  eigenvalues: number[];
12
12
  /** Matrix where each column is an eigenvector corresponding to the eigenvalue at the same index */
13
- eigenvectors: IMatrix;
13
+ eigenvectors: TMatrix;
14
14
  };
15
15
  /**
16
- * Result of LU decomposition where A = L × U.
16
+ * Result of LU decomposition with partial pivoting where P × A = L × U.
17
17
  *
18
18
  * LU decomposition factors a square matrix into the product of a lower triangular matrix L
19
- * and an upper triangular matrix U. This is useful for solving systems of linear equations,
19
+ * and an upper triangular matrix U, with a permutation vector P recording the row swaps
20
+ * performed during partial pivoting. This is useful for solving systems of linear equations,
20
21
  * computing determinants, and matrix inversion.
21
22
  */
22
23
  type TLUDecompositionResult = {
23
24
  /** Lower triangular matrix with 1's on the diagonal */
24
- readonly L: IMatrix;
25
+ readonly L: TMatrix;
25
26
  /** Upper triangular matrix containing the pivots */
26
- readonly U: IMatrix;
27
+ readonly U: TMatrix;
28
+ /** Permutation vector: P[i] is the original row index that now occupies row i */
29
+ readonly P: number[];
27
30
  };
28
31
  /**
29
32
  * Result of QR decomposition where A = Q × R.
@@ -34,9 +37,9 @@ type TLUDecompositionResult = {
34
37
  */
35
38
  type TQRDecompositionResult = {
36
39
  /** Orthogonal matrix where Q^T × Q = I */
37
- readonly Q: IMatrix;
40
+ readonly Q: TMatrix;
38
41
  /** Upper triangular matrix */
39
- readonly R: IMatrix;
42
+ readonly R: TMatrix;
40
43
  };
41
44
  /**
42
45
  * Result of Singular Value Decomposition (SVD) where A = U × Σ × V^T.
@@ -48,11 +51,11 @@ type TQRDecompositionResult = {
48
51
  */
49
52
  type TSVDDecompositionResult = {
50
53
  /** Matrix of left singular vectors (orthogonal columns) */
51
- readonly U: IMatrix;
54
+ readonly U: TMatrix;
52
55
  /** Array of singular values σ in descending order (diagonal elements of Σ matrix) */
53
56
  readonly S: number[];
54
57
  /** Transpose of the matrix of right singular vectors (V^T where V has orthogonal columns) */
55
- readonly VT: IMatrix;
58
+ readonly VT: TMatrix;
56
59
  };
57
60
  /**
58
61
  * Performs Cholesky decomposition for symmetric positive definite matrices A = L × L^T.
@@ -74,22 +77,22 @@ type TSVDDecompositionResult = {
74
77
  * @throws {Error} If matrix is not square, not symmetric, or not positive definite
75
78
  *
76
79
  * @example
77
- * ```ts
78
- * // Symmetric positive definite matrix
79
- * const A = [[4, 2], [2, 3]];
80
- * const L = MatrixCholesky(A);
81
- * // L = [[2, 0], [1, √2]] ≈ [[2, 0], [1, 1.414]]
82
- *
83
- * // Verify: L × L^T should equal A
84
- * const LT = MatrixTranspose(L);
85
- * const reconstructed = MatrixMultiply(L, LT);
86
- * // reconstructed ≈ [[4, 2], [2, 3]]
87
- * ```
88
- *
89
- * @complexity Time: O(n³/3), Space: O(n²) - About 2x faster than general LU decomposition
90
- * @see {@link MatrixLU} For general square matrices that may not be positive definite
80
+ * ```typescript
81
+ * ```ts
82
+ * // Symmetric positive definite matrix
83
+ * const A = [[4, 2], [2, 3]];
84
+ * const L = MatrixCholesky(A);
85
+ * // L = [[2, 0], [1, √2]] ≈ [[2, 0], [1, 1.414]]
86
+ * // Verify: L × L^T should equal A
87
+ * const LT = MatrixTranspose(L);
88
+ * const reconstructed = MatrixMultiply(L, LT);
89
+ * // reconstructed ≈ [[4, 2], [2, 3]]
90
+ * ```
91
+ * @complexity Time: O(n³/3), Space: O(n²) - About 2x faster than general LU decomposition
92
+ * @see {@link MatrixLU} For general square matrices that may not be positive definite
93
+ * ```
91
94
  */
92
- export declare function MatrixCholesky(matrix: IMatrix): IMatrix;
95
+ export declare function MatrixCholesky(matrix: TMatrix): TMatrix;
93
96
  /**
94
97
  * Performs eigenvalue decomposition for square matrices to find A × v = λ × v.
95
98
  *
@@ -114,24 +117,24 @@ export declare function MatrixCholesky(matrix: IMatrix): IMatrix;
114
117
  * @throws {Error} If matrix is not square, contains invalid values, or has complex eigenvalues
115
118
  *
116
119
  * @example
117
- * ```ts
118
- * // Simple 2x2 matrix
119
- * const A = [[3, 1], [0, 2]];
120
- * const { eigenvalues, eigenvectors } = MatrixEigen(A);
121
- * // eigenvalues: [3, 2]
122
- * // eigenvectors: matrix where each column corresponds to an eigenvalue
123
- *
124
- * // Verify eigenvalue equation: A × v = λ × v
125
- * const v = Matrix_GetColumn(eigenvectors, 0); // First eigenvector
126
- * const Av = MatrixMultiplyVector(A, v);
127
- * const lambdaV = Matrix_ScaleVector(v, eigenvalues[0]);
128
- * // Av should approximately equal lambdaV
129
- * ```
130
- *
131
- * @complexity O(n³) time for an n×n matrix
132
- * @see {@link MatrixEigenQRIteration} For the iterative algorithm used for larger matrices
120
+ * ```typescript
121
+ * ```ts
122
+ * // Simple 2x2 matrix
123
+ * const A = [[3, 1], [0, 2]];
124
+ * const { eigenvalues, eigenvectors } = MatrixEigen(A);
125
+ * // eigenvalues: [3, 2]
126
+ * // eigenvectors: matrix where each column corresponds to an eigenvalue
127
+ * // Verify eigenvalue equation: A × v = λ × v
128
+ * const v = Matrix_GetColumn(eigenvectors, 0); // First eigenvector
129
+ * const Av = MatrixMultiplyVector(A, v);
130
+ * const lambdaV = Matrix_ScaleVector(v, eigenvalues[0]);
131
+ * // Av should approximately equal lambdaV
132
+ * ```
133
+ * @complexity O(n³) time for an n×n matrix
134
+ * @see {@link MatrixEigenQRIteration} For the iterative algorithm used for larger matrices
135
+ * ```
133
136
  */
134
- export declare function MatrixEigen(matrix: IMatrix): TEigenDecompositionResult;
137
+ export declare function MatrixEigen(matrix: TMatrix): TEigenDecompositionResult;
135
138
  /**
136
139
  * Simplified QR iteration algorithm for eigenvalue computation of larger matrices.
137
140
  *
@@ -155,51 +158,46 @@ export declare function MatrixEigen(matrix: IMatrix): TEigenDecompositionResult;
155
158
  * @complexity O(n³) per iteration, typically converges in O(n) iterations
156
159
  * @see {@link MatrixQR} For the QR decomposition used in each iteration
157
160
  */
158
- export declare function MatrixEigenQRIteration(matrix: IMatrix, iterations?: number): TEigenDecompositionResult;
161
+ export declare function MatrixEigenQRIteration(matrix: TMatrix, iterations?: number): TEigenDecompositionResult;
159
162
  /**
160
- * Performs LU decomposition of a square matrix A = L × U using Doolittle's method.
163
+ * Performs LU decomposition of a square matrix with partial pivoting: P × A = L × U.
161
164
  *
162
165
  * LU decomposition factors a square matrix into the product of a lower triangular matrix L
163
- * and an upper triangular matrix U. This decomposition is fundamental for solving linear
164
- * systems, computing determinants, and matrix inversion.
166
+ * and an upper triangular matrix U, with a permutation vector P recording the row swaps
167
+ * performed during partial (column) pivoting. Partial pivoting selects the largest-magnitude
168
+ * element in each column as the pivot, improving numerical stability.
165
169
  *
166
170
  * **Mathematical Background:**
167
171
  * - L is lower triangular with 1's on the diagonal (unit lower triangular)
168
172
  * - U is upper triangular containing the pivot elements
169
- * - The decomposition exists if all leading principal minors are non-zero
170
- * - Gaussian elimination with partial pivoting would be more stable, but this
171
- * implementation uses Doolittle's method without pivoting for simplicity
173
+ * - P is a permutation vector where P[i] is the original row index at position i
174
+ * - The relationship is: P × A = L × U
172
175
  *
173
176
  * **Applications:**
174
- * - Solving linear systems: Ax = b becomes LUx = b, solve Ly = b then Ux = y
175
- * - Computing determinant: det(A) = det(L) × det(U) = det(U) = ∏ᵢ U[i,i]
176
- * - Matrix inversion: A⁻¹ = U⁻¹L⁻¹
177
+ * - Solving linear systems: Ax = b apply permutation, solve Ly = Pb, then Ux = y
178
+ * - Computing determinant: det(A) = ∏ᵢ U[i,i] (with sign from permutation parity)
179
+ * - Matrix inversion: used internally by `MatrixInverse` for n > 3
177
180
  *
178
- * @param matrix - Square matrix to decompose (must be non-singular and not require pivoting)
179
- * @returns Object containing L (lower triangular) and U (upper triangular) matrices
180
- * @throws {Error} If matrix is not square, singular, or contains invalid values
181
- *
182
- * @note This implementation does not use partial pivoting (row swapping). It will fail for matrices with zero-valued or near-zero leading minors even if the matrix is otherwise invertible (e.g., [[0,1],[1,0]]). For general matrices, use MatrixInverse instead.
181
+ * @param matrix - Square matrix to decompose (must be non-singular)
182
+ * @returns Object `{ L, U, P }` — lower triangular, upper triangular, and permutation vector
183
+ * @throws {MatrixError} If matrix is not square, singular (zero pivot), or contains invalid values
183
184
  *
184
185
  * @example
185
- * ```ts
186
- * const A = [[2, 1], [1, 1]];
187
- * const { L, U } = MatrixLU(A);
188
- * // L = [[1, 0], [0.5, 1]], U = [[2, 1], [0, 0.5]]
189
- *
190
- * // Verify: L × U should equal A
191
- * const product = MatrixMultiply(L, U);
192
- * // product ≈ [[2, 1], [1, 1]]
193
- *
194
- * // Solve Ax = b using LU decomposition
195
- * const b = [3, 2];
196
- * // First solve Ly = b, then Ux = y
197
- * ```
198
- *
199
- * @complexity Time: O(n³/3), Space: O(n²)
200
- * @see {@link MatrixCholesky} For symmetric positive definite matrices (more efficient)
186
+ * ```typescript
187
+ * ```ts
188
+ * const A = [[2, 1], [1, 1]];
189
+ * const { L, U, P } = MatrixLU(A);
190
+ * // L = [[1, 0], [0.5, 1]], U = [[2, 1], [0, 0.5]], P = [0, 1]
191
+ * // Verify: L × U should equal P-permuted A
192
+ * const product = MatrixMultiply(L, U);
193
+ * // product ≈ [[2, 1], [1, 1]]
194
+ * ```
195
+ * @complexity Time: O(n³/3), Space: O(n²)
196
+ * @see {@link MatrixCholesky} For symmetric positive definite matrices (more efficient)
197
+ * @see {@link MatrixSolve} For solving Ax = b directly
198
+ * ```
201
199
  */
202
- export declare function MatrixLU(matrix: IMatrix): TLUDecompositionResult;
200
+ export declare function MatrixLU(matrix: TMatrix): TLUDecompositionResult;
203
201
  /**
204
202
  * Performs QR decomposition A = Q × R using Modified Gram-Schmidt orthogonalization.
205
203
  *
@@ -224,25 +222,24 @@ export declare function MatrixLU(matrix: IMatrix): TLUDecompositionResult;
224
222
  * @throws {Error} If matrix has more columns than rows or columns are linearly dependent
225
223
  *
226
224
  * @example
227
- * ```ts
228
- * const A = [[1, 1], [1, 0], [0, 1]]; // 3×2 matrix
229
- * const { Q, R } = MatrixQR(A);
230
- * // Q: 3×2 orthogonal matrix with Q^T × Q = I₂
231
- * // R: 2×2 upper triangular matrix
232
- *
233
- * // Verify: Q × R should equal A
234
- * const reconstructed = MatrixMultiply(Q, R);
235
- * // reconstructed ≈ A
236
- *
237
- * // Check orthogonality: Q^T × Q should be identity
238
- * const QT = MatrixTranspose(Q);
239
- * const identity = MatrixMultiply(QT, Q);
240
- * ```
241
- *
242
- * @complexity Time: O(mn²), Space: O(mn) where m ≥ n
243
- * @see {@link MatrixGramSchmidt} {@link MatrixLU} {@link MatrixEigenQRIteration}
225
+ * ```typescript
226
+ * ```ts
227
+ * const A = [[1, 1], [1, 0], [0, 1]]; // 3×2 matrix
228
+ * const { Q, R } = MatrixQR(A);
229
+ * // Q: 3×2 orthogonal matrix with Q^T × Q = I₂
230
+ * // R: 2×2 upper triangular matrix
231
+ * // Verify: Q × R should equal A
232
+ * const reconstructed = MatrixMultiply(Q, R);
233
+ * // reconstructed ≈ A
234
+ * // Check orthogonality: Q^T × Q should be identity
235
+ * const QT = MatrixTranspose(Q);
236
+ * const identity = MatrixMultiply(QT, Q);
237
+ * ```
238
+ * @complexity Time: O(mn²), Space: O(mn) where m ≥ n
239
+ * @see {@link MatrixGramSchmidt} {@link MatrixLU} {@link MatrixEigenQRIteration}
240
+ * ```
244
241
  */
245
- export declare function MatrixQR(matrix: IMatrix, allowDependentColumns?: boolean): TQRDecompositionResult;
242
+ export declare function MatrixQR(matrix: TMatrix, allowDependentColumns?: boolean): TQRDecompositionResult;
246
243
  /**
247
244
  * Performs Singular Value Decomposition (SVD) of a matrix A = U × Σ × V^T.
248
245
  *
@@ -276,31 +273,30 @@ export declare function MatrixQR(matrix: IMatrix, allowDependentColumns?: boolea
276
273
  * @throws {Error} If matrix contains invalid values (NaN, Infinity)
277
274
  *
278
275
  * @example
279
- * ```ts
280
- * const A = [[1, 2], [3, 4], [5, 6]]; // 3×2 matrix
281
- * const { U, S, VT } = MatrixSVD(A);
282
- * // U: 3×2 matrix with orthonormal columns
283
- * // S: [σ₁, σ₂] singular values in descending order
284
- * // VT: 2×2 orthogonal matrix (V transposed)
285
- *
286
- * // Verify reconstruction: U × diag(S) × VT ≈ A
287
- * const Sigma = Matrix_Diagonal(S);
288
- * const reconstructed = MatrixMultiply(MatrixMultiply(U, Sigma), VT);
289
- *
290
- * // Matrix rank from singular values (count non-zero values)
291
- * const rank = S.filter(s => s > 1e-10).length;
292
- *
293
- * // Condition number for stability analysis
294
- * const conditionNumber = S[0] / S[S.length - 1];
295
- * ```
296
- *
297
- * @complexity Time: O(min(m²n, mn²)), Space: O(m² + n²)
298
- * @see {@link MatrixQR} {@link MatrixEigenQRIteration} {@link Matrix_PseudoInverse}
276
+ * ```typescript
277
+ * ```ts
278
+ * const A = [[1, 2], [3, 4], [5, 6]]; // 3×2 matrix
279
+ * const { U, S, VT } = MatrixSVD(A);
280
+ * // U: 3×2 matrix with orthonormal columns
281
+ * // S: [σ₁, σ₂] singular values in descending order
282
+ * // VT: 2×2 orthogonal matrix (V transposed)
283
+ * // Verify reconstruction: U × diag(S) × VT ≈ A
284
+ * const Sigma = Matrix_Diagonal(S);
285
+ * const reconstructed = MatrixMultiply(MatrixMultiply(U, Sigma), VT);
286
+ * // Matrix rank from singular values (count non-zero values)
287
+ * const rank = S.filter(s => s > 1e-10).length;
288
+ * // Condition number for stability analysis
289
+ * const conditionNumber = S[0] / S[S.length - 1];
290
+ * ```
291
+ * @complexity Time: O(min(m²n, mn²)), Space: O(m² + n²)
292
+ * @see {@link MatrixQR} {@link MatrixEigenQRIteration} {@link Matrix_PseudoInverse}
293
+ * ```
299
294
  */
300
- export declare function MatrixSVD(matrix: IMatrix): TSVDDecompositionResult;
295
+ export declare function MatrixSVD(matrix: TMatrix): TSVDDecompositionResult;
301
296
  /**
302
297
  * Solves the linear system Ax = b for the unknown vector x.
303
- * Uses LU decomposition internally followed by forward and back substitution.
298
+ * Uses LU decomposition with partial pivoting internally: decomposes A into P, L, U,
299
+ * applies the row permutation to b, then performs forward and back substitution.
304
300
  *
305
301
  * Given an n×n coefficient matrix A and an n-element right-hand side vector b,
306
302
  * finds x such that A × x = b.
@@ -311,16 +307,17 @@ export declare function MatrixSVD(matrix: IMatrix): TSVDDecompositionResult;
311
307
  * @throws {MatrixError} If A is not square, singular, or b has the wrong length
312
308
  *
313
309
  * @example
314
- * // 2x + y = 8
315
- * // 5x + 3y = 20
316
- * MatrixSolve([[2, 1], [5, 3]], [8, 20]); // [4, 0]
317
- *
318
- * @example
319
- * // Solve a 3×3 system
320
- * const A = [[1, 2, -1], [2, 1, 1], [3, -1, 2]];
321
- * const b = [4, 7, 2];
322
- * MatrixSolve(A, b); // solution vector x
310
+ * ```typescript
311
+ * // 2x + y = 8
312
+ * // 5x + 3y = 20
313
+ * MatrixSolve([[2, 1], [5, 3]], [8, 20]); // [4, 0]
314
+ * @example
315
+ * // Solve a 3×3 system
316
+ * const A = [[1, 2, -1], [2, 1, 1], [3, -1, 2]];
317
+ * const b = [4, 7, 2];
318
+ * MatrixSolve(A, b); // solution vector x
319
+ * ```
323
320
  */
324
- export declare function MatrixSolve(a: IMatrix, b: number[]): number[];
321
+ export declare function MatrixSolve(a: TMatrix, b: number[]): number[];
325
322
  export {};
326
323
  //# sourceMappingURL=decompositions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decompositions.d.ts","sourceRoot":"","sources":["../../src/matrices/decompositions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAKrC;;;;;;GAMG;AACH,KAAK,yBAAyB,GAAG;IAChC,iDAAiD;IACjD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mGAAmG;IACnG,YAAY,EAAE,OAAO,CAAC;CACtB,CAAC;AACF;;;;;;GAMG;AACH,KAAK,sBAAsB,GAAG;IAC7B,uDAAuD;IAEvD,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,oDAAoD;IAEpD,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF;;;;;;GAMG;AACH,KAAK,sBAAsB,GAAG;IAC7B,0CAA0C;IAE1C,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,8BAA8B;IAE9B,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF;;;;;;;GAOG;AACH,KAAK,uBAAuB,GAAG;IAC9B,2DAA2D;IAE3D,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IACpB,qFAAqF;IAErF,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,6FAA6F;IAE7F,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;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