@lakuna/umath 1.3.4 → 1.3.5

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 (133) hide show
  1. package/README.md +7 -9
  2. package/dist/algorithms/combinations.d.ts.map +1 -1
  3. package/dist/algorithms/combinations.js +1 -1
  4. package/dist/algorithms/combinations.js.map +1 -1
  5. package/dist/algorithms/degreesToRadians.d.ts.map +1 -1
  6. package/dist/algorithms/factorial.d.ts.map +1 -1
  7. package/dist/algorithms/factorial.js +8 -5
  8. package/dist/algorithms/factorial.js.map +1 -1
  9. package/dist/algorithms/fibonacci.d.ts +1 -1
  10. package/dist/algorithms/fibonacci.d.ts.map +1 -1
  11. package/dist/algorithms/fibonacci.js +1 -1
  12. package/dist/algorithms/fibonacci.js.map +1 -1
  13. package/dist/algorithms/greatestCommonDivisor.js +5 -9
  14. package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
  15. package/dist/algorithms/hypergeometricPmf.d.ts.map +1 -1
  16. package/dist/algorithms/hypergeometricPmf.js +1 -1
  17. package/dist/algorithms/hypergeometricPmf.js.map +1 -1
  18. package/dist/algorithms/isPrime.d.ts.map +1 -1
  19. package/dist/algorithms/isPrime.js +1 -1
  20. package/dist/algorithms/isPrime.js.map +1 -1
  21. package/dist/algorithms/permutations.d.ts.map +1 -1
  22. package/dist/algorithms/permutations.js +1 -1
  23. package/dist/algorithms/permutations.js.map +1 -1
  24. package/dist/algorithms/primeFactorization.d.ts +1 -1
  25. package/dist/algorithms/primeFactorization.d.ts.map +1 -1
  26. package/dist/algorithms/primeFactorization.js +4 -3
  27. package/dist/algorithms/primeFactorization.js.map +1 -1
  28. package/dist/algorithms/radiansToDegrees.d.ts.map +1 -1
  29. package/dist/algorithms/summation.d.ts.map +1 -1
  30. package/dist/algorithms/summation.js.map +1 -1
  31. package/dist/index.d.ts +32 -33
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +27 -27
  34. package/dist/index.js.map +1 -1
  35. package/dist/linalg/DualQuaternion.d.ts +50 -56
  36. package/dist/linalg/DualQuaternion.d.ts.map +1 -1
  37. package/dist/linalg/DualQuaternion.js +67 -61
  38. package/dist/linalg/DualQuaternion.js.map +1 -1
  39. package/dist/linalg/Matrix.d.ts +13 -12
  40. package/dist/linalg/Matrix.d.ts.map +1 -1
  41. package/dist/linalg/Matrix2.d.ts +30 -34
  42. package/dist/linalg/Matrix2.d.ts.map +1 -1
  43. package/dist/linalg/Matrix2.js +26 -23
  44. package/dist/linalg/Matrix2.js.map +1 -1
  45. package/dist/linalg/Matrix3.d.ts +47 -47
  46. package/dist/linalg/Matrix3.d.ts.map +1 -1
  47. package/dist/linalg/Matrix3.js +52 -43
  48. package/dist/linalg/Matrix3.js.map +1 -1
  49. package/dist/linalg/Matrix4.d.ts +83 -102
  50. package/dist/linalg/Matrix4.d.ts.map +1 -1
  51. package/dist/linalg/Matrix4.js +105 -89
  52. package/dist/linalg/Matrix4.js.map +1 -1
  53. package/dist/linalg/Quaternion.d.ts +36 -49
  54. package/dist/linalg/Quaternion.d.ts.map +1 -1
  55. package/dist/linalg/Quaternion.js +33 -25
  56. package/dist/linalg/Quaternion.js.map +1 -1
  57. package/dist/linalg/SlowMatrix.d.ts +9 -9
  58. package/dist/linalg/SlowMatrix.d.ts.map +1 -1
  59. package/dist/linalg/SlowMatrix.js +76 -27
  60. package/dist/linalg/SlowMatrix.js.map +1 -1
  61. package/dist/linalg/SlowSquareMatrix.d.ts +3 -3
  62. package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
  63. package/dist/linalg/SlowSquareMatrix.js +53 -21
  64. package/dist/linalg/SlowSquareMatrix.js.map +1 -1
  65. package/dist/linalg/SquareMatrix.d.ts +3 -3
  66. package/dist/linalg/SquareMatrix.d.ts.map +1 -1
  67. package/dist/linalg/Vector.d.ts +25 -24
  68. package/dist/linalg/Vector.d.ts.map +1 -1
  69. package/dist/linalg/Vector2.d.ts +35 -52
  70. package/dist/linalg/Vector2.d.ts.map +1 -1
  71. package/dist/linalg/Vector2.js +8 -6
  72. package/dist/linalg/Vector2.js.map +1 -1
  73. package/dist/linalg/Vector3.d.ts +43 -63
  74. package/dist/linalg/Vector3.d.ts.map +1 -1
  75. package/dist/linalg/Vector3.js +46 -58
  76. package/dist/linalg/Vector3.js.map +1 -1
  77. package/dist/linalg/Vector4.d.ts +34 -45
  78. package/dist/linalg/Vector4.d.ts.map +1 -1
  79. package/dist/linalg/Vector4.js +6 -2
  80. package/dist/linalg/Vector4.js.map +1 -1
  81. package/dist/types/AxisAngle.d.ts +1 -1
  82. package/dist/types/AxisAngle.d.ts.map +1 -1
  83. package/dist/utility/BigNumber.d.ts +5 -8
  84. package/dist/utility/BigNumber.d.ts.map +1 -1
  85. package/dist/utility/BigNumber.js +5 -5
  86. package/dist/utility/BigNumber.js.map +1 -1
  87. package/dist/utility/MagnitudeError.d.ts.map +1 -1
  88. package/dist/utility/MagnitudeError.js +1 -1
  89. package/dist/utility/MagnitudeError.js.map +1 -1
  90. package/dist/utility/MatrixSizeError.d.ts.map +1 -1
  91. package/dist/utility/MatrixSizeError.js.map +1 -1
  92. package/dist/utility/PartialMatrixError.d.ts.map +1 -1
  93. package/dist/utility/PartialMatrixError.js.map +1 -1
  94. package/dist/utility/epsilon.d.ts.map +1 -1
  95. package/dist/utility/epsilon.js.map +1 -1
  96. package/package.json +20 -51
  97. package/src/algorithms/combinations.ts +5 -5
  98. package/src/algorithms/degreesToRadians.ts +4 -4
  99. package/src/algorithms/factorial.ts +14 -9
  100. package/src/algorithms/fibonacci.ts +3 -3
  101. package/src/algorithms/greatestCommonDivisor.ts +15 -19
  102. package/src/algorithms/hypergeometricPmf.ts +6 -7
  103. package/src/algorithms/isPrime.ts +5 -5
  104. package/src/algorithms/permutations.ts +5 -5
  105. package/src/algorithms/primeFactorization.ts +9 -9
  106. package/src/algorithms/radiansToDegrees.ts +4 -4
  107. package/src/algorithms/summation.ts +6 -6
  108. package/src/index.ts +35 -33
  109. package/src/linalg/DualQuaternion.ts +528 -780
  110. package/src/linalg/Matrix.ts +35 -36
  111. package/src/linalg/Matrix2.ts +253 -402
  112. package/src/linalg/Matrix3.ts +502 -720
  113. package/src/linalg/Matrix4.ts +1032 -1574
  114. package/src/linalg/Quaternion.ts +400 -679
  115. package/src/linalg/SlowMatrix.ts +124 -75
  116. package/src/linalg/SlowSquareMatrix.ts +92 -63
  117. package/src/linalg/SquareMatrix.ts +7 -7
  118. package/src/linalg/Vector.ts +71 -70
  119. package/src/linalg/Vector2.ts +342 -552
  120. package/src/linalg/Vector3.ts +502 -815
  121. package/src/linalg/Vector4.ts +347 -530
  122. package/src/types/AxisAngle.ts +1 -1
  123. package/src/utility/BigNumber.ts +36 -45
  124. package/src/utility/MagnitudeError.ts +4 -4
  125. package/src/utility/MatrixSizeError.ts +2 -3
  126. package/src/utility/PartialMatrixError.ts +2 -3
  127. package/src/utility/SingularMatrixError.ts +2 -2
  128. package/src/utility/epsilon.ts +1 -4
  129. package/dist/types/IntegerRepresentation.d.ts +0 -2
  130. package/dist/types/IntegerRepresentation.d.ts.map +0 -1
  131. package/dist/types/IntegerRepresentation.js +0 -2
  132. package/dist/types/IntegerRepresentation.js.map +0 -1
  133. package/src/types/IntegerRepresentation.ts +0 -2
@@ -1,14 +1,13 @@
1
- /**
2
- * A rectangular array of numbers, arranged in rows and columns.
3
- * @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
4
- */
5
- export type MatrixLike = Matrix | ArrayLike<number>;
1
+ import type { Matrix4Like } from "./Matrix4.js";
2
+
3
+ /** An object that could be interpreted as a matrix. */
4
+ export type MatrixLike = Record<number, number>;
6
5
 
7
6
  /**
8
7
  * A rectangular array of numbers, arranged in rows and columns.
9
8
  * @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
10
9
  */
11
- export default interface Matrix extends ArrayLike<number> {
10
+ export default interface Matrix extends MatrixLike {
12
11
  /** The number of rows in this matrix. */
13
12
  height: number;
14
13
 
@@ -16,84 +15,84 @@ export default interface Matrix extends ArrayLike<number> {
16
15
  width: number;
17
16
 
18
17
  /**
19
- * The Frobenius norm of this matrix.
18
+ * Get the Frobenius norm of this matrix.
20
19
  * @see [Matrix norm](https://en.wikipedia.org/wiki/Matrix_norm)
21
20
  */
22
21
  get frob(): number;
23
22
 
24
23
  /**
25
- * Adds two matrices of the same size.
26
- * @param matrix The other matrix.
24
+ * Add two matrices of the same size.
25
+ * @param matrix - The other matrix.
27
26
  * @returns The sum of the matrices.
28
27
  * @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
29
28
  */
30
- add(matrix: MatrixLike): Matrix;
29
+ add(matrix: Matrix4Like): MatrixLike;
31
30
 
32
31
  /**
33
- * Creates a copy of this matrix.
32
+ * Create a copy of this matrix.
34
33
  * @returns A copy of this matrix.
35
34
  */
36
- clone(): Matrix;
35
+ clone(): MatrixLike;
37
36
 
38
37
  /**
39
- * Copies the values of another matrix into this one.
40
- * @param matrix The matrix to copy.
38
+ * Copy the values of another matrix into this one.
39
+ * @param matrix - The matrix to copy.
41
40
  * @returns This matrix.
42
41
  */
43
- copy(matrix: MatrixLike): this;
42
+ copy(matrix: Matrix4Like): this;
44
43
 
45
44
  /**
46
- * Determines whether this matrix is roughly equivalent to another.
47
- * @param matrix The other matrix.
45
+ * Determine whether or not this matrix is roughly equivalent to another.
46
+ * @param matrix - The other matrix.
48
47
  * @returns Whether the matrices are equivalent.
49
48
  */
50
- equals(matrix: MatrixLike): boolean;
49
+ equals(matrix: Matrix4Like): boolean;
51
50
 
52
51
  /**
53
- * Determines whether this matrix is exactly equivalent to another.
54
- * @param matrix The other matrix.
52
+ * Determine whether or not this matrix is exactly equivalent to another.
53
+ * @param matrix - The other matrix.
55
54
  * @returns Whether the matrices are equivalent.
56
55
  */
57
- exactEquals(matrix: MatrixLike): boolean;
56
+ exactEquals(matrix: Matrix4Like): boolean;
58
57
 
59
58
  /**
60
- * Multiplies this matrix by another.
61
- * @param matrix The other matrix.
59
+ * Multiply this matrix by another.
60
+ * @param matrix - The other matrix.
62
61
  * @returns The product of the matrices.
63
62
  * @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
64
63
  */
65
- multiply(matrix: MatrixLike): Matrix;
64
+ multiply(matrix: Matrix4Like): MatrixLike;
66
65
 
67
66
  /**
68
- * Multiplies this matrix by a scalar value.
69
- * @param scalar The scalar value.
67
+ * Multiply this matrix by a scalar value.
68
+ * @param scalar - The scalar value.
70
69
  * @returns The product of the matrix and the scalar value.
71
70
  * @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
72
71
  */
73
- multiplyScalar(scalar: number): Matrix;
72
+ multiplyScalar(scalar: number): MatrixLike;
74
73
 
75
74
  /**
76
- * Adds this matrix to another after multiplying the other by a scalar.
77
- * @param matrix The other matrix.
78
- * @param scalar The scalar.
75
+ * Add this matrix to another after multiplying the other by a scalar.
76
+ * @param matrix - The other matrix.
77
+ * @param scalar - The scalar.
79
78
  * @returns The sum.
80
79
  * @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
81
80
  * @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
82
81
  */
83
- multiplyScalarAndAdd(matrix: MatrixLike, scalar: number): Matrix;
82
+ multiplyScalarAndAdd(matrix: Matrix4Like, scalar: number): MatrixLike;
84
83
 
85
84
  /**
86
- * Subtracts another matrix from this one.
87
- * @param matrix The other matrix.
85
+ * Subtract another matrix from this one.
86
+ * @param matrix - The other matrix.
88
87
  * @returns The difference between the matrices.
89
88
  * @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
90
89
  */
91
- subtract(matrix: MatrixLike): Matrix;
90
+ subtract(matrix: Matrix4Like): MatrixLike;
92
91
 
93
92
  /**
94
- * Transposes this matrix.
93
+ * Transpose this matrix.
95
94
  * @returns The transpose of this matrix.
96
95
  * @see [Transpose](https://en.wikipedia.org/wiki/Transpose)
97
96
  */
98
- transpose(): Matrix;
97
+ transpose(): MatrixLike;
99
98
  }