@lakuna/umath 1.3.8 → 1.4.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/LICENSE +1 -1
- package/README.md +2 -0
- package/dist/algorithms/approx.d.ts +9 -0
- package/dist/algorithms/approx.d.ts.map +1 -0
- package/dist/algorithms/approx.js +12 -0
- package/dist/algorithms/approx.js.map +1 -0
- package/dist/algorithms/approxRelative.d.ts +9 -0
- package/dist/algorithms/approxRelative.d.ts.map +1 -0
- package/dist/algorithms/approxRelative.js +12 -0
- package/dist/algorithms/approxRelative.js.map +1 -0
- package/dist/algorithms/combinations.d.ts +2 -1
- package/dist/algorithms/combinations.d.ts.map +1 -1
- package/dist/algorithms/combinations.js +2 -1
- package/dist/algorithms/combinations.js.map +1 -1
- package/dist/algorithms/degreesToRadians.d.ts +3 -2
- package/dist/algorithms/degreesToRadians.d.ts.map +1 -1
- package/dist/algorithms/degreesToRadians.js +5 -3
- package/dist/algorithms/degreesToRadians.js.map +1 -1
- package/dist/algorithms/factorial.d.ts +2 -1
- package/dist/algorithms/factorial.d.ts.map +1 -1
- package/dist/algorithms/factorial.js +2 -1
- package/dist/algorithms/factorial.js.map +1 -1
- package/dist/algorithms/fibonacci.d.ts +2 -1
- package/dist/algorithms/fibonacci.d.ts.map +1 -1
- package/dist/algorithms/fibonacci.js +6 -2
- package/dist/algorithms/fibonacci.js.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.d.ts +4 -2
- package/dist/algorithms/greatestCommonDivisor.d.ts.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.js +5 -2
- package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
- package/dist/algorithms/hypergeometricPmf.d.ts +3 -2
- package/dist/algorithms/hypergeometricPmf.d.ts.map +1 -1
- package/dist/algorithms/hypergeometricPmf.js +3 -2
- package/dist/algorithms/hypergeometricPmf.js.map +1 -1
- package/dist/algorithms/isPrime.d.ts +2 -1
- package/dist/algorithms/isPrime.d.ts.map +1 -1
- package/dist/algorithms/isPrime.js +2 -1
- package/dist/algorithms/isPrime.js.map +1 -1
- package/dist/algorithms/permutations.d.ts +2 -1
- package/dist/algorithms/permutations.d.ts.map +1 -1
- package/dist/algorithms/permutations.js +2 -1
- package/dist/algorithms/permutations.js.map +1 -1
- package/dist/algorithms/primeFactorization.d.ts +2 -1
- package/dist/algorithms/primeFactorization.d.ts.map +1 -1
- package/dist/algorithms/primeFactorization.js +4 -4
- package/dist/algorithms/primeFactorization.js.map +1 -1
- package/dist/algorithms/radiansToDegrees.d.ts +3 -2
- package/dist/algorithms/radiansToDegrees.d.ts.map +1 -1
- package/dist/algorithms/radiansToDegrees.js +5 -3
- package/dist/algorithms/radiansToDegrees.js.map +1 -1
- package/dist/algorithms/summation.d.ts +2 -1
- package/dist/algorithms/summation.d.ts.map +1 -1
- package/dist/algorithms/summation.js +2 -1
- package/dist/algorithms/summation.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +102 -32
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +249 -275
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix.d.ts +14 -10
- package/dist/linalg/Matrix.d.ts.map +1 -1
- package/dist/linalg/Matrix2.d.ts +74 -51
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +96 -169
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +122 -72
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +205 -358
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +267 -150
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +553 -864
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +252 -34
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +436 -166
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts +10 -9
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +10 -9
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowSquareMatrix.d.ts +10 -9
- package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowSquareMatrix.js +10 -9
- package/dist/linalg/SlowSquareMatrix.js.map +1 -1
- package/dist/linalg/SquareMatrix.d.ts +6 -5
- package/dist/linalg/SquareMatrix.d.ts.map +1 -1
- package/dist/linalg/Vector.d.ts +8 -4
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +82 -31
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +112 -154
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +93 -41
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +171 -282
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +71 -21
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +121 -195
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/types/AxisAngle.d.ts +4 -1
- package/dist/types/AxisAngle.d.ts.map +1 -1
- package/dist/types/FieldOfView.d.ts +4 -1
- package/dist/types/FieldOfView.d.ts.map +1 -1
- package/dist/utility/BigNumber.d.ts +4 -1
- package/dist/utility/BigNumber.d.ts.map +1 -1
- package/dist/utility/BigNumber.js +4 -1
- package/dist/utility/BigNumber.js.map +1 -1
- package/dist/utility/MagnitudeError.d.ts +4 -1
- package/dist/utility/MagnitudeError.d.ts.map +1 -1
- package/dist/utility/MagnitudeError.js +4 -1
- package/dist/utility/MagnitudeError.js.map +1 -1
- package/dist/utility/MatrixSizeError.d.ts +4 -1
- package/dist/utility/MatrixSizeError.d.ts.map +1 -1
- package/dist/utility/MatrixSizeError.js +4 -1
- package/dist/utility/MatrixSizeError.js.map +1 -1
- package/dist/utility/PartialMatrixError.d.ts +4 -1
- package/dist/utility/PartialMatrixError.d.ts.map +1 -1
- package/dist/utility/PartialMatrixError.js +4 -1
- package/dist/utility/PartialMatrixError.js.map +1 -1
- package/dist/utility/SingularMatrixError.d.ts +2 -1
- package/dist/utility/SingularMatrixError.d.ts.map +1 -1
- package/dist/utility/SingularMatrixError.js +2 -1
- package/dist/utility/SingularMatrixError.js.map +1 -1
- package/dist/utility/epsilon.d.ts +4 -1
- package/dist/utility/epsilon.d.ts.map +1 -1
- package/dist/utility/epsilon.js +4 -1
- package/dist/utility/epsilon.js.map +1 -1
- package/package.json +14 -18
- package/src/algorithms/approx.ts +12 -0
- package/src/algorithms/approxRelative.ts +12 -0
- package/src/algorithms/combinations.ts +2 -1
- package/src/algorithms/degreesToRadians.ts +6 -3
- package/src/algorithms/factorial.ts +3 -1
- package/src/algorithms/fibonacci.ts +7 -2
- package/src/algorithms/greatestCommonDivisor.ts +9 -4
- package/src/algorithms/hypergeometricPmf.ts +3 -2
- package/src/algorithms/isPrime.ts +2 -1
- package/src/algorithms/permutations.ts +2 -1
- package/src/algorithms/primeFactorization.ts +5 -3
- package/src/algorithms/radiansToDegrees.ts +6 -3
- package/src/algorithms/summation.ts +2 -1
- package/src/linalg/DualQuaternion.ts +430 -292
- package/src/linalg/Matrix.ts +14 -10
- package/src/linalg/Matrix2.ts +143 -185
- package/src/linalg/Matrix3.ts +421 -385
- package/src/linalg/Matrix4.ts +1147 -952
- package/src/linalg/Quaternion.ts +706 -188
- package/src/linalg/SlowMatrix.ts +10 -9
- package/src/linalg/SlowSquareMatrix.ts +10 -9
- package/src/linalg/SquareMatrix.ts +6 -5
- package/src/linalg/Vector.ts +8 -4
- package/src/linalg/Vector2.ts +146 -173
- package/src/linalg/Vector3.ts +293 -326
- package/src/linalg/Vector4.ts +227 -215
- package/src/types/AxisAngle.ts +4 -1
- package/src/types/FieldOfView.ts +4 -1
- package/src/utility/BigNumber.ts +6 -3
- package/src/utility/MagnitudeError.ts +4 -1
- package/src/utility/MatrixSizeError.ts +4 -1
- package/src/utility/PartialMatrixError.ts +4 -1
- package/src/utility/SingularMatrixError.ts +2 -1
- package/src/utility/epsilon.ts +4 -1
package/src/linalg/Matrix.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Matrix4Like } from "./Matrix4.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* An object that could be interpreted as a matrix.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
export type MatrixLike = Record<number, number>;
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* A rectangular array of numbers, arranged in rows and columns.
|
|
8
|
-
* @see
|
|
11
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_(mathematics) | Matrix}
|
|
12
|
+
* @public
|
|
9
13
|
*/
|
|
10
14
|
export default interface Matrix extends MatrixLike {
|
|
11
15
|
/** The number of rows in this matrix. */
|
|
@@ -16,7 +20,7 @@ export default interface Matrix extends MatrixLike {
|
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Get the Frobenius norm of this matrix.
|
|
19
|
-
* @see
|
|
23
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
|
|
20
24
|
*/
|
|
21
25
|
get frob(): number;
|
|
22
26
|
|
|
@@ -24,7 +28,7 @@ export default interface Matrix extends MatrixLike {
|
|
|
24
28
|
* Add two matrices of the same size.
|
|
25
29
|
* @param matrix - The other matrix.
|
|
26
30
|
* @returns The sum of the matrices.
|
|
27
|
-
* @see
|
|
31
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
28
32
|
*/
|
|
29
33
|
add(matrix: Matrix4Like): MatrixLike;
|
|
30
34
|
|
|
@@ -59,7 +63,7 @@ export default interface Matrix extends MatrixLike {
|
|
|
59
63
|
* Multiply this matrix by another.
|
|
60
64
|
* @param matrix - The other matrix.
|
|
61
65
|
* @returns The product of the matrices.
|
|
62
|
-
* @see
|
|
66
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
|
|
63
67
|
*/
|
|
64
68
|
multiply(matrix: Matrix4Like): MatrixLike;
|
|
65
69
|
|
|
@@ -67,7 +71,7 @@ export default interface Matrix extends MatrixLike {
|
|
|
67
71
|
* Multiply this matrix by a scalar value.
|
|
68
72
|
* @param scalar - The scalar value.
|
|
69
73
|
* @returns The product of the matrix and the scalar value.
|
|
70
|
-
* @see
|
|
74
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
|
|
71
75
|
*/
|
|
72
76
|
multiplyScalar(scalar: number): MatrixLike;
|
|
73
77
|
|
|
@@ -76,8 +80,8 @@ export default interface Matrix extends MatrixLike {
|
|
|
76
80
|
* @param matrix - The other matrix.
|
|
77
81
|
* @param scalar - The scalar.
|
|
78
82
|
* @returns The sum.
|
|
79
|
-
* @see
|
|
80
|
-
* @see
|
|
83
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
84
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
|
|
81
85
|
*/
|
|
82
86
|
multiplyScalarAndAdd(matrix: Matrix4Like, scalar: number): MatrixLike;
|
|
83
87
|
|
|
@@ -85,14 +89,14 @@ export default interface Matrix extends MatrixLike {
|
|
|
85
89
|
* Subtract another matrix from this one.
|
|
86
90
|
* @param matrix - The other matrix.
|
|
87
91
|
* @returns The difference between the matrices.
|
|
88
|
-
* @see
|
|
92
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
89
93
|
*/
|
|
90
94
|
subtract(matrix: Matrix4Like): MatrixLike;
|
|
91
95
|
|
|
92
96
|
/**
|
|
93
97
|
* Transpose this matrix.
|
|
94
98
|
* @returns The transpose of this matrix.
|
|
95
|
-
* @see
|
|
99
|
+
* @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
|
|
96
100
|
*/
|
|
97
101
|
transpose(): MatrixLike;
|
|
98
102
|
}
|