@smockle/matrix 5.0.1 → 5.0.2

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/dist/index.d.ts CHANGED
@@ -35,7 +35,7 @@ declare namespace Matrix {
35
35
  var addable: (x: Matrix, y: Matrix) => boolean;
36
36
  var add: typeof Add;
37
37
  var multipliable: (x: Matrix, y: Matrix) => boolean;
38
- var multiply: (x: Matrix, y: Matrix) => Matrix;
38
+ var multiply: typeof Multiply;
39
39
  var invert: typeof Invert;
40
40
  }
41
41
  /**
@@ -48,6 +48,15 @@ declare namespace Matrix {
48
48
  */
49
49
  declare function Add(x: Matrix1D, y: Matrix1D): Matrix1D;
50
50
  declare function Add(x: Matrix2D, y: Matrix2D): Matrix2D;
51
+ /**
52
+ * Calculates the dot product of two matrices
53
+ * @alias module:matrix.multiply
54
+ * @param {Matrix} x - Matrix to multiply
55
+ * @param {Matrix} y - Matrix to multiply
56
+ * @return {Matrix} New matrix with the dot product
57
+ */
58
+ declare function Multiply(x: Matrix1D, y: Matrix): Matrix1D;
59
+ declare function Multiply(x: Matrix2D, y: Matrix): Matrix2D;
51
60
  /**
52
61
  * Inverts a matrix. Matrix must be a square (e.g. 1x1 or 2x2)
53
62
  * @alias module:matrix.invert
package/dist/index.js CHANGED
@@ -65,14 +65,7 @@ function innerproduct(x, y, i) {
65
65
  }
66
66
  return [..._x].reduce((z, _z, j) => z + _z * _y[j], 0);
67
67
  }
68
- /**
69
- * Calculates the dot product of two matrices
70
- * @alias module:matrix.multiply
71
- * @param {Matrix} x - Matrix to multiply
72
- * @param {Matrix} y - Matrix to multiply
73
- * @return {Matrix} New matrix with the dot product
74
- */
75
- Matrix.multiply = function (x, y) {
68
+ function Multiply(x, y) {
76
69
  if (!Matrix.multipliable(x, y)) {
77
70
  throw new TypeError("Matrices are not multipliable");
78
71
  }
@@ -88,7 +81,8 @@ Matrix.multiply = function (x, y) {
88
81
  }
89
82
  });
90
83
  }
91
- };
84
+ }
85
+ Matrix.multiply = Multiply;
92
86
  function Invert(x) {
93
87
  return Matrix(inv(x.__value));
94
88
  }
@@ -135,15 +129,10 @@ Matrix.prototype.add = add;
135
129
  Matrix.prototype.multipliable = function (y) {
136
130
  return Matrix.multipliable(this, y);
137
131
  };
138
- /**
139
- * Calculates the dot product of this matrix
140
- * @alias module:matrix#multiply
141
- * @param {Matrix} y - Matrix to multiply
142
- * @return {Matrix} New matrix with the dot product
143
- */
144
- Matrix.prototype.multiply = function (y) {
132
+ function multiply(y) {
145
133
  return Matrix.multiply(this, y);
146
- };
134
+ }
135
+ Matrix.prototype.multiply = multiply;
147
136
  /**
148
137
  * Calculates the transpose of this matrix
149
138
  * @alias module:matrix#transpose
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smockle/matrix",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Single and multi dimensional matrices and matrix functions.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",