@pawells/math-extended 2.0.0 → 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.
- package/README.md +15 -21
- package/build/clamp.d.ts +5 -5
- package/build/clamp.js +5 -5
- package/build/core.d.ts +23 -0
- package/build/core.d.ts.map +1 -0
- package/build/core.js +25 -0
- package/build/core.js.map +1 -0
- package/build/index.d.ts +1 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -6
- package/build/index.js.map +1 -1
- package/build/interpolation.d.ts +158 -171
- package/build/interpolation.d.ts.map +1 -1
- package/build/interpolation.js +162 -181
- package/build/interpolation.js.map +1 -1
- package/build/matrices/arithmetic.d.ts +132 -132
- package/build/matrices/arithmetic.d.ts.map +1 -1
- package/build/matrices/arithmetic.js +194 -226
- package/build/matrices/arithmetic.js.map +1 -1
- package/build/matrices/asserts.d.ts +30 -408
- package/build/matrices/asserts.d.ts.map +1 -1
- package/build/matrices/asserts.js +98 -542
- package/build/matrices/asserts.js.map +1 -1
- package/build/matrices/core.d.ts +117 -46
- package/build/matrices/core.d.ts.map +1 -1
- package/build/matrices/core.js +127 -103
- package/build/matrices/core.js.map +1 -1
- package/build/matrices/decompositions.d.ts +95 -96
- package/build/matrices/decompositions.d.ts.map +1 -1
- package/build/matrices/decompositions.js +119 -160
- package/build/matrices/decompositions.js.map +1 -1
- package/build/matrices/index.d.ts +0 -1
- package/build/matrices/index.d.ts.map +1 -1
- package/build/matrices/index.js +0 -3
- package/build/matrices/index.js.map +1 -1
- package/build/matrices/linear-algebra.d.ts +45 -8
- package/build/matrices/linear-algebra.d.ts.map +1 -1
- package/build/matrices/linear-algebra.js +76 -32
- package/build/matrices/linear-algebra.js.map +1 -1
- package/build/matrices/normalization.d.ts +29 -8
- package/build/matrices/normalization.d.ts.map +1 -1
- package/build/matrices/normalization.js +32 -23
- package/build/matrices/normalization.js.map +1 -1
- package/build/matrices/transformations.d.ts +116 -148
- package/build/matrices/transformations.d.ts.map +1 -1
- package/build/matrices/transformations.js +69 -91
- package/build/matrices/transformations.js.map +1 -1
- package/build/matrices/types.d.ts +32 -60
- package/build/matrices/types.d.ts.map +1 -1
- package/build/matrices/types.js +63 -1
- package/build/matrices/types.js.map +1 -1
- package/build/quaternions/asserts.d.ts +29 -38
- package/build/quaternions/asserts.d.ts.map +1 -1
- package/build/quaternions/asserts.js +61 -77
- package/build/quaternions/asserts.js.map +1 -1
- package/build/quaternions/conversions.d.ts +26 -26
- package/build/quaternions/conversions.d.ts.map +1 -1
- package/build/quaternions/conversions.js +24 -24
- package/build/quaternions/core.d.ts +70 -69
- package/build/quaternions/core.d.ts.map +1 -1
- package/build/quaternions/core.js +71 -71
- package/build/quaternions/core.js.map +1 -1
- package/build/quaternions/index.d.ts +0 -1
- package/build/quaternions/index.d.ts.map +1 -1
- package/build/quaternions/index.js +0 -2
- package/build/quaternions/index.js.map +1 -1
- package/build/quaternions/interpolation.d.ts +16 -16
- package/build/quaternions/interpolation.d.ts.map +1 -1
- package/build/quaternions/interpolation.js +21 -21
- package/build/quaternions/interpolation.js.map +1 -1
- package/build/quaternions/predefined.d.ts +10 -10
- package/build/quaternions/predefined.d.ts.map +1 -1
- package/build/quaternions/predefined.js +9 -9
- package/build/quaternions/types.d.ts +23 -12
- package/build/quaternions/types.d.ts.map +1 -1
- package/build/quaternions/types.js +51 -1
- package/build/quaternions/types.js.map +1 -1
- package/build/random.d.ts +66 -20
- package/build/random.d.ts.map +1 -1
- package/build/random.js +73 -20
- package/build/random.js.map +1 -1
- package/build/vectors/asserts.d.ts +50 -220
- package/build/vectors/asserts.d.ts.map +1 -1
- package/build/vectors/asserts.js +141 -327
- package/build/vectors/asserts.js.map +1 -1
- package/build/vectors/core.d.ts +182 -229
- package/build/vectors/core.d.ts.map +1 -1
- package/build/vectors/core.js +234 -288
- package/build/vectors/core.js.map +1 -1
- package/build/vectors/index.d.ts +0 -1
- package/build/vectors/index.d.ts.map +1 -1
- package/build/vectors/index.js +0 -2
- package/build/vectors/index.js.map +1 -1
- package/build/vectors/interpolation.d.ts +40 -40
- package/build/vectors/interpolation.d.ts.map +1 -1
- package/build/vectors/interpolation.js +75 -86
- package/build/vectors/interpolation.js.map +1 -1
- package/build/vectors/predefined.d.ts +31 -7
- package/build/vectors/predefined.d.ts.map +1 -1
- package/build/vectors/predefined.js +30 -6
- package/build/vectors/predefined.js.map +1 -1
- package/build/vectors/types.d.ts +26 -4
- package/build/vectors/types.d.ts.map +1 -1
- package/build/vectors/types.js +50 -1
- package/build/vectors/types.js.map +1 -1
- package/package.json +3 -2
- package/build/matrices/_exports.d.ts +0 -13
- package/build/matrices/_exports.d.ts.map +0 -1
- package/build/matrices/_exports.js +0 -13
- package/build/matrices/_exports.js.map +0 -1
- package/build/quaternions/_exports.d.ts +0 -11
- package/build/quaternions/_exports.d.ts.map +0 -1
- package/build/quaternions/_exports.js +0 -11
- package/build/quaternions/_exports.js.map +0 -1
- package/build/vectors/_exports.d.ts +0 -10
- package/build/vectors/_exports.d.ts.map +0 -1
- package/build/vectors/_exports.js +0 -10
- package/build/vectors/_exports.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asserts.js","sourceRoot":"","sources":["../../src/matrices/asserts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"asserts.js","sourceRoot":"","sources":["../../src/matrices/asserts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAkE,MAAM,YAAY,CAAC;AAEjM;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACrB,IAAI,GAAW,cAAc,CAAC;IAE9C,YAAY,OAAe,EAAE,OAA6B;QACzD,KAAK,CA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AAC,CAAC;IACtB,CAAC;IAED,sDAAsD;IACtD,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAY,CAAC,CAAC;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAY,CAAC,CAAC;QACxD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9C,MAAM,IAAI,WAAW,CACpB,yDAAyD,SAAS,KAAK,SAAS,eAAe,IAAI,KAAK,IAAI,cAAc,CAAC,EAAE,CAC7H,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/build/matrices/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TMatrix, TMatrix1, TMatrix2, TMatrix3, TMatrix4, TMatrixResult } from './types.js';
|
|
1
|
+
import type { TMatrix, TMatrix1, TMatrix2, TMatrix3, TMatrix4, TMatrixResult } from './types.js';
|
|
2
2
|
export declare function MatrixCreate(): TMatrix1;
|
|
3
3
|
export declare function MatrixCreate(size: 1): TMatrix1;
|
|
4
4
|
export declare function MatrixCreate(size: 2): TMatrix2;
|
|
@@ -11,7 +11,10 @@ export declare function MatrixCreate(rows: number, cols: number): TMatrix;
|
|
|
11
11
|
* @param matrix - The matrix to measure
|
|
12
12
|
* @returns {[number, number]} Tuple [rows, columns]. Returns [0, 0] for empty matrices.
|
|
13
13
|
* @throws {Error} If the input is not a valid matrix
|
|
14
|
-
* @example
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* MatrixSize([[1, 2, 3], [4, 5, 6]]) // [2, 3]
|
|
17
|
+
* ```
|
|
15
18
|
*/
|
|
16
19
|
export declare function MatrixSize(matrix: TMatrix): [number, number];
|
|
17
20
|
/**
|
|
@@ -19,34 +22,30 @@ export declare function MatrixSize(matrix: TMatrix): [number, number];
|
|
|
19
22
|
* @param matrix - The square matrix to measure
|
|
20
23
|
* @returns {number} The size (n for an n×n matrix)
|
|
21
24
|
* @throws {Error} If the matrix is not square
|
|
22
|
-
* @example
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* MatrixSizeSquare([[1, 2], [3, 4]]) // 2
|
|
28
|
+
* ```
|
|
23
29
|
*/
|
|
24
30
|
export declare function MatrixSizeSquare(matrix: TMatrix): number;
|
|
25
|
-
/**
|
|
26
|
-
* Validates that the input is a well-formed matrix.
|
|
27
|
-
* @param matrix - The value to validate as a matrix
|
|
28
|
-
* @returns {boolean} True if the input is a valid matrix, false otherwise
|
|
29
|
-
* @example MatrixIsValid([[1, 2], [3, 4]]) // true
|
|
30
|
-
* @example MatrixIsValid([[1, 'invalid'], [3, 4]]) // false
|
|
31
|
-
*/
|
|
32
|
-
export declare function MatrixIsValid(matrix: unknown): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if a matrix is square (equal number of rows and columns).
|
|
35
|
-
* @param matrix - The matrix to check
|
|
36
|
-
* @returns {boolean} True if the matrix is square, false otherwise
|
|
37
|
-
* @example MatrixIsSquare([[1, 2], [3, 4]]) // true (2×2)
|
|
38
|
-
* @example MatrixIsSquare([[1, 2, 3], [4, 5, 6]]) // false (3×2)
|
|
39
|
-
*/
|
|
40
|
-
export declare function MatrixIsSquare(matrix: TMatrix): boolean;
|
|
41
31
|
/**
|
|
42
32
|
* Checks if a matrix is a zero matrix (all elements are zero within tolerance).
|
|
43
33
|
* @param matrix - The matrix to check
|
|
44
34
|
* @param threshold - Tolerance for considering values as zero (default: 1e-14)
|
|
45
35
|
* @returns {boolean} True if all matrix elements are within threshold of zero
|
|
46
36
|
* @throws {Error} If the input is not a valid matrix
|
|
47
|
-
* @example
|
|
48
|
-
*
|
|
49
|
-
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* MatrixIsZero([[0, 0], [0, 0]]) // true
|
|
40
|
+
* ```
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* MatrixIsZero([[1e-15, 0], [0, 0]]) // true (within default threshold)
|
|
44
|
+
* ```
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* MatrixIsZero([[0.1, 0], [0, 0]]) // false
|
|
48
|
+
* ```
|
|
50
49
|
*/
|
|
51
50
|
export declare function MatrixIsZero(matrix: TMatrix, threshold?: number): boolean;
|
|
52
51
|
/**
|
|
@@ -55,9 +54,18 @@ export declare function MatrixIsZero(matrix: TMatrix, threshold?: number): boole
|
|
|
55
54
|
* @param threshold - Tolerance for floating-point comparisons (default: 1e-14)
|
|
56
55
|
* @returns {boolean} True if the matrix is an identity matrix within tolerance
|
|
57
56
|
* @throws {Error} If the input is not a valid matrix
|
|
58
|
-
* @example
|
|
59
|
-
*
|
|
60
|
-
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* MatrixIsIdentity([[1, 0], [0, 1]]) // true
|
|
60
|
+
* ```
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* MatrixIsIdentity([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) // true
|
|
64
|
+
* ```
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* MatrixIsIdentity([[1, 1], [0, 1]]) // false
|
|
68
|
+
* ```
|
|
61
69
|
*/
|
|
62
70
|
export declare function MatrixIsIdentity(matrix: TMatrix, threshold?: number): boolean;
|
|
63
71
|
/**
|
|
@@ -66,9 +74,18 @@ export declare function MatrixIsIdentity(matrix: TMatrix, threshold?: number): b
|
|
|
66
74
|
* @param threshold - Tolerance for floating-point comparisons (default: 1e-14)
|
|
67
75
|
* @returns {boolean} True if the matrix is symmetric within tolerance
|
|
68
76
|
* @throws {Error} If the input is not a valid matrix
|
|
69
|
-
* @example
|
|
70
|
-
*
|
|
71
|
-
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* MatrixIsSymmetric([[1, 2], [2, 1]]) // true
|
|
80
|
+
* ```
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* MatrixIsSymmetric([[1, 2], [3, 4]]) // false
|
|
84
|
+
* ```
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* MatrixIsSymmetric([[1, 2, 3], [2, 5, 4], [3, 4, 6]]) // true
|
|
88
|
+
* ```
|
|
72
89
|
*/
|
|
73
90
|
export declare function MatrixIsSymmetric(matrix: TMatrix, threshold?: number): boolean;
|
|
74
91
|
/**
|
|
@@ -78,9 +95,18 @@ export declare function MatrixIsSymmetric(matrix: TMatrix, threshold?: number):
|
|
|
78
95
|
* @param threshold - Tolerance for considering values as zero (default: 1e-14)
|
|
79
96
|
* @returns {boolean} True if the matrix is diagonal within tolerance
|
|
80
97
|
* @throws {Error} If the input is not a valid matrix
|
|
81
|
-
* @example
|
|
82
|
-
*
|
|
83
|
-
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* MatrixIsDiagonal([[3, 0], [0, 7]]) // true
|
|
101
|
+
* ```
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* MatrixIsDiagonal([[1, 0, 0], [0, 5, 0], [0, 0, 2]]) // true
|
|
105
|
+
* ```
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* MatrixIsDiagonal([[1, 2], [0, 1]]) // false
|
|
109
|
+
* ```
|
|
84
110
|
*/
|
|
85
111
|
export declare function MatrixIsDiagonal(matrix: TMatrix, threshold?: number): boolean;
|
|
86
112
|
/**
|
|
@@ -88,8 +114,14 @@ export declare function MatrixIsDiagonal(matrix: TMatrix, threshold?: number): b
|
|
|
88
114
|
* @param size - The dimensions of the square identity matrix (must be non-negative integer)
|
|
89
115
|
* @returns {TMatrix} A square identity matrix of size n×n
|
|
90
116
|
* @throws {Error} If size is negative or not an integer
|
|
91
|
-
* @example
|
|
92
|
-
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* MatrixIdentity(2) // [[1, 0], [0, 1]]
|
|
120
|
+
* ```
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* MatrixIdentity(3) // [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
|
124
|
+
* ```
|
|
93
125
|
*/
|
|
94
126
|
export declare function MatrixIdentity(size: 0): TMatrix;
|
|
95
127
|
export declare function MatrixIdentity(size: 1): TMatrix1;
|
|
@@ -102,7 +134,10 @@ export declare function MatrixIdentity(size: number): TMatrix;
|
|
|
102
134
|
* @param matrix - The matrix to clone
|
|
103
135
|
* @returns {TMatrixResult<T>} A new matrix with identical values but independent memory allocation
|
|
104
136
|
* @throws {Error} If the input is not a valid matrix
|
|
105
|
-
* @example
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* MatrixClone([[1, 2], [3, 4]]) // [[1, 2], [3, 4]] (independent copy)
|
|
140
|
+
* ```
|
|
106
141
|
*/
|
|
107
142
|
export declare function MatrixClone<T extends TMatrix>(matrix: T): TMatrixResult<T>;
|
|
108
143
|
/**
|
|
@@ -112,8 +147,14 @@ export declare function MatrixClone<T extends TMatrix>(matrix: T): TMatrixResult
|
|
|
112
147
|
* @param tolerance - Maximum allowed difference between corresponding elements (default: 1e-8)
|
|
113
148
|
* @returns {boolean} True if matrices are equal within tolerance, false otherwise
|
|
114
149
|
* @throws {Error} If either input is not a valid matrix or if matrix data is corrupted
|
|
115
|
-
* @example
|
|
116
|
-
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* MatrixEquals([[1, 2]], [[1.0001, 2]], 0.001) // true
|
|
153
|
+
* ```
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* MatrixEquals([[1, 2]], [[1, 3]]) // false
|
|
157
|
+
* ```
|
|
117
158
|
*/
|
|
118
159
|
export declare function MatrixEquals(a: TMatrix, b: TMatrix, tolerance?: number): boolean;
|
|
119
160
|
/**
|
|
@@ -122,8 +163,14 @@ export declare function MatrixEquals(a: TMatrix, b: TMatrix, tolerance?: number)
|
|
|
122
163
|
* @param precision - Number of decimal places for formatting (default: 2)
|
|
123
164
|
* @returns {string} A formatted string representation of the matrix
|
|
124
165
|
* @throws {Error} If the input is not a valid matrix
|
|
125
|
-
* @example
|
|
126
|
-
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* MatrixToString([[1.23, 2.7]]) // "[ 1.23, 2.70 ]"
|
|
169
|
+
* ```
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* MatrixToString([[1, 2], [3, 4]], 0) // "[ 1, 2 ]\n[ 3, 4 ]"
|
|
173
|
+
* ```
|
|
127
174
|
*/
|
|
128
175
|
export declare function MatrixToString(matrix: TMatrix, precision?: number): string;
|
|
129
176
|
/**
|
|
@@ -132,8 +179,14 @@ export declare function MatrixToString(matrix: TMatrix, precision?: number): str
|
|
|
132
179
|
* @param tolerance - Numerical tolerance for zero detection (default: 1e-10)
|
|
133
180
|
* @returns {number} The rank of the matrix (0 ≤ rank ≤ min(rows, columns))
|
|
134
181
|
* @throws {Error} If the matrix contains invalid values
|
|
135
|
-
* @example
|
|
136
|
-
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* MatrixRank([[1, 2], [2, 4]]) // 1 (second row = 2 × first row)
|
|
185
|
+
* ```
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* MatrixRank([[1, 0], [0, 1]]) // 2 (full rank)
|
|
189
|
+
* ```
|
|
137
190
|
*/
|
|
138
191
|
export declare function MatrixRank(matrix: TMatrix, tolerance?: number): number;
|
|
139
192
|
/**
|
|
@@ -141,8 +194,14 @@ export declare function MatrixRank(matrix: TMatrix, tolerance?: number): number;
|
|
|
141
194
|
* @param matrix - The input matrix (can be square or rectangular)
|
|
142
195
|
* @returns {number} The trace value (sum of diagonal elements)
|
|
143
196
|
* @throws {Error} If the matrix contains invalid values
|
|
144
|
-
* @example
|
|
145
|
-
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* MatrixTrace([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) // 15 (1 + 5 + 9)
|
|
200
|
+
* ```
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* MatrixTrace([[1, 2], [3, 4], [5, 6]]) // 5 (1 + 4, rectangular matrix)
|
|
204
|
+
* ```
|
|
146
205
|
*/
|
|
147
206
|
export declare function MatrixTrace(matrix: TMatrix): number;
|
|
148
207
|
/**
|
|
@@ -150,8 +209,14 @@ export declare function MatrixTrace(matrix: TMatrix): number;
|
|
|
150
209
|
* @param matrix - The matrix to transpose (can be any m×n matrix)
|
|
151
210
|
* @returns {TMatrixResult<T>} The transposed matrix with dimensions n×m
|
|
152
211
|
* @throws {Error} If the input is not a valid matrix
|
|
153
|
-
* @example
|
|
154
|
-
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* MatrixTranspose([[1, 2, 3], [4, 5, 6]]) // [[1, 4], [2, 5], [3, 6]]
|
|
215
|
+
* ```
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* MatrixTranspose([[1, 2], [3, 4]]) // [[1, 3], [2, 4]]
|
|
219
|
+
* ```
|
|
155
220
|
*/
|
|
156
221
|
export declare function MatrixTranspose<T extends TMatrix>(matrix: T): TMatrixResult<T>;
|
|
157
222
|
/**
|
|
@@ -160,8 +225,14 @@ export declare function MatrixTranspose<T extends TMatrix>(matrix: T): TMatrixRe
|
|
|
160
225
|
* @param fn - Transformation function: (value, row, col) => transformedValue
|
|
161
226
|
* @returns {TMatrixResult<T>} A new matrix with transformed values (same dimensions as input)
|
|
162
227
|
* @throws {Error} If the input matrix is invalid or transformation function throws
|
|
163
|
-
* @example
|
|
164
|
-
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* MatrixMap([[1, 2], [3, 4]], (value) => value * value) // [[1, 4], [9, 16]]
|
|
231
|
+
* ```
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* MatrixMap([[1, 2], [3, 4]], (value, row, col) => value + row + col) // [[1, 3], [4, 6]]
|
|
235
|
+
* ```
|
|
165
236
|
*/
|
|
166
237
|
export declare function MatrixMap<T extends TMatrix>(matrix: T, fn: (value: number, row: number, col: number) => number): TMatrixResult<T>;
|
|
167
238
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/matrices/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/matrices/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIjG,wBAAgB,YAAY,IAAI,QAAQ,CAAC;AAEzC,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC;AAEhD,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC;AAEhD,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC;AAEhD,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC;AAEhD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,O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