@pawells/math-extended 1.1.1 → 3.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 (113) hide show
  1. package/README.md +15 -21
  2. package/build/angles.d.ts +28 -18
  3. package/build/angles.d.ts.map +1 -1
  4. package/build/angles.js +28 -18
  5. package/build/angles.js.map +1 -1
  6. package/build/clamp.d.ts +2 -0
  7. package/build/clamp.d.ts.map +1 -1
  8. package/build/clamp.js +2 -0
  9. package/build/clamp.js.map +1 -1
  10. package/build/core.d.ts +23 -0
  11. package/build/core.d.ts.map +1 -0
  12. package/build/core.js +25 -0
  13. package/build/core.js.map +1 -0
  14. package/build/index.d.ts +1 -4
  15. package/build/index.d.ts.map +1 -1
  16. package/build/index.js +1 -6
  17. package/build/index.js.map +1 -1
  18. package/build/interpolation.d.ts +62 -13
  19. package/build/interpolation.d.ts.map +1 -1
  20. package/build/interpolation.js +66 -23
  21. package/build/interpolation.js.map +1 -1
  22. package/build/matrices/arithmetic.d.ts +65 -76
  23. package/build/matrices/arithmetic.d.ts.map +1 -1
  24. package/build/matrices/arithmetic.js +65 -107
  25. package/build/matrices/arithmetic.js.map +1 -1
  26. package/build/matrices/asserts.d.ts +26 -273
  27. package/build/matrices/asserts.d.ts.map +1 -1
  28. package/build/matrices/asserts.js +106 -350
  29. package/build/matrices/asserts.js.map +1 -1
  30. package/build/matrices/core.d.ts +150 -79
  31. package/build/matrices/core.d.ts.map +1 -1
  32. package/build/matrices/core.js +128 -104
  33. package/build/matrices/core.js.map +1 -1
  34. package/build/matrices/decompositions.d.ts +41 -44
  35. package/build/matrices/decompositions.d.ts.map +1 -1
  36. package/build/matrices/decompositions.js +51 -94
  37. package/build/matrices/decompositions.js.map +1 -1
  38. package/build/matrices/index.d.ts +2 -2
  39. package/build/matrices/index.d.ts.map +1 -1
  40. package/build/matrices/index.js +2 -2
  41. package/build/matrices/index.js.map +1 -1
  42. package/build/matrices/linear-algebra.d.ts +56 -19
  43. package/build/matrices/linear-algebra.d.ts.map +1 -1
  44. package/build/matrices/linear-algebra.js +80 -36
  45. package/build/matrices/linear-algebra.js.map +1 -1
  46. package/build/matrices/normalization.d.ts +36 -15
  47. package/build/matrices/normalization.d.ts.map +1 -1
  48. package/build/matrices/normalization.js +32 -23
  49. package/build/matrices/normalization.js.map +1 -1
  50. package/build/matrices/transformations.d.ts +39 -52
  51. package/build/matrices/transformations.d.ts.map +1 -1
  52. package/build/matrices/transformations.js +8 -11
  53. package/build/matrices/transformations.js.map +1 -1
  54. package/build/matrices/types.d.ts +39 -67
  55. package/build/matrices/types.d.ts.map +1 -1
  56. package/build/matrices/types.js +63 -1
  57. package/build/matrices/types.js.map +1 -1
  58. package/build/quaternions/asserts.d.ts +114 -15
  59. package/build/quaternions/asserts.d.ts.map +1 -1
  60. package/build/quaternions/asserts.js +189 -51
  61. package/build/quaternions/asserts.js.map +1 -1
  62. package/build/quaternions/conversions.d.ts +18 -8
  63. package/build/quaternions/conversions.d.ts.map +1 -1
  64. package/build/quaternions/conversions.js +14 -4
  65. package/build/quaternions/conversions.js.map +1 -1
  66. package/build/quaternions/core.d.ts +31 -2
  67. package/build/quaternions/core.d.ts.map +1 -1
  68. package/build/quaternions/core.js +32 -4
  69. package/build/quaternions/core.js.map +1 -1
  70. package/build/quaternions/index.d.ts +2 -2
  71. package/build/quaternions/index.d.ts.map +1 -1
  72. package/build/quaternions/index.js +3 -2
  73. package/build/quaternions/index.js.map +1 -1
  74. package/build/quaternions/interpolation.d.ts +7 -1
  75. package/build/quaternions/interpolation.d.ts.map +1 -1
  76. package/build/quaternions/interpolation.js +12 -6
  77. package/build/quaternions/interpolation.js.map +1 -1
  78. package/build/quaternions/predefined.d.ts +7 -1
  79. package/build/quaternions/predefined.d.ts.map +1 -1
  80. package/build/quaternions/predefined.js +6 -0
  81. package/build/quaternions/predefined.js.map +1 -1
  82. package/build/quaternions/types.d.ts +24 -13
  83. package/build/quaternions/types.d.ts.map +1 -1
  84. package/build/quaternions/types.js +51 -1
  85. package/build/quaternions/types.js.map +1 -1
  86. package/build/random.d.ts +66 -20
  87. package/build/random.d.ts.map +1 -1
  88. package/build/random.js +73 -20
  89. package/build/random.js.map +1 -1
  90. package/build/vectors/asserts.d.ts +33 -99
  91. package/build/vectors/asserts.d.ts.map +1 -1
  92. package/build/vectors/asserts.js +145 -181
  93. package/build/vectors/asserts.js.map +1 -1
  94. package/build/vectors/core.d.ts +76 -44
  95. package/build/vectors/core.d.ts.map +1 -1
  96. package/build/vectors/core.js +128 -119
  97. package/build/vectors/core.js.map +1 -1
  98. package/build/vectors/index.d.ts.map +1 -1
  99. package/build/vectors/index.js +1 -0
  100. package/build/vectors/index.js.map +1 -1
  101. package/build/vectors/interpolation.d.ts +13 -1
  102. package/build/vectors/interpolation.d.ts.map +1 -1
  103. package/build/vectors/interpolation.js +48 -47
  104. package/build/vectors/interpolation.js.map +1 -1
  105. package/build/vectors/predefined.d.ts +73 -25
  106. package/build/vectors/predefined.d.ts.map +1 -1
  107. package/build/vectors/predefined.js +62 -18
  108. package/build/vectors/predefined.js.map +1 -1
  109. package/build/vectors/types.d.ts +26 -4
  110. package/build/vectors/types.d.ts.map +1 -1
  111. package/build/vectors/types.js +50 -1
  112. package/build/vectors/types.js.map +1 -1
  113. package/package.json +4 -3
@@ -1,40 +1,7 @@
1
- import { AssertArray2D, AssertNumber, SetExceptionClass, SetExceptionMessage, ThrowException } from '@pawells/typescript-common';
2
- import { MatrixSize } from './core.js';
1
+ import { MatrixSize } from '../index.js';
2
+ import { MATRIX1_SCHEMA, MATRIX2_SCHEMA, MATRIX3_SCHEMA, MATRIX4_SCHEMA, MATRIX_SCHEMA, MATRIX_SQUARE_SCHEMA } from './types.js';
3
3
  /**
4
- * Custom error class for matrix-related validation failures.
5
- *
6
- * This error class provides a specific error type for matrix validation
7
- * failures, making it easier to catch and handle matrix-specific errors
8
- * separately from other types of errors in your application.
9
- *
10
- * @class MatrixError
11
- * @extends Error
12
- * @example
13
- * ```typescript
14
- * try {
15
- * AssertMatrix(invalidMatrix);
16
- * } catch (error) {
17
- * if (error instanceof MatrixError) {
18
- * console.log('Matrix validation failed:', error.message);
19
- * }
20
- * }
21
- * ```
22
- */
23
- export class MatrixError extends Error {
24
- /**
25
- * Creates a new MatrixError instance.
26
- *
27
- * @param message - Optional error message describing the validation failure
28
- */
29
- constructor(message) {
30
- super(message);
31
- this.name = 'MatrixError';
32
- // Maintains proper prototype chain for instanceof checks
33
- Object.setPrototypeOf(this, new.target.prototype);
34
- }
35
- }
36
- /**
37
- * Validates that an unknown value is a valid matrix conforming to the IMatrix interface.
4
+ * Validates that an unknown value is a valid matrix conforming to the TMatrix interface.
38
5
  *
39
6
  * This function performs comprehensive validation of matrix structure including:
40
7
  * - Type checking to ensure the value is a proper matrix
@@ -45,349 +12,138 @@ export class MatrixError extends Error {
45
12
  * @param matrix - The value to validate as a matrix
46
13
  * @param args - Validation configuration options
47
14
  * @param exception - Custom exception details if validation fails
48
- * @throws {IAssertException} When the matrix doesn't meet the specified criteria
15
+ * @throws {MatrixError} When the matrix doesn't meet the specified criteria
49
16
  *
50
17
  * @example
51
18
  * ```typescript
19
+ * ```typescript
52
20
  * // Validate a 3x3 square matrix
53
21
  * AssertMatrix(someValue, { square: true, size: 3 });
54
- *
55
22
  * // Validate minimum dimensions
56
23
  * AssertMatrix(someValue, { minRows: 2, minColumns: 3 });
57
- *
58
24
  * // Validate exact dimensions
59
25
  * AssertMatrix(someValue, { rows: 4, columns: 5 });
60
26
  * ```
27
+ * ```
61
28
  */
62
- export function AssertMatrix(matrix, args = {}, exception = {}) {
63
- // Initialize the exception with the default MatrixError class if not provided
64
- SetExceptionClass(exception, MatrixError);
65
- // First validation: ensure the input is a valid 2D array structure
66
- AssertArray2D(matrix, {}, exception);
67
- // Second validation: verify all elements are numeric values
68
- // Note: We check both type and NaN since NaN has type 'number' but isn't a valid matrix element
69
- for (let i = 0; i < matrix.length; i++) {
70
- const row = matrix[i];
71
- if (row) {
72
- for (let j = 0; j < row.length; j++) {
73
- if (typeof row[j] !== 'number' || Number.isNaN(row[j])) {
74
- SetExceptionMessage(exception, `Matrix[${i}][${j}] Not a Number`);
75
- ThrowException(exception);
76
- }
77
- }
78
- }
79
- }
80
- // Extract matrix dimensions for constraint validation
81
- const [rows, columns] = MatrixSize(matrix);
82
- // Reject empty matrices (zero rows or zero columns)
83
- if (rows === 0 || columns === 0) {
84
- SetExceptionMessage(exception, 'Matrix must have at least one row and one column');
85
- ThrowException(exception);
86
- }
87
- // Validate exact size constraint when specified as [rows, columns] tuple
88
- if (Array.isArray(args.size)) {
89
- const [expectedRows, expectedColumns] = args.size;
90
- if (rows !== expectedRows) {
91
- SetExceptionMessage(exception, `Matrix has ${rows} rows, expected exactly ${expectedRows}`);
92
- ThrowException(exception);
93
- }
94
- if (columns !== expectedColumns) {
95
- SetExceptionMessage(exception, `Matrix has ${columns} columns, expected exactly ${expectedColumns}`);
96
- ThrowException(exception);
29
+ /**
30
+ * Matrix error class for validation failures and matrix operations.
31
+ * Extends Error to provide detailed error information with optional cause chain.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * throw new MatrixError('Invalid matrix dimensions', { cause: originalError });
36
+ * ```
37
+ */
38
+ export class MatrixError extends Error {
39
+ code = 'MATRIX_ERROR';
40
+ constructor(message, options) {
41
+ super(message);
42
+ this.name = 'MatrixError';
43
+ if (options?.cause) {
44
+ this.cause = options.cause;
97
45
  }
98
46
  }
99
- else if (typeof args.size === 'number') {
100
- // Validate exact size constraint when specified as single number (assumes square matrix)
101
- if (rows !== args.size) {
102
- SetExceptionMessage(exception, `Square matrix has ${rows} rows, expected exactly ${args.size}`);
103
- ThrowException(exception);
47
+ }
48
+ /**
49
+ * Factory function to create a Validate* type guard from an Assert* function.
50
+ * @param assert - The assertion function to wrap
51
+ * @returns A type guard function that returns true if valid, false otherwise
52
+ */
53
+ function makeValidate(assert) {
54
+ return (value) => {
55
+ try {
56
+ assert(value);
57
+ return true;
104
58
  }
105
- if (columns !== args.size) {
106
- SetExceptionMessage(exception, `Square matrix has ${columns} columns, expected exactly ${args.size}`);
107
- ThrowException(exception);
59
+ catch {
60
+ return false;
108
61
  }
62
+ };
63
+ }
64
+ export function AssertMatrix(matrix) {
65
+ try {
66
+ MATRIX_SCHEMA.parse(matrix);
109
67
  }
110
- // Validate exact row count constraint when explicitly specified
111
- if (args.rows !== undefined && rows !== args.rows) {
112
- SetExceptionMessage(exception, `Matrix has ${rows} rows, expected exactly ${args.rows}`);
113
- ThrowException(exception);
68
+ catch (error) {
69
+ const message = error instanceof Error ? error.message : String(error);
70
+ throw new MatrixError(`Invalid matrix: ${message}`, {
71
+ cause: error instanceof Error ? error : undefined,
72
+ });
114
73
  }
115
- // Validate exact column count constraint when explicitly specified
116
- if (args.columns !== undefined && columns !== args.columns) {
117
- SetExceptionMessage(exception, `Matrix has ${columns} columns, expected exactly ${args.columns}`);
118
- ThrowException(exception);
74
+ }
75
+ export const ValidateMatrix = makeValidate(AssertMatrix);
76
+ export function AssertMatrix1(matrix) {
77
+ try {
78
+ MATRIX1_SCHEMA.parse(matrix);
119
79
  }
120
- // Validate minimum row count constraint (useful for operations requiring minimum dimensions)
121
- if (args.minRows !== undefined && rows < args.minRows) {
122
- SetExceptionMessage(exception, `Matrix has ${rows} rows, minimum required is ${args.minRows}`);
123
- ThrowException(exception);
80
+ catch (error) {
81
+ const message = error instanceof Error ? error.message : String(error);
82
+ throw new MatrixError(`Invalid 1x1 matrix: ${message}`, {
83
+ cause: error instanceof Error ? error : undefined,
84
+ });
124
85
  }
125
- // Validate maximum row count constraint (useful for memory or performance limits)
126
- if (args.maxRows !== undefined && rows > args.maxRows) {
127
- SetExceptionMessage(exception, `Matrix has ${rows} rows, maximum allowed is ${args.maxRows}`);
128
- ThrowException(exception);
86
+ }
87
+ export const ValidateMatrix1 = makeValidate(AssertMatrix1);
88
+ export function AssertMatrix2(matrix) {
89
+ try {
90
+ MATRIX2_SCHEMA.parse(matrix);
129
91
  }
130
- // Validate minimum column count constraint (useful for operations requiring minimum dimensions)
131
- if (args.minColumns !== undefined && columns < args.minColumns) {
132
- SetExceptionMessage(exception, `Matrix has ${columns} columns, minimum required is ${args.minColumns}`);
133
- ThrowException(exception);
92
+ catch (error) {
93
+ const message = error instanceof Error ? error.message : String(error);
94
+ throw new MatrixError(`Invalid 2x2 matrix: ${message}`, {
95
+ cause: error instanceof Error ? error : undefined,
96
+ });
134
97
  }
135
- // Validate maximum column count constraint (useful for memory or performance limits)
136
- if (args.maxColumns !== undefined && columns > args.maxColumns) {
137
- SetExceptionMessage(exception, `Matrix has ${columns} columns, maximum allowed is ${args.maxColumns}`);
138
- ThrowException(exception);
98
+ }
99
+ export const ValidateMatrix2 = makeValidate(AssertMatrix2);
100
+ export function AssertMatrix3(matrix) {
101
+ try {
102
+ MATRIX3_SCHEMA.parse(matrix);
139
103
  }
140
- // Validate square matrix constraint (required for operations like determinant, inverse, etc.)
141
- if (args.square === true && rows !== columns) {
142
- SetExceptionMessage(exception, `Matrix must be square but has ${rows} rows and ${columns} columns`);
143
- ThrowException(exception);
104
+ catch (error) {
105
+ const message = error instanceof Error ? error.message : String(error);
106
+ throw new MatrixError(`Invalid 3x3 matrix: ${message}`, {
107
+ cause: error instanceof Error ? error : undefined,
108
+ });
144
109
  }
145
110
  }
146
- /**
147
- * Validates that an unknown value is a valid matrix row (array of numbers).
148
- *
149
- * This function ensures that the provided value is a proper matrix row,
150
- * which should be an array containing only numeric values.
151
- *
152
- * @param row - The value to validate as a matrix row
153
- * @param exception - Custom exception details (optionally includes `rowIndex` for richer messages)
154
- * @throws {MatrixError} When the row is not a valid array of finite numbers
155
- *
156
- * @example
157
- * ```typescript
158
- * // Validate a matrix row
159
- * AssertMatrixRow([1, 2, 3, 4]);
160
- *
161
- * // Validate with row index in exception for better error messages
162
- * AssertMatrixRow([1, 2, 3, 4], { rowIndex: 0 });
163
- *
164
- * // This would throw MatrixError
165
- * AssertMatrixRow([1, '2', 3]); // Contains non-numeric value
166
- * ```
167
- */
168
- export function AssertMatrixRow(row, exception = {}) {
169
- // Initialize the exception with the default MatrixError class if not provided
170
- SetExceptionClass(exception, MatrixError);
171
- // First validation: ensure the input is an array
172
- if (!Array.isArray(row)) {
173
- const rowInfo = exception.rowIndex !== undefined ? ` at row ${exception.rowIndex}` : '';
174
- SetExceptionMessage(exception, `Matrix row${rowInfo} must be an array`);
175
- ThrowException(exception);
111
+ export const ValidateMatrix3 = makeValidate(AssertMatrix3);
112
+ export function AssertMatrix4(matrix) {
113
+ try {
114
+ MATRIX4_SCHEMA.parse(matrix);
176
115
  }
177
- // Safe cast to array since we've verified it's an array
178
- const rowArray = row;
179
- // Second validation: ensure all elements are finite numbers
180
- // This excludes NaN, Infinity, and -Infinity which are technically numbers but invalid for matrices
181
- for (let i = 0; i < rowArray.length; i++) {
182
- if (typeof rowArray[i] !== 'number' || !isFinite(rowArray[i])) {
183
- const rowInfo = exception.rowIndex !== undefined ? ` at row ${exception.rowIndex}` : '';
184
- SetExceptionMessage(exception, `Matrix row${rowInfo} element at index ${i} is not a finite number`);
185
- ThrowException(exception);
186
- }
116
+ catch (error) {
117
+ const message = error instanceof Error ? error.message : String(error);
118
+ throw new MatrixError(`Invalid 4x4 matrix: ${message}`, {
119
+ cause: error instanceof Error ? error : undefined,
120
+ });
187
121
  }
188
122
  }
189
- /**
190
- * Validates that an unknown value is a valid matrix element (finite number).
191
- *
192
- * This function ensures that the provided value is a proper matrix element,
193
- * which should be a finite number (not NaN, Infinity, or -Infinity).
194
- *
195
- * @param value - The value to validate as a matrix element
196
- * @param exception - Custom exception details (optionally includes `rowIndex` and `columnIndex` for richer messages)
197
- * @throws {MatrixError} When the value is not a finite number
198
- *
199
- * @example
200
- * ```typescript
201
- * // Validate a matrix element
202
- * AssertMatrixValue(42);
203
- *
204
- * // Validate with position information for better error messages
205
- * AssertMatrixValue(3.14, { rowIndex: 0, columnIndex: 1 });
206
- *
207
- * // These would throw MatrixError
208
- * AssertMatrixValue(NaN); // Not a number
209
- * AssertMatrixValue(Infinity); // Not a finite number
210
- * AssertMatrixValue('5'); // Not a number type
211
- * ```
212
- */
213
- export function AssertMatrixValue(value, exception = {}) {
214
- // Initialize the exception with the default MatrixError class if not provided
215
- SetExceptionClass(exception, MatrixError);
216
- // Build position information for error messages when row and column indices are available
217
- // This provides more context about where the validation failure occurred
218
- const position = exception.rowIndex !== undefined && exception.columnIndex !== undefined ? ` at row ${exception.rowIndex}, column ${exception.columnIndex}` : '';
219
- SetExceptionMessage(exception, `Matrix value${position} must be a finite number`);
220
- // Delegate to the general number assertion which handles finite number validation
221
- AssertNumber(value, { finite: true }, exception);
222
- }
223
- /**
224
- * Validates compatibility between two matrices for mathematical operations.
225
- *
226
- * This function checks that two matrices are compatible for operations like
227
- * multiplication, addition, or other matrix operations that require specific
228
- * dimensional relationships.
229
- *
230
- * @param a - The first matrix to validate
231
- * @param b - The second matrix to validate
232
- * @param args - Validation configuration options
233
- * @param exception - Custom exception details if validation fails
234
- * @throws {IAssertException} When the matrices are not compatible
235
- *
236
- * @example
237
- * ```typescript
238
- * // Validate matrices for multiplication (A columns must equal B rows)
239
- * AssertMatrices(matrixA, matrixB);
240
- *
241
- * // Allow transposed compatibility
242
- * AssertMatrices(matrixA, matrixB, { transposition: true });
243
- * ```
244
- */
245
- export function AssertMatrices(a, b, args = {}, exception = {}) {
246
- // Initialize the exception with the default MatrixError class if not provided
247
- SetExceptionClass(exception, MatrixError);
248
- // First validation: ensure both inputs are valid matrices
249
- AssertMatrix(a, {}, exception);
250
- AssertMatrix(b, {}, exception);
251
- // Safe cast to IMatrix since we've validated both inputs
252
- const matrixA = a;
253
- const matrixB = b;
254
- // Extract dimensions from both matrices for compatibility checking
255
- const rowsA = matrixA.length;
256
- const columnsA = rowsA > 0 && matrixA[0] ? matrixA[0].length : 0;
257
- const rowsB = matrixB.length;
258
- const columnsB = rowsB > 0 && matrixB[0] ? matrixB[0].length : 0;
259
- // Check compatibility based on whether transposition is allowed
260
- if (args.transposition === true) {
261
- // With transposition allowed, check all possible multiplication combinations:
262
- // - A × B (standard): columns of A must equal rows of B
263
- // - A × B^T (B transposed): columns of A must equal columns of B
264
- // - A^T × B (A transposed): rows of A must equal rows of B
265
- // - A^T × B^T (both transposed): rows of A must equal columns of B
266
- const canMultiplyAB = columnsA === rowsB;
267
- const canMultiplyABT = columnsA === columnsB;
268
- const canMultiplyATB = rowsA === rowsB;
269
- const canMultiplyATBT = rowsA === columnsB;
270
- if (!canMultiplyAB && !canMultiplyABT && !canMultiplyATB && !canMultiplyATBT) {
271
- SetExceptionMessage(exception, `Matrices are not compatible for multiplication even with transposition. Matrix A is ${rowsA}×${columnsA}, Matrix B is ${rowsB}×${columnsB}`);
272
- ThrowException(exception);
273
- }
123
+ export const ValidateMatrix4 = makeValidate(AssertMatrix4);
124
+ export function AssertMatrixSquare(matrix) {
125
+ try {
126
+ MATRIX_SQUARE_SCHEMA.parse(matrix);
274
127
  }
275
- else {
276
- // Without transposition: matrices must have identical dimensions
277
- // This is required for element-wise operations like addition and subtraction
278
- if (rowsA !== rowsB || columnsA !== columnsB) {
279
- SetExceptionMessage(exception, `Matrices must have identical dimensions for addition/subtraction. Matrix A is ${rowsA}×${columnsA}, Matrix B is ${rowsB}×${columnsB}`);
280
- ThrowException(exception);
281
- }
128
+ catch (error) {
129
+ const message = error instanceof Error ? error.message : String(error);
130
+ throw new MatrixError(`Invalid square matrix: ${message}`, {
131
+ cause: error instanceof Error ? error : undefined,
132
+ });
282
133
  }
283
134
  }
284
- /**
285
- * Validates that an unknown value is a valid 1x1 matrix.
286
- *
287
- * This function ensures that the provided value is a proper 1x1 matrix,
288
- * which should be a 2D array with exactly 1 row and 1 column containing a number.
289
- *
290
- * @param matrix - The value to validate as a 1x1 matrix
291
- * @param exception - Custom exception details if validation fails
292
- * @throws {IAssertException} When the matrix is not a valid 1x1 matrix
293
- *
294
- * @example
295
- * ```typescript
296
- * // Validate a 1x1 matrix
297
- * AssertMatrix1([[5]]);
298
- *
299
- * // This would throw an exception
300
- * AssertMatrix1([[1, 2]]); // Too many columns
301
- * ```
302
- */
303
- export function AssertMatrix1(matrix, exception = {}) {
304
- // Initialize the exception with the default MatrixError class if not provided
305
- SetExceptionClass(exception, MatrixError);
306
- // Delegate to the general matrix assertion with 1x1 square matrix constraints
307
- // This ensures the matrix is exactly 1 row by 1 column
308
- AssertMatrix(matrix, { square: true, size: 1 }, exception);
309
- }
310
- /**
311
- * Validates that an unknown value is a valid 2x2 matrix.
312
- *
313
- * This function ensures that the provided value is a proper 2x2 matrix,
314
- * which should be a 2D array with exactly 2 rows and 2 columns containing numbers.
315
- *
316
- * @param matrix - The value to validate as a 2x2 matrix
317
- * @param exception - Custom exception details if validation fails
318
- * @throws {IAssertException} When the matrix is not a valid 2x2 matrix
319
- *
320
- * @example
321
- * ```typescript
322
- * // Validate a 2x2 matrix
323
- * AssertMatrix2([[1, 2], [3, 4]]);
324
- *
325
- * // This would throw an exception
326
- * AssertMatrix2([[1, 2, 3], [4, 5, 6]]); // Too many columns
327
- * ```
328
- */
329
- export function AssertMatrix2(matrix, exception = {}) {
330
- // Initialize the exception with the default MatrixError class if not provided
331
- SetExceptionClass(exception, MatrixError);
332
- // Delegate to the general matrix assertion with 2x2 square matrix constraints
333
- // This ensures the matrix is exactly 2 rows by 2 columns
334
- AssertMatrix(matrix, { square: true, size: 2 }, exception);
335
- }
336
- /**
337
- * Validates that an unknown value is a valid 3x3 matrix.
338
- *
339
- * This function ensures that the provided value is a proper 3x3 matrix,
340
- * which should be a 2D array with exactly 3 rows and 3 columns containing numbers.
341
- *
342
- * @param matrix - The value to validate as a 3x3 matrix
343
- * @param exception - Custom exception details if validation fails
344
- * @throws {IAssertException} When the matrix is not a valid 3x3 matrix
345
- *
346
- * @example
347
- * ```typescript
348
- * // Validate a 3x3 matrix
349
- * AssertMatrix3([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
350
- *
351
- * // This would throw an exception
352
- * AssertMatrix3([[1, 2], [3, 4]]); // Too few rows and columns
353
- * ```
354
- */
355
- export function AssertMatrix3(matrix, exception = {}) {
356
- // Initialize the exception with the default MatrixError class if not provided
357
- SetExceptionClass(exception, MatrixError);
358
- // Delegate to the general matrix assertion with 3x3 square matrix constraints
359
- // This ensures the matrix is exactly 3 rows by 3 columns
360
- AssertMatrix(matrix, { square: true, size: 3 }, exception);
361
- }
362
- /**
363
- * Validates that an unknown value is a valid 4x4 matrix.
364
- *
365
- * This function ensures that the provided value is a proper 4x4 matrix,
366
- * which should be a 2D array with exactly 4 rows and 4 columns containing numbers.
367
- *
368
- * @param matrix - The value to validate as a 4x4 matrix
369
- * @param exception - Custom exception details if validation fails
370
- * @throws {IAssertException} When the matrix is not a valid 4x4 matrix
371
- *
372
- * @example
373
- * ```typescript
374
- * // Validate a 4x4 matrix
375
- * AssertMatrix4([
376
- * [1, 2, 3, 4],
377
- * [5, 6, 7, 8],
378
- * [9, 10, 11, 12],
379
- * [13, 14, 15, 16]
380
- * ]);
381
- *
382
- * // This would throw an exception
383
- * AssertMatrix4([[1, 2], [3, 4]]); // Too few rows and columns
384
- * ```
385
- */
386
- export function AssertMatrix4(matrix, exception = {}) {
387
- // Initialize the exception with the default MatrixError class if not provided
388
- SetExceptionClass(exception, MatrixError);
389
- // Delegate to the general matrix assertion with 4x4 square matrix constraints
390
- // This ensures the matrix is exactly 4 rows by 4 columns
391
- AssertMatrix(matrix, { square: true, size: 4 }, exception);
135
+ export const ValidateMatrixSquare = makeValidate(AssertMatrixSquare);
136
+ export function AssertMatricesCompatible(...matrices) {
137
+ for (const matrix of matrices) {
138
+ AssertMatrix(matrix);
139
+ }
140
+ // Validate that all matrices have the same dimensions
141
+ const [firstRows, firstCols] = MatrixSize(matrices[0]);
142
+ for (let i = 1; i < matrices.length; i++) {
143
+ const [rows, cols] = MatrixSize(matrices[i]);
144
+ if (rows !== firstRows || cols !== firstCols) {
145
+ throw new MatrixError(`All matrices must have the same dimensions. Expected [${firstRows}, ${firstCols}], but got [${rows}, ${cols}] at index ${i}`);
146
+ }
147
+ }
392
148
  }
393
149
  //# sourceMappingURL=asserts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asserts.js","sourceRoot":"","sources":["../../src/matrices/asserts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEnJ,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA2FvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACrC;;;;OAIG;IACH,YAAY,OAAgB;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,yDAAyD;QACzD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,YAAY,CAAC,MAAe,EAAE,OAA0B,EAAE,EAAE,YAAoC,EAAE;IACjH,8EAA8E;IAC9E,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAE1C,mEAAmE;IACnE,aAAa,CAAS,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;IAE7C,4DAA4D;IAC5D,gGAAgG;IAChG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,GAAG,EAAE,CAAC;YACT,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAA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